File: | obj-scan-build/libtrivfs/fsysServer.c |
Location: | line 798, column 2 |
Description: | Assigned value is garbage or undefined |
1 | /* Module fsys */ |
2 | |
3 | #ifndef _GNU_SOURCE1 |
4 | #define _GNU_SOURCE1 1 |
5 | #endif |
6 | |
7 | #define EXPORT_BOOLEAN |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/message.h> |
11 | #include <mach/mig_errors.h> |
12 | #include <mach/mig_support.h> |
13 | |
14 | #ifndef mig_internalstatic |
15 | #define mig_internalstatic static |
16 | #endif |
17 | |
18 | #ifndef mig_external |
19 | #define mig_external |
20 | #endif |
21 | |
22 | #ifndef mig_unlikely |
23 | #define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0) |
24 | #endif |
25 | |
26 | #ifndef TypeCheck1 |
27 | #define TypeCheck1 1 |
28 | #endif |
29 | |
30 | #ifndef UseExternRCSId1 |
31 | #define UseExternRCSId1 1 |
32 | #endif |
33 | |
34 | #define BAD_TYPECHECK(type, check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) mig_unlikely (({\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
35 | union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
36 | _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
37 | #define msgh_request_portmsgh_local_port msgh_local_port |
38 | #define MACH_MSGH_BITS_REQUEST(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
39 | #define msgh_reply_portmsgh_remote_port msgh_remote_port |
40 | #define MACH_MSGH_BITS_REPLY(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
41 | |
42 | #include <hurd/ports.h> |
43 | #include <mach/std_types.h> |
44 | #include <mach/mach_types.h> |
45 | #include <device/device_types.h> |
46 | #include <device/net_status.h> |
47 | #include <sys/types.h> |
48 | #include <sys/stat.h> |
49 | #include <sys/statfs.h> |
50 | #include <sys/resource.h> |
51 | #include <sys/utsname.h> |
52 | #include <hurd/hurd_types.h> |
53 | #include "libtrivfs/mig-decls.h" |
54 | |
55 | /* Routine fsys_startup */ |
56 | mig_internalstatic void _Xfsys_startup |
57 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
58 | { |
59 | typedef struct { |
60 | mach_msg_header_t Head; |
61 | mach_msg_type_t openflagsType; |
62 | int openflags; |
63 | mach_msg_type_t control_portType; |
64 | mach_port_t control_port; |
65 | } Request; |
66 | |
67 | typedef struct { |
68 | mach_msg_header_t Head; |
69 | mach_msg_type_t RetCodeType; |
70 | kern_return_t RetCode; |
71 | mach_msg_type_t realnodeType; |
72 | mach_port_t realnode; |
73 | } Reply; |
74 | |
75 | Request *In0P = (Request *) InHeadP; |
76 | Reply *OutP = (Reply *) OutHeadP; |
77 | mig_external kern_return_t trivfs_S_fsys_startup |
78 | (mach_port_t bootstrap, mach_port_t reply, mach_msg_type_name_t replyPoly, int openflags, mach_port_t control_port, mach_port_t *realnode, mach_msg_type_name_t *realnodePoly); |
79 | |
80 | boolean_t msgh_simple = msgh_simple; |
81 | const mach_msg_type_t openflagsCheck = { |
82 | /* msgt_name = */ 2, |
83 | /* msgt_size = */ 32, |
84 | /* msgt_number = */ 1, |
85 | /* msgt_inline = */ TRUE((boolean_t) 1), |
86 | /* msgt_longform = */ FALSE((boolean_t) 0), |
87 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
88 | /* msgt_unused = */ 0 |
89 | }; |
90 | |
91 | const mach_msg_type_t control_portCheck = { |
92 | /* msgt_name = */ 17, |
93 | /* msgt_size = */ 32, |
94 | /* msgt_number = */ 1, |
95 | /* msgt_inline = */ TRUE((boolean_t) 1), |
96 | /* msgt_longform = */ FALSE((boolean_t) 0), |
97 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
98 | /* msgt_unused = */ 0 |
99 | }; |
100 | |
101 | const mach_msg_type_t realnodeType = { |
102 | /* msgt_name = */ -1, |
103 | /* msgt_size = */ 32, |
104 | /* msgt_number = */ 1, |
105 | /* msgt_inline = */ TRUE((boolean_t) 1), |
106 | /* msgt_longform = */ FALSE((boolean_t) 0), |
107 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
108 | /* msgt_unused = */ 0 |
109 | }; |
110 | |
111 | mach_port_t bootstrap; |
112 | mach_port_t reply; |
113 | mach_msg_type_name_t realnodePoly; |
114 | |
115 | #if TypeCheck1 |
116 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
117 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
118 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
119 | #endif /* TypeCheck */ |
120 | |
121 | #if TypeCheck1 |
122 | if (BAD_TYPECHECK(&In0P->openflagsType, &openflagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->openflagsType); _c.t = * (&openflagsCheck);_t.w != _c.w; })), 0)) |
123 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
124 | #endif /* TypeCheck */ |
125 | |
126 | #if TypeCheck1 |
127 | if (BAD_TYPECHECK(&In0P->control_portType, &control_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->control_portType); _c.t = *(&control_portCheck);_t.w != _c.w; })), 0)) |
128 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
129 | #endif /* TypeCheck */ |
130 | |
131 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
132 | bootstrap = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
133 | else |
134 | bootstrap = In0P->Head.msgh_request_portmsgh_local_port; |
135 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
136 | |
137 | OutP->RetCode = trivfs_S_fsys_startup(bootstrap, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->openflags, In0P->control_port, &OutP->realnode, &realnodePoly); |
138 | if (OutP->RetCode != KERN_SUCCESS0) |
139 | return; |
140 | |
141 | msgh_simple = TRUE((boolean_t) 1); |
142 | OutP->Head.msgh_size = 40; |
143 | |
144 | OutP->realnodeType = realnodeType; |
145 | |
146 | if (MACH_MSG_TYPE_PORT_ANY(realnodePoly)(((realnodePoly) >= 16) && ((realnodePoly) <= 21 ))) |
147 | msgh_simple = FALSE((boolean_t) 0); |
148 | |
149 | OutP->realnodeType.msgt_name = realnodePoly; |
150 | |
151 | if (!msgh_simple) |
152 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
153 | } |
154 | |
155 | /* Default implementation of trivfs_S_fsys_startup */ |
156 | #ifdef MIG_EOPNOTSUPP |
157 | kern_return_t __attribute__ ((weak)) |
158 | trivfs_S_fsys_startup |
159 | ( |
160 | mach_port_t bootstrap, |
161 | mach_port_t reply, |
162 | mach_msg_type_name_t replyPoly, |
163 | int openflags, |
164 | mach_port_t control_port, |
165 | mach_port_t *realnode, |
166 | mach_msg_type_name_t *realnodePoly |
167 | ) { return MIG_EOPNOTSUPP; } |
168 | #endif /* MIG_EOPNOTSUPP */ |
169 | |
170 | /* Routine fsys_goaway */ |
171 | mig_internalstatic void _Xfsys_goaway |
172 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
173 | { |
174 | typedef struct { |
175 | mach_msg_header_t Head; |
176 | mach_msg_type_t flagsType; |
177 | int flags; |
178 | } Request; |
179 | |
180 | typedef struct { |
181 | mach_msg_header_t Head; |
182 | mach_msg_type_t RetCodeType; |
183 | kern_return_t RetCode; |
184 | } Reply; |
185 | |
186 | Request *In0P = (Request *) InHeadP; |
187 | Reply *OutP = (Reply *) OutHeadP; |
188 | mig_external kern_return_t trivfs_S_fsys_goaway |
189 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, int flags); |
190 | |
191 | const mach_msg_type_t flagsCheck = { |
192 | /* msgt_name = */ 2, |
193 | /* msgt_size = */ 32, |
194 | /* msgt_number = */ 1, |
195 | /* msgt_inline = */ TRUE((boolean_t) 1), |
196 | /* msgt_longform = */ FALSE((boolean_t) 0), |
197 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
198 | /* msgt_unused = */ 0 |
199 | }; |
200 | |
201 | trivfs_control_t fsys; |
202 | mach_port_t reply; |
203 | |
204 | #if TypeCheck1 |
205 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
206 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
207 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
208 | #endif /* TypeCheck */ |
209 | |
210 | #if TypeCheck1 |
211 | if (BAD_TYPECHECK(&In0P->flagsType, &flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->flagsType); _c.t = *(& flagsCheck);_t.w != _c.w; })), 0)) |
212 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
213 | #endif /* TypeCheck */ |
214 | |
215 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
216 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
217 | else |
218 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
219 | |
220 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
221 | |
222 | OutP->RetCode = trivfs_S_fsys_goaway(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->flags); |
223 | trivfs_end_using_control(fsys); |
224 | } |
225 | |
226 | /* Default implementation of trivfs_S_fsys_goaway */ |
227 | #ifdef MIG_EOPNOTSUPP |
228 | kern_return_t __attribute__ ((weak)) |
229 | trivfs_S_fsys_goaway |
230 | ( |
231 | trivfs_control_t fsys, |
232 | mach_port_t reply, |
233 | mach_msg_type_name_t replyPoly, |
234 | int flags |
235 | ) { return MIG_EOPNOTSUPP; } |
236 | #endif /* MIG_EOPNOTSUPP */ |
237 | |
238 | /* Routine fsys_getroot */ |
239 | mig_internalstatic void _Xfsys_getroot |
240 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
241 | { |
242 | typedef struct { |
243 | mach_msg_header_t Head; |
244 | mach_msg_type_t dotdot_nodeType; |
245 | mach_port_t dotdot_node; |
246 | mach_msg_type_long_t gen_uidsType; |
247 | uid_t gen_uids[512]; |
248 | mach_msg_type_long_t gen_gidsType; |
249 | uid_t gen_gids[512]; |
250 | mach_msg_type_t flagsType; |
251 | int flags; |
252 | } Request; |
253 | |
254 | typedef struct { |
255 | mach_msg_header_t Head; |
256 | mach_msg_type_t RetCodeType; |
257 | kern_return_t RetCode; |
258 | mach_msg_type_t do_retryType; |
259 | retry_type do_retry; |
260 | mach_msg_type_t retry_nameType; |
261 | string_t retry_name; |
262 | mach_msg_type_t fileType; |
263 | mach_port_t file; |
264 | } Reply; |
265 | |
266 | Request *In0P = (Request *) InHeadP; |
267 | Request *In1P; |
268 | Request *In2P; |
269 | Reply *OutP = (Reply *) OutHeadP; |
270 | mig_external kern_return_t trivfs_S_fsys_getroot |
271 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, mach_port_t dotdot_node, idarray_t gen_uids, mach_msg_type_number_t gen_uidsCnt, idarray_t gen_gids, mach_msg_type_number_t gen_gidsCnt, int flags, retry_type *do_retry, string_t retry_name, mach_port_t *file, mach_msg_type_name_t *filePoly); |
272 | |
273 | boolean_t msgh_simple = msgh_simple; |
274 | unsigned int msgh_size; |
275 | unsigned int msgh_size_delta; |
276 | |
277 | const mach_msg_type_t dotdot_nodeCheck = { |
278 | /* msgt_name = */ 17, |
279 | /* msgt_size = */ 32, |
280 | /* msgt_number = */ 1, |
281 | /* msgt_inline = */ TRUE((boolean_t) 1), |
282 | /* msgt_longform = */ FALSE((boolean_t) 0), |
283 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
284 | /* msgt_unused = */ 0 |
285 | }; |
286 | |
287 | const mach_msg_type_t flagsCheck = { |
288 | /* msgt_name = */ 2, |
289 | /* msgt_size = */ 32, |
290 | /* msgt_number = */ 1, |
291 | /* msgt_inline = */ TRUE((boolean_t) 1), |
292 | /* msgt_longform = */ FALSE((boolean_t) 0), |
293 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
294 | /* msgt_unused = */ 0 |
295 | }; |
296 | |
297 | const mach_msg_type_t do_retryType = { |
298 | /* msgt_name = */ 2, |
299 | /* msgt_size = */ 32, |
300 | /* msgt_number = */ 1, |
301 | /* msgt_inline = */ TRUE((boolean_t) 1), |
302 | /* msgt_longform = */ FALSE((boolean_t) 0), |
303 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
304 | /* msgt_unused = */ 0 |
305 | }; |
306 | |
307 | const mach_msg_type_t retry_nameType = { |
308 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
309 | /* msgt_size = */ 8, |
310 | /* msgt_number = */ 1024, |
311 | /* msgt_inline = */ TRUE((boolean_t) 1), |
312 | /* msgt_longform = */ FALSE((boolean_t) 0), |
313 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
314 | /* msgt_unused = */ 0 |
315 | }; |
316 | |
317 | const mach_msg_type_t fileType = { |
318 | /* msgt_name = */ -1, |
319 | /* msgt_size = */ 32, |
320 | /* msgt_number = */ 1, |
321 | /* msgt_inline = */ TRUE((boolean_t) 1), |
322 | /* msgt_longform = */ FALSE((boolean_t) 0), |
323 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
324 | /* msgt_unused = */ 0 |
325 | }; |
326 | |
327 | trivfs_control_t fsys; |
328 | mach_port_t reply; |
329 | mach_msg_type_name_t filePoly; |
330 | |
331 | #if TypeCheck1 |
332 | msgh_size = In0P->Head.msgh_size; |
333 | if (mig_unlikely ((msgh_size < 64) ||__builtin_expect (!! ((msgh_size < 64) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
334 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 64) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
335 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
336 | #endif /* TypeCheck */ |
337 | |
338 | #if TypeCheck1 |
339 | if (BAD_TYPECHECK(&In0P->dotdot_nodeType, &dotdot_nodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->dotdot_nodeType); _c.t = *(&dotdot_nodeCheck);_t.w != _c.w; })), 0)) |
340 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
341 | #endif /* TypeCheck */ |
342 | |
343 | #if TypeCheck1 |
344 | if (mig_unlikely ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
345 | (In0P->gen_uidsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
346 | (In0P->gen_uidsType.msgtl_size != 32))__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0)) |
347 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
348 | #endif /* TypeCheck */ |
349 | |
350 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
351 | #if TypeCheck1 |
352 | if (mig_unlikely (msgh_size < 64 + msgh_size_delta)__builtin_expect (!! (msgh_size < 64 + msgh_size_delta), 0 )) |
353 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
354 | msgh_size -= msgh_size_delta; |
355 | #endif /* TypeCheck */ |
356 | |
357 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
358 | |
359 | #if TypeCheck1 |
360 | if (mig_unlikely ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
361 | (In1P->gen_gidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
362 | (In1P->gen_gidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0)) |
363 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
364 | #endif /* TypeCheck */ |
365 | |
366 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
367 | #if TypeCheck1 |
368 | if (mig_unlikely (msgh_size != 64 + msgh_size_delta)__builtin_expect (!! (msgh_size != 64 + msgh_size_delta), 0)) |
369 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
370 | #endif /* TypeCheck */ |
371 | |
372 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
373 | |
374 | #if TypeCheck1 |
375 | if (BAD_TYPECHECK(&In2P->flagsType, &flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In2P->flagsType); _c.t = *(& flagsCheck);_t.w != _c.w; })), 0)) |
376 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
377 | #endif /* TypeCheck */ |
378 | |
379 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
380 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
381 | else |
382 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
383 | |
384 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
385 | |
386 | OutP->RetCode = trivfs_S_fsys_getroot(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->dotdot_node, (In0P->gen_uidsType.msgtl_header.msgt_inline) ? In0P->gen_uids : *((uid_t **)In0P->gen_uids), In0P->gen_uidsType.msgtl_number, (In1P->gen_gidsType.msgtl_header.msgt_inline) ? In1P->gen_gids : *((uid_t **)In1P->gen_gids), In1P->gen_gidsType.msgtl_number, In2P->flags, &OutP->do_retry, OutP->retry_name, &OutP->file, &filePoly); |
387 | if (OutP->RetCode == KERN_SUCCESS0) |
388 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
389 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
390 | if (OutP->RetCode == KERN_SUCCESS0) |
391 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
392 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
393 | trivfs_end_using_control(fsys); |
394 | if (OutP->RetCode != KERN_SUCCESS0) |
395 | return; |
396 | |
397 | msgh_simple = TRUE((boolean_t) 1); |
398 | OutP->Head.msgh_size = 1076; |
399 | |
400 | OutP->do_retryType = do_retryType; |
401 | |
402 | OutP->retry_nameType = retry_nameType; |
403 | |
404 | OutP->fileType = fileType; |
405 | |
406 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
407 | msgh_simple = FALSE((boolean_t) 0); |
408 | |
409 | OutP->fileType.msgt_name = filePoly; |
410 | |
411 | if (!msgh_simple) |
412 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
413 | } |
414 | |
415 | /* Default implementation of trivfs_S_fsys_getroot */ |
416 | #ifdef MIG_EOPNOTSUPP |
417 | kern_return_t __attribute__ ((weak)) |
418 | trivfs_S_fsys_getroot |
419 | ( |
420 | trivfs_control_t fsys, |
421 | mach_port_t reply, |
422 | mach_msg_type_name_t replyPoly, |
423 | mach_port_t dotdot_node, |
424 | idarray_t gen_uids, |
425 | mach_msg_type_number_t gen_uidsCnt, |
426 | idarray_t gen_gids, |
427 | mach_msg_type_number_t gen_gidsCnt, |
428 | int flags, |
429 | retry_type *do_retry, |
430 | string_t retry_name, |
431 | mach_port_t *file, |
432 | mach_msg_type_name_t *filePoly |
433 | ) { return MIG_EOPNOTSUPP; } |
434 | #endif /* MIG_EOPNOTSUPP */ |
435 | |
436 | /* Routine fsys_getfile */ |
437 | mig_internalstatic void _Xfsys_getfile |
438 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
439 | { |
440 | typedef struct { |
441 | mach_msg_header_t Head; |
442 | mach_msg_type_long_t gen_uidsType; |
443 | uid_t gen_uids[512]; |
444 | mach_msg_type_long_t gen_gidsType; |
445 | uid_t gen_gids[512]; |
446 | mach_msg_type_long_t filehandleType; |
447 | char filehandle[2048]; |
448 | } Request; |
449 | |
450 | typedef struct { |
451 | mach_msg_header_t Head; |
452 | mach_msg_type_t RetCodeType; |
453 | kern_return_t RetCode; |
454 | mach_msg_type_t fileType; |
455 | mach_port_t file; |
456 | } Reply; |
457 | |
458 | Request *In0P = (Request *) InHeadP; |
459 | Request *In1P; |
460 | Request *In2P; |
461 | Reply *OutP = (Reply *) OutHeadP; |
462 | mig_external kern_return_t trivfs_S_fsys_getfile |
463 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, idarray_t gen_uids, mach_msg_type_number_t gen_uidsCnt, idarray_t gen_gids, mach_msg_type_number_t gen_gidsCnt, data_t filehandle, mach_msg_type_number_t filehandleCnt, mach_port_t *file, mach_msg_type_name_t *filePoly); |
464 | |
465 | boolean_t msgh_simple = msgh_simple; |
466 | unsigned int msgh_size; |
467 | unsigned int msgh_size_delta; |
468 | |
469 | const mach_msg_type_t fileType = { |
470 | /* msgt_name = */ -1, |
471 | /* msgt_size = */ 32, |
472 | /* msgt_number = */ 1, |
473 | /* msgt_inline = */ TRUE((boolean_t) 1), |
474 | /* msgt_longform = */ FALSE((boolean_t) 0), |
475 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
476 | /* msgt_unused = */ 0 |
477 | }; |
478 | |
479 | trivfs_control_t fsys; |
480 | mach_port_t reply; |
481 | mach_msg_type_name_t filePoly; |
482 | |
483 | #if TypeCheck1 |
484 | msgh_size = In0P->Head.msgh_size; |
485 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
486 | if (mig_unlikely ((msgh_size < 60))__builtin_expect (!! ((msgh_size < 60)), 0)) |
487 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
488 | #endif /* TypeCheck */ |
489 | |
490 | #if TypeCheck1 |
491 | if (mig_unlikely ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
492 | (In0P->gen_uidsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
493 | (In0P->gen_uidsType.msgtl_size != 32))__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0)) |
494 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
495 | #endif /* TypeCheck */ |
496 | |
497 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
498 | #if TypeCheck1 |
499 | if (mig_unlikely (msgh_size < 60 + msgh_size_delta)__builtin_expect (!! (msgh_size < 60 + msgh_size_delta), 0 )) |
500 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
501 | msgh_size -= msgh_size_delta; |
502 | #endif /* TypeCheck */ |
503 | |
504 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
505 | |
506 | #if TypeCheck1 |
507 | if (mig_unlikely ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
508 | (In1P->gen_gidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
509 | (In1P->gen_gidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0)) |
510 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
511 | #endif /* TypeCheck */ |
512 | |
513 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
514 | #if TypeCheck1 |
515 | if (mig_unlikely (msgh_size < 60 + msgh_size_delta)__builtin_expect (!! (msgh_size < 60 + msgh_size_delta), 0 )) |
516 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
517 | msgh_size -= msgh_size_delta; |
518 | #endif /* TypeCheck */ |
519 | |
520 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
521 | |
522 | #if TypeCheck1 |
523 | if (mig_unlikely ((In2P->filehandleType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0) |
524 | (In2P->filehandleType.msgtl_name != 8) ||__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0) |
525 | (In2P->filehandleType.msgtl_size != 8))__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0)) |
526 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
527 | #endif /* TypeCheck */ |
528 | |
529 | #if TypeCheck1 |
530 | if (mig_unlikely (msgh_size != 60 + ((In2P->filehandleType.msgtl_header.msgt_inline) ? (In2P->filehandleType.msgtl_number + 3) & ~3 : sizeof(char *)))__builtin_expect (!! (msgh_size != 60 + ((In2P->filehandleType .msgtl_header.msgt_inline) ? (In2P->filehandleType.msgtl_number + 3) & ~3 : sizeof(char *))), 0)) |
531 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
532 | #endif /* TypeCheck */ |
533 | |
534 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
535 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
536 | else |
537 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
538 | |
539 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
540 | |
541 | OutP->RetCode = trivfs_S_fsys_getfile(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), (In0P->gen_uidsType.msgtl_header.msgt_inline) ? In0P->gen_uids : *((uid_t **)In0P->gen_uids), In0P->gen_uidsType.msgtl_number, (In1P->gen_gidsType.msgtl_header.msgt_inline) ? In1P->gen_gids : *((uid_t **)In1P->gen_gids), In1P->gen_gidsType.msgtl_number, (In2P->filehandleType.msgtl_header.msgt_inline) ? In2P->filehandle : *((char **)In2P->filehandle), In2P->filehandleType.msgtl_number, &OutP->file, &filePoly); |
542 | if (OutP->RetCode == KERN_SUCCESS0) |
543 | if (!In2P->filehandleType.msgtl_header.msgt_inline) |
544 | __mig_deallocate(* (vm_offset_t *) In2P->filehandle, In2P->filehandleType.msgtl_number); |
545 | if (OutP->RetCode == KERN_SUCCESS0) |
546 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
547 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
548 | if (OutP->RetCode == KERN_SUCCESS0) |
549 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
550 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
551 | trivfs_end_using_control(fsys); |
552 | if (OutP->RetCode != KERN_SUCCESS0) |
553 | return; |
554 | |
555 | msgh_simple = TRUE((boolean_t) 1); |
556 | OutP->Head.msgh_size = 40; |
557 | |
558 | OutP->fileType = fileType; |
559 | |
560 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
561 | msgh_simple = FALSE((boolean_t) 0); |
562 | |
563 | OutP->fileType.msgt_name = filePoly; |
564 | |
565 | if (!msgh_simple) |
566 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
567 | } |
568 | |
569 | /* Default implementation of trivfs_S_fsys_getfile */ |
570 | #ifdef MIG_EOPNOTSUPP |
571 | kern_return_t __attribute__ ((weak)) |
572 | trivfs_S_fsys_getfile |
573 | ( |
574 | trivfs_control_t fsys, |
575 | mach_port_t reply, |
576 | mach_msg_type_name_t replyPoly, |
577 | idarray_t gen_uids, |
578 | mach_msg_type_number_t gen_uidsCnt, |
579 | idarray_t gen_gids, |
580 | mach_msg_type_number_t gen_gidsCnt, |
581 | data_t filehandle, |
582 | mach_msg_type_number_t filehandleCnt, |
583 | mach_port_t *file, |
584 | mach_msg_type_name_t *filePoly |
585 | ) { return MIG_EOPNOTSUPP; } |
586 | #endif /* MIG_EOPNOTSUPP */ |
587 | |
588 | /* Routine fsys_syncfs */ |
589 | mig_internalstatic void _Xfsys_syncfs |
590 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
591 | { |
592 | typedef struct { |
593 | mach_msg_header_t Head; |
594 | mach_msg_type_t waitType; |
595 | int wait; |
596 | mach_msg_type_t do_childrenType; |
597 | int do_children; |
598 | } Request; |
599 | |
600 | typedef struct { |
601 | mach_msg_header_t Head; |
602 | mach_msg_type_t RetCodeType; |
603 | kern_return_t RetCode; |
604 | } Reply; |
605 | |
606 | Request *In0P = (Request *) InHeadP; |
607 | Reply *OutP = (Reply *) OutHeadP; |
608 | mig_external kern_return_t trivfs_S_fsys_syncfs |
609 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, int wait, int do_children); |
610 | |
611 | const mach_msg_type_t waitCheck = { |
612 | /* msgt_name = */ 2, |
613 | /* msgt_size = */ 32, |
614 | /* msgt_number = */ 1, |
615 | /* msgt_inline = */ TRUE((boolean_t) 1), |
616 | /* msgt_longform = */ FALSE((boolean_t) 0), |
617 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
618 | /* msgt_unused = */ 0 |
619 | }; |
620 | |
621 | const mach_msg_type_t do_childrenCheck = { |
622 | /* msgt_name = */ 2, |
623 | /* msgt_size = */ 32, |
624 | /* msgt_number = */ 1, |
625 | /* msgt_inline = */ TRUE((boolean_t) 1), |
626 | /* msgt_longform = */ FALSE((boolean_t) 0), |
627 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
628 | /* msgt_unused = */ 0 |
629 | }; |
630 | |
631 | trivfs_control_t fsys; |
632 | mach_port_t reply; |
633 | |
634 | #if TypeCheck1 |
635 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
636 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
637 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
638 | #endif /* TypeCheck */ |
639 | |
640 | #if TypeCheck1 |
641 | if (BAD_TYPECHECK(&In0P->waitType, &waitCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->waitType); _c.t = *(& waitCheck);_t.w != _c.w; })), 0)) |
642 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
643 | #endif /* TypeCheck */ |
644 | |
645 | #if TypeCheck1 |
646 | if (BAD_TYPECHECK(&In0P->do_childrenType, &do_childrenCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->do_childrenType); _c.t = *(&do_childrenCheck);_t.w != _c.w; })), 0)) |
647 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
648 | #endif /* TypeCheck */ |
649 | |
650 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
651 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
652 | else |
653 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
654 | |
655 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
656 | |
657 | OutP->RetCode = trivfs_S_fsys_syncfs(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->wait, In0P->do_children); |
658 | trivfs_end_using_control(fsys); |
659 | } |
660 | |
661 | /* Default implementation of trivfs_S_fsys_syncfs */ |
662 | #ifdef MIG_EOPNOTSUPP |
663 | kern_return_t __attribute__ ((weak)) |
664 | trivfs_S_fsys_syncfs |
665 | ( |
666 | trivfs_control_t fsys, |
667 | mach_port_t reply, |
668 | mach_msg_type_name_t replyPoly, |
669 | int wait, |
670 | int do_children |
671 | ) { return MIG_EOPNOTSUPP; } |
672 | #endif /* MIG_EOPNOTSUPP */ |
673 | |
674 | /* Routine fsys_set_options */ |
675 | mig_internalstatic void _Xfsys_set_options |
676 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
677 | { |
678 | typedef struct { |
679 | mach_msg_header_t Head; |
680 | mach_msg_type_long_t optionsType; |
681 | char options[2048]; |
682 | mach_msg_type_t do_childrenType; |
683 | int do_children; |
684 | } Request; |
685 | |
686 | typedef struct { |
687 | mach_msg_header_t Head; |
688 | mach_msg_type_t RetCodeType; |
689 | kern_return_t RetCode; |
690 | } Reply; |
691 | |
692 | Request *In0P = (Request *) InHeadP; |
693 | Request *In1P; |
694 | Reply *OutP = (Reply *) OutHeadP; |
695 | mig_external kern_return_t trivfs_S_fsys_set_options |
696 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, data_t options, mach_msg_type_number_t optionsCnt, int do_children); |
697 | |
698 | #if TypeCheck1 |
699 | boolean_t msgh_simple = msgh_simple; |
700 | #endif /* TypeCheck */ |
701 | |
702 | unsigned int msgh_size; |
703 | unsigned int msgh_size_delta; |
704 | |
705 | const mach_msg_type_t do_childrenCheck = { |
706 | /* msgt_name = */ 2, |
707 | /* msgt_size = */ 32, |
708 | /* msgt_number = */ 1, |
709 | /* msgt_inline = */ TRUE((boolean_t) 1), |
710 | /* msgt_longform = */ FALSE((boolean_t) 0), |
711 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
712 | /* msgt_unused = */ 0 |
713 | }; |
714 | |
715 | trivfs_control_t fsys; |
716 | mach_port_t reply; |
717 | |
718 | #if TypeCheck1 |
719 | msgh_size = In0P->Head.msgh_size; |
720 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
721 | if (mig_unlikely ((msgh_size < 44))__builtin_expect (!! ((msgh_size < 44)), 0)) |
722 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
723 | #endif /* TypeCheck */ |
724 | |
725 | #if TypeCheck1 |
726 | if (mig_unlikely ((In0P->optionsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0) |
727 | (In0P->optionsType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0) |
728 | (In0P->optionsType.msgtl_size != 8))__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0)) |
729 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
730 | #endif /* TypeCheck */ |
731 | |
732 | msgh_size_delta = (In0P->optionsType.msgtl_header.msgt_inline) ? (In0P->optionsType.msgtl_number + 3) & ~3 : sizeof(char *); |
733 | #if TypeCheck1 |
734 | if (mig_unlikely (msgh_size != 44 + msgh_size_delta)__builtin_expect (!! (msgh_size != 44 + msgh_size_delta), 0)) |
735 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
736 | #endif /* TypeCheck */ |
737 | |
738 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
739 | |
740 | #if TypeCheck1 |
741 | if (BAD_TYPECHECK(&In1P->do_childrenType, &do_childrenCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In1P->do_childrenType); _c.t = *(&do_childrenCheck);_t.w != _c.w; })), 0)) |
742 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
743 | #endif /* TypeCheck */ |
744 | |
745 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
746 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
747 | else |
748 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
749 | |
750 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
751 | |
752 | OutP->RetCode = trivfs_S_fsys_set_options(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), (In0P->optionsType.msgtl_header.msgt_inline) ? In0P->options : *((char **)In0P->options), In0P->optionsType.msgtl_number, In1P->do_children); |
753 | if (OutP->RetCode == KERN_SUCCESS0) |
754 | if (!In0P->optionsType.msgtl_header.msgt_inline) |
755 | __mig_deallocate(* (vm_offset_t *) In0P->options, In0P->optionsType.msgtl_number); |
756 | trivfs_end_using_control(fsys); |
757 | } |
758 | |
759 | /* Default implementation of trivfs_S_fsys_set_options */ |
760 | #ifdef MIG_EOPNOTSUPP |
761 | kern_return_t __attribute__ ((weak)) |
762 | trivfs_S_fsys_set_options |
763 | ( |
764 | trivfs_control_t fsys, |
765 | mach_port_t reply, |
766 | mach_msg_type_name_t replyPoly, |
767 | data_t options, |
768 | mach_msg_type_number_t optionsCnt, |
769 | int do_children |
770 | ) { return MIG_EOPNOTSUPP; } |
771 | #endif /* MIG_EOPNOTSUPP */ |
772 | |
773 | /* Routine fsys_getpriv */ |
774 | mig_internalstatic void _Xfsys_getpriv |
775 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
776 | { |
777 | typedef struct { |
778 | mach_msg_header_t Head; |
779 | } Request; |
780 | |
781 | typedef struct { |
782 | mach_msg_header_t Head; |
783 | mach_msg_type_t RetCodeType; |
784 | kern_return_t RetCode; |
785 | mach_msg_type_t host_privType; |
786 | mach_port_t host_priv; |
787 | mach_msg_type_t device_masterType; |
788 | mach_port_t device_master; |
789 | mach_msg_type_t fstaskType; |
790 | mach_port_t fstask; |
791 | } Reply; |
792 | |
793 | Request *In0P = (Request *) InHeadP; |
794 | Reply *OutP = (Reply *) OutHeadP; |
795 | mig_external kern_return_t trivfs_S_fsys_getpriv |
796 | (trivfs_control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, mach_port_t *host_priv, mach_msg_type_name_t *host_privPoly, mach_port_t *device_master, mach_msg_type_name_t *device_masterPoly, mach_port_t *fstask, mach_msg_type_name_t *fstaskPoly); |
797 | |
798 | boolean_t msgh_simple = msgh_simple; |
Assigned value is garbage or undefined | |
799 | const mach_msg_type_t host_privType = { |
800 | /* msgt_name = */ -1, |
801 | /* msgt_size = */ 32, |
802 | /* msgt_number = */ 1, |
803 | /* msgt_inline = */ TRUE((boolean_t) 1), |
804 | /* msgt_longform = */ FALSE((boolean_t) 0), |
805 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
806 | /* msgt_unused = */ 0 |
807 | }; |
808 | |
809 | const mach_msg_type_t device_masterType = { |
810 | /* msgt_name = */ -1, |
811 | /* msgt_size = */ 32, |
812 | /* msgt_number = */ 1, |
813 | /* msgt_inline = */ TRUE((boolean_t) 1), |
814 | /* msgt_longform = */ FALSE((boolean_t) 0), |
815 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
816 | /* msgt_unused = */ 0 |
817 | }; |
818 | |
819 | const mach_msg_type_t fstaskType = { |
820 | /* msgt_name = */ -1, |
821 | /* msgt_size = */ 32, |
822 | /* msgt_number = */ 1, |
823 | /* msgt_inline = */ TRUE((boolean_t) 1), |
824 | /* msgt_longform = */ FALSE((boolean_t) 0), |
825 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
826 | /* msgt_unused = */ 0 |
827 | }; |
828 | |
829 | trivfs_control_t fsys; |
830 | mach_port_t reply; |
831 | mach_msg_type_name_t host_privPoly; |
832 | mach_msg_type_name_t device_masterPoly; |
833 | mach_msg_type_name_t fstaskPoly; |
834 | |
835 | #if TypeCheck1 |
836 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
837 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
838 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
839 | #endif /* TypeCheck */ |
840 | |
841 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
842 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
843 | else |
844 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
845 | |
846 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
847 | |
848 | OutP->RetCode = trivfs_S_fsys_getpriv(fsys, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), &OutP->host_priv, &host_privPoly, &OutP->device_master, &device_masterPoly, &OutP->fstask, &fstaskPoly); |
849 | trivfs_end_using_control(fsys); |
850 | if (OutP->RetCode != KERN_SUCCESS0) |
851 | return; |
852 | |
853 | msgh_simple = TRUE((boolean_t) 1); |
854 | OutP->Head.msgh_size = 56; |
855 | |
856 | OutP->host_privType = host_privType; |
857 | |
858 | if (MACH_MSG_TYPE_PORT_ANY(host_privPoly)(((host_privPoly) >= 16) && ((host_privPoly) <= 21))) |
859 | msgh_simple = FALSE((boolean_t) 0); |
860 | |
861 | OutP->host_privType.msgt_name = host_privPoly; |
862 | |
863 | OutP->device_masterType = device_masterType; |
864 | |
865 | if (MACH_MSG_TYPE_PORT_ANY(device_masterPoly)(((device_masterPoly) >= 16) && ((device_masterPoly ) <= 21))) |
866 | msgh_simple = FALSE((boolean_t) 0); |
867 | |
868 | OutP->device_masterType.msgt_name = device_masterPoly; |
869 | |
870 | OutP->fstaskType = fstaskType; |
871 | |
872 | if (MACH_MSG_TYPE_PORT_ANY(fstaskPoly)(((fstaskPoly) >= 16) && ((fstaskPoly) <= 21))) |
873 | msgh_simple = FALSE((boolean_t) 0); |
874 | |
875 | OutP->fstaskType.msgt_name = fstaskPoly; |
876 | |
877 | if (!msgh_simple) |
878 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
879 | } |
880 | |
881 | /* Default implementation of trivfs_S_fsys_getpriv */ |
882 | #ifdef MIG_EOPNOTSUPP |
883 | kern_return_t __attribute__ ((weak)) |
884 | trivfs_S_fsys_getpriv |
885 | ( |
886 | trivfs_control_t fsys, |
887 | mach_port_t reply, |
888 | mach_msg_type_name_t replyPoly, |
889 | mach_port_t *host_priv, |
890 | mach_msg_type_name_t *host_privPoly, |
891 | mach_port_t *device_master, |
892 | mach_msg_type_name_t *device_masterPoly, |
893 | mach_port_t *fstask, |
894 | mach_msg_type_name_t *fstaskPoly |
895 | ) { return MIG_EOPNOTSUPP; } |
896 | #endif /* MIG_EOPNOTSUPP */ |
897 | |
898 | /* Routine fsys_init */ |
899 | mig_internalstatic void _Xfsys_init |
900 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
901 | { |
902 | typedef struct { |
903 | mach_msg_header_t Head; |
904 | mach_msg_type_t proc_serverType; |
905 | mach_port_t proc_server; |
906 | mach_msg_type_t auth_handleType; |
907 | auth_t auth_handle; |
908 | } Request; |
909 | |
910 | typedef struct { |
911 | mach_msg_header_t Head; |
912 | mach_msg_type_t RetCodeType; |
913 | kern_return_t RetCode; |
914 | } Reply; |
915 | |
916 | Request *In0P = (Request *) InHeadP; |
917 | Reply *OutP = (Reply *) OutHeadP; |
918 | mig_external kern_return_t trivfs_S_fsys_init |
919 | (trivfs_control_t fsys, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t proc_server, auth_t auth_handle); |
920 | |
921 | const mach_msg_type_t proc_serverCheck = { |
922 | /* msgt_name = */ 17, |
923 | /* msgt_size = */ 32, |
924 | /* msgt_number = */ 1, |
925 | /* msgt_inline = */ TRUE((boolean_t) 1), |
926 | /* msgt_longform = */ FALSE((boolean_t) 0), |
927 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
928 | /* msgt_unused = */ 0 |
929 | }; |
930 | |
931 | const mach_msg_type_t auth_handleCheck = { |
932 | /* msgt_name = */ 17, |
933 | /* msgt_size = */ 32, |
934 | /* msgt_number = */ 1, |
935 | /* msgt_inline = */ TRUE((boolean_t) 1), |
936 | /* msgt_longform = */ FALSE((boolean_t) 0), |
937 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
938 | /* msgt_unused = */ 0 |
939 | }; |
940 | |
941 | trivfs_control_t fsys; |
942 | mach_port_t reply_port; |
943 | auth_t auth_handle; |
944 | |
945 | #if TypeCheck1 |
946 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
947 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
948 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
949 | #endif /* TypeCheck */ |
950 | |
951 | #if TypeCheck1 |
952 | if (BAD_TYPECHECK(&In0P->proc_serverType, &proc_serverCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->proc_serverType); _c.t = *(&proc_serverCheck);_t.w != _c.w; })), 0)) |
953 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
954 | #endif /* TypeCheck */ |
955 | |
956 | #if TypeCheck1 |
957 | if (BAD_TYPECHECK(&In0P->auth_handleType, &auth_handleCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->auth_handleType); _c.t = *(&auth_handleCheck);_t.w != _c.w; })), 0)) |
958 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
959 | #endif /* TypeCheck */ |
960 | |
961 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
962 | fsys = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
963 | else |
964 | fsys = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
965 | |
966 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
967 | |
968 | auth_handle = In0P->auth_handle; |
969 | |
970 | OutP->RetCode = trivfs_S_fsys_init(fsys, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->proc_server, auth_handle); |
971 | trivfs_end_using_control(fsys); |
972 | } |
973 | |
974 | /* Default implementation of trivfs_S_fsys_init */ |
975 | #ifdef MIG_EOPNOTSUPP |
976 | kern_return_t __attribute__ ((weak)) |
977 | trivfs_S_fsys_init |
978 | ( |
979 | trivfs_control_t fsys, |
980 | mach_port_t reply_port, |
981 | mach_msg_type_name_t reply_portPoly, |
982 | mach_port_t proc_server, |
983 | auth_t auth_handle |
984 | ) { return MIG_EOPNOTSUPP; } |
985 | #endif /* MIG_EOPNOTSUPP */ |
986 | |
987 | /* Routine fsys_forward */ |
988 | mig_internalstatic void _Xfsys_forward |
989 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
990 | { |
991 | typedef struct { |
992 | mach_msg_header_t Head; |
993 | mach_msg_type_t requestorType; |
994 | mach_port_t requestor; |
995 | mach_msg_type_long_t argvType; |
996 | char argv[2048]; |
997 | } Request; |
998 | |
999 | typedef struct { |
1000 | mach_msg_header_t Head; |
1001 | mach_msg_type_t RetCodeType; |
1002 | kern_return_t RetCode; |
1003 | } Reply; |
1004 | |
1005 | Request *In0P = (Request *) InHeadP; |
1006 | Reply *OutP = (Reply *) OutHeadP; |
1007 | mig_external kern_return_t trivfs_S_fsys_forward |
1008 | (mach_port_t server, mach_port_t reply, mach_msg_type_name_t replyPoly, mach_port_t requestor, data_t argv, mach_msg_type_number_t argvCnt); |
1009 | |
1010 | unsigned int msgh_size; |
1011 | |
1012 | const mach_msg_type_t requestorCheck = { |
1013 | /* msgt_name = */ 17, |
1014 | /* msgt_size = */ 32, |
1015 | /* msgt_number = */ 1, |
1016 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1017 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1018 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1019 | /* msgt_unused = */ 0 |
1020 | }; |
1021 | |
1022 | mach_port_t server; |
1023 | mach_port_t reply; |
1024 | |
1025 | #if TypeCheck1 |
1026 | msgh_size = In0P->Head.msgh_size; |
1027 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
1028 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
1029 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1030 | #endif /* TypeCheck */ |
1031 | |
1032 | #if TypeCheck1 |
1033 | if (BAD_TYPECHECK(&In0P->requestorType, &requestorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->requestorType); _c.t = * (&requestorCheck);_t.w != _c.w; })), 0)) |
1034 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1035 | #endif /* TypeCheck */ |
1036 | |
1037 | #if TypeCheck1 |
1038 | if (mig_unlikely ((In0P->argvType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0) |
1039 | (In0P->argvType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0) |
1040 | (In0P->argvType.msgtl_size != 8))__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0)) |
1041 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1042 | #endif /* TypeCheck */ |
1043 | |
1044 | #if TypeCheck1 |
1045 | if (mig_unlikely (msgh_size != 44 + ((In0P->argvType.msgtl_header.msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->argvType.msgtl_header .msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *))), 0)) |
1046 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1047 | #endif /* TypeCheck */ |
1048 | |
1049 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1050 | server = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1051 | else |
1052 | server = In0P->Head.msgh_request_portmsgh_local_port; |
1053 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
1054 | |
1055 | OutP->RetCode = trivfs_S_fsys_forward(server, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->requestor, (In0P->argvType.msgtl_header.msgt_inline) ? In0P->argv : *((char **)In0P->argv), In0P->argvType.msgtl_number); |
1056 | if (OutP->RetCode == KERN_SUCCESS0) |
1057 | if (!In0P->argvType.msgtl_header.msgt_inline) |
1058 | __mig_deallocate(* (vm_offset_t *) In0P->argv, In0P->argvType.msgtl_number); |
1059 | } |
1060 | |
1061 | /* Default implementation of trivfs_S_fsys_forward */ |
1062 | #ifdef MIG_EOPNOTSUPP |
1063 | kern_return_t __attribute__ ((weak)) |
1064 | trivfs_S_fsys_forward |
1065 | ( |
1066 | mach_port_t server, |
1067 | mach_port_t reply, |
1068 | mach_msg_type_name_t replyPoly, |
1069 | mach_port_t requestor, |
1070 | data_t argv, |
1071 | mach_msg_type_number_t argvCnt |
1072 | ) { return MIG_EOPNOTSUPP; } |
1073 | #endif /* MIG_EOPNOTSUPP */ |
1074 | |
1075 | /* Routine fsys_get_options */ |
1076 | mig_internalstatic void _Xfsys_get_options |
1077 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1078 | { |
1079 | typedef struct { |
1080 | mach_msg_header_t Head; |
1081 | } Request; |
1082 | |
1083 | typedef struct { |
1084 | mach_msg_header_t Head; |
1085 | mach_msg_type_t RetCodeType; |
1086 | kern_return_t RetCode; |
1087 | mach_msg_type_long_t optionsType; |
1088 | char options[2048]; |
1089 | } Reply; |
1090 | |
1091 | Request *In0P = (Request *) InHeadP; |
1092 | Reply *OutP = (Reply *) OutHeadP; |
1093 | mig_external kern_return_t trivfs_S_fsys_get_options |
1094 | (trivfs_control_t server, mach_port_t reply, mach_msg_type_name_t replyPoly, data_t *options, mach_msg_type_number_t *optionsCnt); |
1095 | |
1096 | boolean_t msgh_simple = msgh_simple; |
1097 | const mach_msg_type_long_t optionsType = { |
1098 | { |
1099 | /* msgt_name = */ 0, |
1100 | /* msgt_size = */ 0, |
1101 | /* msgt_number = */ 0, |
1102 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1103 | /* msgt_longform = */ TRUE((boolean_t) 1), |
1104 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1105 | /* msgt_unused = */ 0 |
1106 | }, |
1107 | /* msgtl_name = */ 8, |
1108 | /* msgtl_size = */ 8, |
1109 | /* msgtl_number = */ 2048, |
1110 | }; |
1111 | |
1112 | trivfs_control_t server; |
1113 | mach_port_t reply; |
1114 | mach_msg_type_number_t optionsCnt; |
1115 | |
1116 | char *optionsP; |
1117 | |
1118 | #if TypeCheck1 |
1119 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1120 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1121 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1122 | #endif /* TypeCheck */ |
1123 | |
1124 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1125 | server = trivfs_begin_using_control_payload(In0P->Head.msgh_protected_payload); |
1126 | else |
1127 | server = trivfs_begin_using_control(In0P->Head.msgh_request_portmsgh_local_port); |
1128 | |
1129 | reply = In0P->Head.msgh_reply_portmsgh_remote_port; |
1130 | |
1131 | optionsP = OutP->options; |
1132 | optionsCnt = 2048; |
1133 | |
1134 | OutP->RetCode = trivfs_S_fsys_get_options(server, reply, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), &optionsP, &optionsCnt); |
1135 | trivfs_end_using_control(server); |
1136 | if (OutP->RetCode != KERN_SUCCESS0) |
1137 | return; |
1138 | |
1139 | msgh_simple = TRUE((boolean_t) 1); |
1140 | |
1141 | OutP->optionsType = optionsType; |
1142 | if (optionsP != OutP->options) { |
1143 | OutP->optionsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1144 | OutP->optionsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1145 | *((char **)OutP->options) = optionsP; |
1146 | msgh_simple = FALSE((boolean_t) 0); |
1147 | } |
1148 | |
1149 | OutP->optionsType.msgtl_number = optionsCnt; |
1150 | OutP->Head.msgh_size = 44 + ((OutP->optionsType.msgtl_header.msgt_inline) ? (optionsCnt + 3) & ~3 : sizeof(char *)); |
1151 | |
1152 | if (!msgh_simple) |
1153 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1154 | } |
1155 | |
1156 | /* Default implementation of trivfs_S_fsys_get_options */ |
1157 | #ifdef MIG_EOPNOTSUPP |
1158 | kern_return_t __attribute__ ((weak)) |
1159 | trivfs_S_fsys_get_options |
1160 | ( |
1161 | trivfs_control_t server, |
1162 | mach_port_t reply, |
1163 | mach_msg_type_name_t replyPoly, |
1164 | data_t *options, |
1165 | mach_msg_type_number_t *optionsCnt |
1166 | ) { return MIG_EOPNOTSUPP; } |
1167 | #endif /* MIG_EOPNOTSUPP */ |
1168 | |
1169 | mig_routine_t trivfs_fsys_server_routines[] = { |
1170 | _Xfsys_startup, |
1171 | _Xfsys_goaway, |
1172 | _Xfsys_getroot, |
1173 | _Xfsys_getfile, |
1174 | _Xfsys_syncfs, |
1175 | _Xfsys_set_options, |
1176 | _Xfsys_getpriv, |
1177 | _Xfsys_init, |
1178 | _Xfsys_forward, |
1179 | _Xfsys_get_options, |
1180 | 0, |
1181 | 0, |
1182 | }; |
1183 | |
1184 | mig_external boolean_t trivfs_fsys_server |
1185 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1186 | { |
1187 | mach_msg_header_t *InP = InHeadP; |
1188 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
1189 | |
1190 | const mach_msg_type_t RetCodeType = { |
1191 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
1192 | /* msgt_size = */ 32, |
1193 | /* msgt_number = */ 1, |
1194 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1195 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1196 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1197 | /* msgt_unused = */ 0 |
1198 | }; |
1199 | |
1200 | mig_routine_t routine; |
1201 | |
1202 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
1203 | OutP->Head.msgh_size = sizeof *OutP; |
1204 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
1205 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
1206 | OutP->Head.msgh_seqno = 0; |
1207 | OutP->Head.msgh_id = InP->msgh_id + 100; |
1208 | |
1209 | OutP->RetCodeType = RetCodeType; |
1210 | |
1211 | if ((InP->msgh_id > 22011) || (InP->msgh_id < 22000) || |
1212 | ((routine = trivfs_fsys_server_routines[InP->msgh_id - 22000]) == 0)) { |
1213 | OutP->RetCode = MIG_BAD_ID-303; |
1214 | return FALSE((boolean_t) 0); |
1215 | } |
1216 | (*routine) (InP, &OutP->Head); |
1217 | return TRUE((boolean_t) 1); |
1218 | } |
1219 | |
1220 | mig_external mig_routine_t trivfs_fsys_server_routine |
1221 | (const mach_msg_header_t *InHeadP) |
1222 | { |
1223 | int msgh_id; |
1224 | |
1225 | msgh_id = InHeadP->msgh_id - 22000; |
1226 | |
1227 | if ((msgh_id > 11) || (msgh_id < 0)) |
1228 | return 0; |
1229 | |
1230 | return trivfs_fsys_server_routines[msgh_id]; |
1231 | } |
1232 |