File: | obj-scan-build/libdiskfs/fsysServer.c |
Location: | line 411, column 2 |
Description: | Value stored to 'msgh_simple' is never read |
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 TypeCheck1 |
23 | #define TypeCheck1 1 |
24 | #endif |
25 | |
26 | #ifndef UseExternRCSId1 |
27 | #define UseExternRCSId1 1 |
28 | #endif |
29 | |
30 | #define BAD_TYPECHECK(type, check)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check); _t.w != _c.w; }) ({\ |
31 | union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\ |
32 | _t.t = *(type); _c.t = *(check); _t.w != _c.w; }) |
33 | #define msgh_request_portmsgh_local_port msgh_local_port |
34 | #define MACH_MSGH_BITS_REQUEST(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
35 | #define msgh_reply_portmsgh_remote_port msgh_remote_port |
36 | #define MACH_MSGH_BITS_REPLY(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
37 | |
38 | #include <mach/std_types.h> |
39 | #include <mach/mach_types.h> |
40 | #include <device/device_types.h> |
41 | #include <device/net_status.h> |
42 | #include <sys/types.h> |
43 | #include <sys/stat.h> |
44 | #include <sys/statfs.h> |
45 | #include <sys/resource.h> |
46 | #include <sys/utsname.h> |
47 | #include <hurd/hurd_types.h> |
48 | #include "libdiskfs/priv.h" |
49 | |
50 | /* Routine fsys_startup */ |
51 | mig_internalstatic void _Xfsys_startup |
52 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
53 | { |
54 | typedef struct { |
55 | mach_msg_header_t Head; |
56 | mach_msg_type_t openflagsType; |
57 | int openflags; |
58 | mach_msg_type_t control_portType; |
59 | mach_port_t control_port; |
60 | } Request; |
61 | |
62 | typedef struct { |
63 | mach_msg_header_t Head; |
64 | mach_msg_type_t RetCodeType; |
65 | kern_return_t RetCode; |
66 | mach_msg_type_t realnodeType; |
67 | mach_port_t realnode; |
68 | } Reply; |
69 | |
70 | Request *In0P = (Request *) InHeadP; |
71 | Reply *OutP = (Reply *) OutHeadP; |
72 | mig_external kern_return_t diskfs_S_fsys_startup |
73 | (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); |
74 | |
75 | boolean_t msgh_simple; |
76 | const mach_msg_type_t openflagsCheck = { |
77 | /* msgt_name = */ 2, |
78 | /* msgt_size = */ 32, |
79 | /* msgt_number = */ 1, |
80 | /* msgt_inline = */ TRUE((boolean_t) 1), |
81 | /* msgt_longform = */ FALSE((boolean_t) 0), |
82 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
83 | /* msgt_unused = */ 0 |
84 | }; |
85 | |
86 | const mach_msg_type_t control_portCheck = { |
87 | /* msgt_name = */ 17, |
88 | /* msgt_size = */ 32, |
89 | /* msgt_number = */ 1, |
90 | /* msgt_inline = */ TRUE((boolean_t) 1), |
91 | /* msgt_longform = */ FALSE((boolean_t) 0), |
92 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
93 | /* msgt_unused = */ 0 |
94 | }; |
95 | |
96 | const mach_msg_type_t realnodeType = { |
97 | /* msgt_name = */ -1, |
98 | /* msgt_size = */ 32, |
99 | /* msgt_number = */ 1, |
100 | /* msgt_inline = */ TRUE((boolean_t) 1), |
101 | /* msgt_longform = */ FALSE((boolean_t) 0), |
102 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
103 | /* msgt_unused = */ 0 |
104 | }; |
105 | |
106 | mach_msg_type_name_t realnodePoly; |
107 | |
108 | #if TypeCheck1 |
109 | if ((In0P->Head.msgh_size != 40) || |
110 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
111 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
112 | #endif /* TypeCheck */ |
113 | |
114 | #if TypeCheck1 |
115 | if (BAD_TYPECHECK(&In0P->openflagsType, &openflagsCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->openflagsType); _c.t = *(&openflagsCheck ); _t.w != _c.w; })) |
116 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
117 | #endif /* TypeCheck */ |
118 | |
119 | #if TypeCheck1 |
120 | if (BAD_TYPECHECK(&In0P->control_portType, &control_portCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->control_portType); _c.t = *(&control_portCheck ); _t.w != _c.w; })) |
121 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
122 | #endif /* TypeCheck */ |
123 | |
124 | OutP->RetCode = diskfs_S_fsys_startup(In0P->Head.msgh_request_portmsgh_local_port, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->openflags, In0P->control_port, &OutP->realnode, &realnodePoly); |
125 | if (OutP->RetCode != KERN_SUCCESS0) |
126 | return; |
127 | |
128 | msgh_simple = TRUE((boolean_t) 1); |
129 | OutP->Head.msgh_size = 40; |
130 | |
131 | OutP->realnodeType = realnodeType; |
132 | |
133 | if (MACH_MSG_TYPE_PORT_ANY(realnodePoly)(((realnodePoly) >= 16) && ((realnodePoly) <= 21 ))) |
134 | msgh_simple = FALSE((boolean_t) 0); |
135 | |
136 | OutP->realnodeType.msgt_name = realnodePoly; |
137 | |
138 | if (!msgh_simple) |
139 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
140 | } |
141 | |
142 | /* Routine fsys_goaway */ |
143 | mig_internalstatic void _Xfsys_goaway |
144 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
145 | { |
146 | typedef struct { |
147 | mach_msg_header_t Head; |
148 | mach_msg_type_t flagsType; |
149 | int flags; |
150 | } Request; |
151 | |
152 | typedef struct { |
153 | mach_msg_header_t Head; |
154 | mach_msg_type_t RetCodeType; |
155 | kern_return_t RetCode; |
156 | } Reply; |
157 | |
158 | Request *In0P = (Request *) InHeadP; |
159 | Reply *OutP = (Reply *) OutHeadP; |
160 | mig_external kern_return_t diskfs_S_fsys_goaway |
161 | (control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, int flags); |
162 | |
163 | const mach_msg_type_t flagsCheck = { |
164 | /* msgt_name = */ 2, |
165 | /* msgt_size = */ 32, |
166 | /* msgt_number = */ 1, |
167 | /* msgt_inline = */ TRUE((boolean_t) 1), |
168 | /* msgt_longform = */ FALSE((boolean_t) 0), |
169 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
170 | /* msgt_unused = */ 0 |
171 | }; |
172 | |
173 | control_t fsys; |
174 | |
175 | #if TypeCheck1 |
176 | if ((In0P->Head.msgh_size != 32) || |
177 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
178 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
179 | #endif /* TypeCheck */ |
180 | |
181 | #if TypeCheck1 |
182 | if (BAD_TYPECHECK(&In0P->flagsType, &flagsCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->flagsType); _c.t = *(&flagsCheck); _t.w != _c.w; })) |
183 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
184 | #endif /* TypeCheck */ |
185 | |
186 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
187 | |
188 | OutP->RetCode = diskfs_S_fsys_goaway(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->flags); |
189 | diskfs_end_using_control_port(fsys); |
190 | } |
191 | |
192 | /* Routine fsys_getroot */ |
193 | mig_internalstatic void _Xfsys_getroot |
194 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
195 | { |
196 | typedef struct { |
197 | mach_msg_header_t Head; |
198 | mach_msg_type_t dotdot_nodeType; |
199 | mach_port_t dotdot_node; |
200 | mach_msg_type_long_t gen_uidsType; |
201 | uid_t gen_uids[512]; |
202 | mach_msg_type_long_t gen_gidsType; |
203 | uid_t gen_gids[512]; |
204 | mach_msg_type_t flagsType; |
205 | int flags; |
206 | } Request; |
207 | |
208 | typedef struct { |
209 | mach_msg_header_t Head; |
210 | mach_msg_type_t RetCodeType; |
211 | kern_return_t RetCode; |
212 | mach_msg_type_t do_retryType; |
213 | retry_type do_retry; |
214 | mach_msg_type_t retry_nameType; |
215 | string_t retry_name; |
216 | mach_msg_type_t fileType; |
217 | mach_port_t file; |
218 | } Reply; |
219 | |
220 | Request *In0P = (Request *) InHeadP; |
221 | Request *In1P; |
222 | Request *In2P; |
223 | Reply *OutP = (Reply *) OutHeadP; |
224 | mig_external kern_return_t diskfs_S_fsys_getroot |
225 | (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); |
226 | |
227 | boolean_t msgh_simple; |
228 | unsigned int msgh_size; |
229 | unsigned int msgh_size_delta; |
230 | |
231 | const mach_msg_type_t dotdot_nodeCheck = { |
232 | /* msgt_name = */ 17, |
233 | /* msgt_size = */ 32, |
234 | /* msgt_number = */ 1, |
235 | /* msgt_inline = */ TRUE((boolean_t) 1), |
236 | /* msgt_longform = */ FALSE((boolean_t) 0), |
237 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
238 | /* msgt_unused = */ 0 |
239 | }; |
240 | |
241 | const mach_msg_type_t flagsCheck = { |
242 | /* msgt_name = */ 2, |
243 | /* msgt_size = */ 32, |
244 | /* msgt_number = */ 1, |
245 | /* msgt_inline = */ TRUE((boolean_t) 1), |
246 | /* msgt_longform = */ FALSE((boolean_t) 0), |
247 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
248 | /* msgt_unused = */ 0 |
249 | }; |
250 | |
251 | const mach_msg_type_t do_retryType = { |
252 | /* msgt_name = */ 2, |
253 | /* msgt_size = */ 32, |
254 | /* msgt_number = */ 1, |
255 | /* msgt_inline = */ TRUE((boolean_t) 1), |
256 | /* msgt_longform = */ FALSE((boolean_t) 0), |
257 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
258 | /* msgt_unused = */ 0 |
259 | }; |
260 | |
261 | const mach_msg_type_t retry_nameType = { |
262 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
263 | /* msgt_size = */ 8, |
264 | /* msgt_number = */ 1024, |
265 | /* msgt_inline = */ TRUE((boolean_t) 1), |
266 | /* msgt_longform = */ FALSE((boolean_t) 0), |
267 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
268 | /* msgt_unused = */ 0 |
269 | }; |
270 | |
271 | const mach_msg_type_t fileType = { |
272 | /* msgt_name = */ -1, |
273 | /* msgt_size = */ 32, |
274 | /* msgt_number = */ 1, |
275 | /* msgt_inline = */ TRUE((boolean_t) 1), |
276 | /* msgt_longform = */ FALSE((boolean_t) 0), |
277 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
278 | /* msgt_unused = */ 0 |
279 | }; |
280 | |
281 | control_t fsys; |
282 | mach_msg_type_name_t filePoly; |
283 | |
284 | #if TypeCheck1 |
285 | msgh_size = In0P->Head.msgh_size; |
286 | if ((msgh_size < 64) || |
287 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
288 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
289 | #endif /* TypeCheck */ |
290 | |
291 | #if TypeCheck1 |
292 | if (BAD_TYPECHECK(&In0P->dotdot_nodeType, &dotdot_nodeCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->dotdot_nodeType); _c.t = *(&dotdot_nodeCheck ); _t.w != _c.w; })) |
293 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
294 | #endif /* TypeCheck */ |
295 | |
296 | #if TypeCheck1 |
297 | if ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
298 | (In0P->gen_uidsType.msgtl_name != 2) || |
299 | (In0P->gen_uidsType.msgtl_size != 32)) |
300 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
301 | #endif /* TypeCheck */ |
302 | |
303 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
304 | #if TypeCheck1 |
305 | if (msgh_size < 64 + msgh_size_delta) |
306 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
307 | msgh_size -= msgh_size_delta; |
308 | #endif /* TypeCheck */ |
309 | |
310 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
311 | |
312 | #if TypeCheck1 |
313 | if ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
314 | (In1P->gen_gidsType.msgtl_name != 2) || |
315 | (In1P->gen_gidsType.msgtl_size != 32)) |
316 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
317 | #endif /* TypeCheck */ |
318 | |
319 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
320 | #if TypeCheck1 |
321 | if (msgh_size != 64 + msgh_size_delta) |
322 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
323 | #endif /* TypeCheck */ |
324 | |
325 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
326 | |
327 | #if TypeCheck1 |
328 | if (BAD_TYPECHECK(&In2P->flagsType, &flagsCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In2P->flagsType); _c.t = *(&flagsCheck); _t.w != _c.w; })) |
329 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
330 | #endif /* TypeCheck */ |
331 | |
332 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
333 | |
334 | OutP->RetCode = diskfs_S_fsys_getroot(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, 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); |
335 | if (OutP->RetCode == KERN_SUCCESS0) |
336 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
337 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
338 | if (OutP->RetCode == KERN_SUCCESS0) |
339 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
340 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
341 | diskfs_end_using_control_port(fsys); |
342 | if (OutP->RetCode != KERN_SUCCESS0) |
343 | return; |
344 | |
345 | msgh_simple = TRUE((boolean_t) 1); |
346 | OutP->Head.msgh_size = 1076; |
347 | |
348 | OutP->do_retryType = do_retryType; |
349 | |
350 | OutP->retry_nameType = retry_nameType; |
351 | |
352 | OutP->fileType = fileType; |
353 | |
354 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
355 | msgh_simple = FALSE((boolean_t) 0); |
356 | |
357 | OutP->fileType.msgt_name = filePoly; |
358 | |
359 | if (!msgh_simple) |
360 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
361 | } |
362 | |
363 | /* Routine fsys_getfile */ |
364 | mig_internalstatic void _Xfsys_getfile |
365 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
366 | { |
367 | typedef struct { |
368 | mach_msg_header_t Head; |
369 | mach_msg_type_long_t gen_uidsType; |
370 | uid_t gen_uids[512]; |
371 | mach_msg_type_long_t gen_gidsType; |
372 | uid_t gen_gids[512]; |
373 | mach_msg_type_long_t filehandleType; |
374 | char filehandle[2048]; |
375 | } Request; |
376 | |
377 | typedef struct { |
378 | mach_msg_header_t Head; |
379 | mach_msg_type_t RetCodeType; |
380 | kern_return_t RetCode; |
381 | mach_msg_type_t fileType; |
382 | mach_port_t file; |
383 | } Reply; |
384 | |
385 | Request *In0P = (Request *) InHeadP; |
386 | Request *In1P; |
387 | Request *In2P; |
388 | Reply *OutP = (Reply *) OutHeadP; |
389 | mig_external kern_return_t diskfs_S_fsys_getfile |
390 | (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); |
391 | |
392 | boolean_t msgh_simple; |
393 | unsigned int msgh_size; |
394 | unsigned int msgh_size_delta; |
395 | |
396 | const mach_msg_type_t fileType = { |
397 | /* msgt_name = */ -1, |
398 | /* msgt_size = */ 32, |
399 | /* msgt_number = */ 1, |
400 | /* msgt_inline = */ TRUE((boolean_t) 1), |
401 | /* msgt_longform = */ FALSE((boolean_t) 0), |
402 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
403 | /* msgt_unused = */ 0 |
404 | }; |
405 | |
406 | control_t fsys; |
407 | mach_msg_type_name_t filePoly; |
408 | |
409 | #if TypeCheck1 |
410 | msgh_size = In0P->Head.msgh_size; |
411 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
Value stored to 'msgh_simple' is never read | |
412 | if ((msgh_size < 60)) |
413 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
414 | #endif /* TypeCheck */ |
415 | |
416 | #if TypeCheck1 |
417 | if ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
418 | (In0P->gen_uidsType.msgtl_name != 2) || |
419 | (In0P->gen_uidsType.msgtl_size != 32)) |
420 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
421 | #endif /* TypeCheck */ |
422 | |
423 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
424 | #if TypeCheck1 |
425 | if (msgh_size < 60 + msgh_size_delta) |
426 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
427 | msgh_size -= msgh_size_delta; |
428 | #endif /* TypeCheck */ |
429 | |
430 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
431 | |
432 | #if TypeCheck1 |
433 | if ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
434 | (In1P->gen_gidsType.msgtl_name != 2) || |
435 | (In1P->gen_gidsType.msgtl_size != 32)) |
436 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
437 | #endif /* TypeCheck */ |
438 | |
439 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
440 | #if TypeCheck1 |
441 | if (msgh_size < 60 + msgh_size_delta) |
442 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
443 | msgh_size -= msgh_size_delta; |
444 | #endif /* TypeCheck */ |
445 | |
446 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
447 | |
448 | #if TypeCheck1 |
449 | if ((In2P->filehandleType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
450 | (In2P->filehandleType.msgtl_name != 8) || |
451 | (In2P->filehandleType.msgtl_size != 8)) |
452 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
453 | #endif /* TypeCheck */ |
454 | |
455 | #if TypeCheck1 |
456 | if (msgh_size != 60 + ((In2P->filehandleType.msgtl_header.msgt_inline) ? (In2P->filehandleType.msgtl_number + 3) & ~3 : sizeof(char *))) |
457 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
458 | #endif /* TypeCheck */ |
459 | |
460 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
461 | |
462 | OutP->RetCode = diskfs_S_fsys_getfile(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, 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); |
463 | if (OutP->RetCode == KERN_SUCCESS0) |
464 | if (!In2P->filehandleType.msgtl_header.msgt_inline) |
465 | __mig_deallocate(* (vm_offset_t *) In2P->filehandle, In2P->filehandleType.msgtl_number); |
466 | if (OutP->RetCode == KERN_SUCCESS0) |
467 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
468 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
469 | if (OutP->RetCode == KERN_SUCCESS0) |
470 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
471 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
472 | diskfs_end_using_control_port(fsys); |
473 | if (OutP->RetCode != KERN_SUCCESS0) |
474 | return; |
475 | |
476 | msgh_simple = TRUE((boolean_t) 1); |
477 | OutP->Head.msgh_size = 40; |
478 | |
479 | OutP->fileType = fileType; |
480 | |
481 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
482 | msgh_simple = FALSE((boolean_t) 0); |
483 | |
484 | OutP->fileType.msgt_name = filePoly; |
485 | |
486 | if (!msgh_simple) |
487 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
488 | } |
489 | |
490 | /* Routine fsys_syncfs */ |
491 | mig_internalstatic void _Xfsys_syncfs |
492 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
493 | { |
494 | typedef struct { |
495 | mach_msg_header_t Head; |
496 | mach_msg_type_t waitType; |
497 | int wait; |
498 | mach_msg_type_t do_childrenType; |
499 | int do_children; |
500 | } Request; |
501 | |
502 | typedef struct { |
503 | mach_msg_header_t Head; |
504 | mach_msg_type_t RetCodeType; |
505 | kern_return_t RetCode; |
506 | } Reply; |
507 | |
508 | Request *In0P = (Request *) InHeadP; |
509 | Reply *OutP = (Reply *) OutHeadP; |
510 | mig_external kern_return_t diskfs_S_fsys_syncfs |
511 | (control_t fsys, mach_port_t reply, mach_msg_type_name_t replyPoly, int wait, int do_children); |
512 | |
513 | const mach_msg_type_t waitCheck = { |
514 | /* msgt_name = */ 2, |
515 | /* msgt_size = */ 32, |
516 | /* msgt_number = */ 1, |
517 | /* msgt_inline = */ TRUE((boolean_t) 1), |
518 | /* msgt_longform = */ FALSE((boolean_t) 0), |
519 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
520 | /* msgt_unused = */ 0 |
521 | }; |
522 | |
523 | const mach_msg_type_t do_childrenCheck = { |
524 | /* msgt_name = */ 2, |
525 | /* msgt_size = */ 32, |
526 | /* msgt_number = */ 1, |
527 | /* msgt_inline = */ TRUE((boolean_t) 1), |
528 | /* msgt_longform = */ FALSE((boolean_t) 0), |
529 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
530 | /* msgt_unused = */ 0 |
531 | }; |
532 | |
533 | control_t fsys; |
534 | |
535 | #if TypeCheck1 |
536 | if ((In0P->Head.msgh_size != 40) || |
537 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
538 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
539 | #endif /* TypeCheck */ |
540 | |
541 | #if TypeCheck1 |
542 | if (BAD_TYPECHECK(&In0P->waitType, &waitCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->waitType); _c.t = *(&waitCheck); _t.w != _c.w; })) |
543 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
544 | #endif /* TypeCheck */ |
545 | |
546 | #if TypeCheck1 |
547 | if (BAD_TYPECHECK(&In0P->do_childrenType, &do_childrenCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->do_childrenType); _c.t = *(&do_childrenCheck ); _t.w != _c.w; })) |
548 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
549 | #endif /* TypeCheck */ |
550 | |
551 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
552 | |
553 | OutP->RetCode = diskfs_S_fsys_syncfs(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->wait, In0P->do_children); |
554 | diskfs_end_using_control_port(fsys); |
555 | } |
556 | |
557 | /* Routine fsys_set_options */ |
558 | mig_internalstatic void _Xfsys_set_options |
559 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
560 | { |
561 | typedef struct { |
562 | mach_msg_header_t Head; |
563 | mach_msg_type_long_t optionsType; |
564 | char options[2048]; |
565 | mach_msg_type_t do_childrenType; |
566 | int do_children; |
567 | } Request; |
568 | |
569 | typedef struct { |
570 | mach_msg_header_t Head; |
571 | mach_msg_type_t RetCodeType; |
572 | kern_return_t RetCode; |
573 | } Reply; |
574 | |
575 | Request *In0P = (Request *) InHeadP; |
576 | Request *In1P; |
577 | Reply *OutP = (Reply *) OutHeadP; |
578 | mig_external kern_return_t diskfs_S_fsys_set_options |
579 | (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); |
580 | |
581 | #if TypeCheck1 |
582 | boolean_t msgh_simple; |
583 | #endif /* TypeCheck */ |
584 | |
585 | unsigned int msgh_size; |
586 | unsigned int msgh_size_delta; |
587 | |
588 | const mach_msg_type_t do_childrenCheck = { |
589 | /* msgt_name = */ 2, |
590 | /* msgt_size = */ 32, |
591 | /* msgt_number = */ 1, |
592 | /* msgt_inline = */ TRUE((boolean_t) 1), |
593 | /* msgt_longform = */ FALSE((boolean_t) 0), |
594 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
595 | /* msgt_unused = */ 0 |
596 | }; |
597 | |
598 | control_t fsys; |
599 | |
600 | #if TypeCheck1 |
601 | msgh_size = In0P->Head.msgh_size; |
602 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
603 | if ((msgh_size < 44)) |
604 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
605 | #endif /* TypeCheck */ |
606 | |
607 | #if TypeCheck1 |
608 | if ((In0P->optionsType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
609 | (In0P->optionsType.msgtl_name != 8) || |
610 | (In0P->optionsType.msgtl_size != 8)) |
611 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
612 | #endif /* TypeCheck */ |
613 | |
614 | msgh_size_delta = (In0P->optionsType.msgtl_header.msgt_inline) ? (In0P->optionsType.msgtl_number + 3) & ~3 : sizeof(char *); |
615 | #if TypeCheck1 |
616 | if (msgh_size != 44 + msgh_size_delta) |
617 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
618 | #endif /* TypeCheck */ |
619 | |
620 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
621 | |
622 | #if TypeCheck1 |
623 | if (BAD_TYPECHECK(&In1P->do_childrenType, &do_childrenCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In1P->do_childrenType); _c.t = *(&do_childrenCheck ); _t.w != _c.w; })) |
624 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
625 | #endif /* TypeCheck */ |
626 | |
627 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
628 | |
629 | OutP->RetCode = diskfs_S_fsys_set_options(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, 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); |
630 | if (OutP->RetCode == KERN_SUCCESS0) |
631 | if (!In0P->optionsType.msgtl_header.msgt_inline) |
632 | __mig_deallocate(* (vm_offset_t *) In0P->options, In0P->optionsType.msgtl_number); |
633 | diskfs_end_using_control_port(fsys); |
634 | } |
635 | |
636 | /* Routine fsys_getpriv */ |
637 | mig_internalstatic void _Xfsys_getpriv |
638 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
639 | { |
640 | typedef struct { |
641 | mach_msg_header_t Head; |
642 | } Request; |
643 | |
644 | typedef struct { |
645 | mach_msg_header_t Head; |
646 | mach_msg_type_t RetCodeType; |
647 | kern_return_t RetCode; |
648 | mach_msg_type_t host_privType; |
649 | mach_port_t host_priv; |
650 | mach_msg_type_t device_masterType; |
651 | mach_port_t device_master; |
652 | mach_msg_type_t fstaskType; |
653 | mach_port_t fstask; |
654 | } Reply; |
655 | |
656 | Request *In0P = (Request *) InHeadP; |
657 | Reply *OutP = (Reply *) OutHeadP; |
658 | mig_external kern_return_t diskfs_S_fsys_getpriv |
659 | (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); |
660 | |
661 | boolean_t msgh_simple; |
662 | const mach_msg_type_t host_privType = { |
663 | /* msgt_name = */ -1, |
664 | /* msgt_size = */ 32, |
665 | /* msgt_number = */ 1, |
666 | /* msgt_inline = */ TRUE((boolean_t) 1), |
667 | /* msgt_longform = */ FALSE((boolean_t) 0), |
668 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
669 | /* msgt_unused = */ 0 |
670 | }; |
671 | |
672 | const mach_msg_type_t device_masterType = { |
673 | /* msgt_name = */ -1, |
674 | /* msgt_size = */ 32, |
675 | /* msgt_number = */ 1, |
676 | /* msgt_inline = */ TRUE((boolean_t) 1), |
677 | /* msgt_longform = */ FALSE((boolean_t) 0), |
678 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
679 | /* msgt_unused = */ 0 |
680 | }; |
681 | |
682 | const mach_msg_type_t fstaskType = { |
683 | /* msgt_name = */ -1, |
684 | /* msgt_size = */ 32, |
685 | /* msgt_number = */ 1, |
686 | /* msgt_inline = */ TRUE((boolean_t) 1), |
687 | /* msgt_longform = */ FALSE((boolean_t) 0), |
688 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
689 | /* msgt_unused = */ 0 |
690 | }; |
691 | |
692 | control_t fsys; |
693 | mach_msg_type_name_t host_privPoly; |
694 | mach_msg_type_name_t device_masterPoly; |
695 | mach_msg_type_name_t fstaskPoly; |
696 | |
697 | #if TypeCheck1 |
698 | if ((In0P->Head.msgh_size != 24) || |
699 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
700 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
701 | #endif /* TypeCheck */ |
702 | |
703 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
704 | |
705 | OutP->RetCode = diskfs_S_fsys_getpriv(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, 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); |
706 | diskfs_end_using_control_port(fsys); |
707 | if (OutP->RetCode != KERN_SUCCESS0) |
708 | return; |
709 | |
710 | msgh_simple = TRUE((boolean_t) 1); |
711 | OutP->Head.msgh_size = 56; |
712 | |
713 | OutP->host_privType = host_privType; |
714 | |
715 | if (MACH_MSG_TYPE_PORT_ANY(host_privPoly)(((host_privPoly) >= 16) && ((host_privPoly) <= 21))) |
716 | msgh_simple = FALSE((boolean_t) 0); |
717 | |
718 | OutP->host_privType.msgt_name = host_privPoly; |
719 | |
720 | OutP->device_masterType = device_masterType; |
721 | |
722 | if (MACH_MSG_TYPE_PORT_ANY(device_masterPoly)(((device_masterPoly) >= 16) && ((device_masterPoly ) <= 21))) |
723 | msgh_simple = FALSE((boolean_t) 0); |
724 | |
725 | OutP->device_masterType.msgt_name = device_masterPoly; |
726 | |
727 | OutP->fstaskType = fstaskType; |
728 | |
729 | if (MACH_MSG_TYPE_PORT_ANY(fstaskPoly)(((fstaskPoly) >= 16) && ((fstaskPoly) <= 21))) |
730 | msgh_simple = FALSE((boolean_t) 0); |
731 | |
732 | OutP->fstaskType.msgt_name = fstaskPoly; |
733 | |
734 | if (!msgh_simple) |
735 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
736 | } |
737 | |
738 | /* Routine fsys_init */ |
739 | mig_internalstatic void _Xfsys_init |
740 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
741 | { |
742 | typedef struct { |
743 | mach_msg_header_t Head; |
744 | mach_msg_type_t proc_serverType; |
745 | mach_port_t proc_server; |
746 | mach_msg_type_t auth_handleType; |
747 | auth_t auth_handle; |
748 | } Request; |
749 | |
750 | typedef struct { |
751 | mach_msg_header_t Head; |
752 | mach_msg_type_t RetCodeType; |
753 | kern_return_t RetCode; |
754 | } Reply; |
755 | |
756 | Request *In0P = (Request *) InHeadP; |
757 | Reply *OutP = (Reply *) OutHeadP; |
758 | mig_external kern_return_t diskfs_S_fsys_init |
759 | (control_t fsys, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t proc_server, auth_t auth_handle); |
760 | |
761 | const mach_msg_type_t proc_serverCheck = { |
762 | /* msgt_name = */ 17, |
763 | /* msgt_size = */ 32, |
764 | /* msgt_number = */ 1, |
765 | /* msgt_inline = */ TRUE((boolean_t) 1), |
766 | /* msgt_longform = */ FALSE((boolean_t) 0), |
767 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
768 | /* msgt_unused = */ 0 |
769 | }; |
770 | |
771 | const mach_msg_type_t auth_handleCheck = { |
772 | /* msgt_name = */ 17, |
773 | /* msgt_size = */ 32, |
774 | /* msgt_number = */ 1, |
775 | /* msgt_inline = */ TRUE((boolean_t) 1), |
776 | /* msgt_longform = */ FALSE((boolean_t) 0), |
777 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
778 | /* msgt_unused = */ 0 |
779 | }; |
780 | |
781 | control_t fsys; |
782 | |
783 | #if TypeCheck1 |
784 | if ((In0P->Head.msgh_size != 40) || |
785 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
786 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
787 | #endif /* TypeCheck */ |
788 | |
789 | #if TypeCheck1 |
790 | if (BAD_TYPECHECK(&In0P->proc_serverType, &proc_serverCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->proc_serverType); _c.t = *(&proc_serverCheck ); _t.w != _c.w; })) |
791 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
792 | #endif /* TypeCheck */ |
793 | |
794 | #if TypeCheck1 |
795 | if (BAD_TYPECHECK(&In0P->auth_handleType, &auth_handleCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->auth_handleType); _c.t = *(&auth_handleCheck ); _t.w != _c.w; })) |
796 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
797 | #endif /* TypeCheck */ |
798 | |
799 | fsys = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
800 | |
801 | OutP->RetCode = diskfs_S_fsys_init(fsys, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->proc_server, In0P->auth_handle); |
802 | diskfs_end_using_control_port(fsys); |
803 | } |
804 | |
805 | /* Routine fsys_forward */ |
806 | mig_internalstatic void _Xfsys_forward |
807 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
808 | { |
809 | typedef struct { |
810 | mach_msg_header_t Head; |
811 | mach_msg_type_t requestorType; |
812 | mach_port_t requestor; |
813 | mach_msg_type_long_t argvType; |
814 | char argv[2048]; |
815 | } Request; |
816 | |
817 | typedef struct { |
818 | mach_msg_header_t Head; |
819 | mach_msg_type_t RetCodeType; |
820 | kern_return_t RetCode; |
821 | } Reply; |
822 | |
823 | Request *In0P = (Request *) InHeadP; |
824 | Reply *OutP = (Reply *) OutHeadP; |
825 | mig_external kern_return_t diskfs_S_fsys_forward |
826 | (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); |
827 | |
828 | unsigned int msgh_size; |
829 | |
830 | const mach_msg_type_t requestorCheck = { |
831 | /* msgt_name = */ 17, |
832 | /* msgt_size = */ 32, |
833 | /* msgt_number = */ 1, |
834 | /* msgt_inline = */ TRUE((boolean_t) 1), |
835 | /* msgt_longform = */ FALSE((boolean_t) 0), |
836 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
837 | /* msgt_unused = */ 0 |
838 | }; |
839 | |
840 | #if TypeCheck1 |
841 | msgh_size = In0P->Head.msgh_size; |
842 | if ((msgh_size < 44) || |
843 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
844 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
845 | #endif /* TypeCheck */ |
846 | |
847 | #if TypeCheck1 |
848 | if (BAD_TYPECHECK(&In0P->requestorType, &requestorCheck)({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->requestorType); _c.t = *(&requestorCheck ); _t.w != _c.w; })) |
849 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
850 | #endif /* TypeCheck */ |
851 | |
852 | #if TypeCheck1 |
853 | if ((In0P->argvType.msgtl_header.msgt_longform != TRUE((boolean_t) 1)) || |
854 | (In0P->argvType.msgtl_name != 8) || |
855 | (In0P->argvType.msgtl_size != 8)) |
856 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
857 | #endif /* TypeCheck */ |
858 | |
859 | #if TypeCheck1 |
860 | if (msgh_size != 44 + ((In0P->argvType.msgtl_header.msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *))) |
861 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
862 | #endif /* TypeCheck */ |
863 | |
864 | OutP->RetCode = diskfs_S_fsys_forward(In0P->Head.msgh_request_portmsgh_local_port, In0P->Head.msgh_reply_portmsgh_remote_port, 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); |
865 | if (OutP->RetCode == KERN_SUCCESS0) |
866 | if (!In0P->argvType.msgtl_header.msgt_inline) |
867 | __mig_deallocate(* (vm_offset_t *) In0P->argv, In0P->argvType.msgtl_number); |
868 | } |
869 | |
870 | /* Routine fsys_get_options */ |
871 | mig_internalstatic void _Xfsys_get_options |
872 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
873 | { |
874 | typedef struct { |
875 | mach_msg_header_t Head; |
876 | } Request; |
877 | |
878 | typedef struct { |
879 | mach_msg_header_t Head; |
880 | mach_msg_type_t RetCodeType; |
881 | kern_return_t RetCode; |
882 | mach_msg_type_long_t optionsType; |
883 | char options[2048]; |
884 | } Reply; |
885 | |
886 | Request *In0P = (Request *) InHeadP; |
887 | Reply *OutP = (Reply *) OutHeadP; |
888 | mig_external kern_return_t diskfs_S_fsys_get_options |
889 | (control_t server, mach_port_t reply, mach_msg_type_name_t replyPoly, data_t *options, mach_msg_type_number_t *optionsCnt); |
890 | |
891 | boolean_t msgh_simple; |
892 | const mach_msg_type_long_t optionsType = { |
893 | { |
894 | /* msgt_name = */ 0, |
895 | /* msgt_size = */ 0, |
896 | /* msgt_number = */ 0, |
897 | /* msgt_inline = */ TRUE((boolean_t) 1), |
898 | /* msgt_longform = */ TRUE((boolean_t) 1), |
899 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
900 | /* msgt_unused = */ 0 |
901 | }, |
902 | /* msgtl_name = */ 8, |
903 | /* msgtl_size = */ 8, |
904 | /* msgtl_number = */ 2048, |
905 | }; |
906 | |
907 | control_t server; |
908 | mach_msg_type_number_t optionsCnt; |
909 | |
910 | char *optionsP; |
911 | |
912 | #if TypeCheck1 |
913 | if ((In0P->Head.msgh_size != 24) || |
914 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U)) |
915 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
916 | #endif /* TypeCheck */ |
917 | |
918 | server = diskfs_begin_using_control_port(In0P->Head.msgh_request_portmsgh_local_port); |
919 | |
920 | optionsP = OutP->options; |
921 | optionsCnt = 2048; |
922 | |
923 | OutP->RetCode = diskfs_S_fsys_get_options(server, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), &optionsP, &optionsCnt); |
924 | diskfs_end_using_control_port(server); |
925 | if (OutP->RetCode != KERN_SUCCESS0) |
926 | return; |
927 | |
928 | msgh_simple = TRUE((boolean_t) 1); |
929 | |
930 | OutP->optionsType = optionsType; |
931 | if (optionsP != OutP->options) { |
932 | OutP->optionsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
933 | OutP->optionsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
934 | *((char **)OutP->options) = optionsP; |
935 | msgh_simple = FALSE((boolean_t) 0); |
936 | } |
937 | |
938 | OutP->optionsType.msgtl_number = optionsCnt; |
939 | OutP->Head.msgh_size = 44 + ((OutP->optionsType.msgtl_header.msgt_inline) ? (optionsCnt + 3) & ~3 : sizeof(char *)); |
940 | |
941 | if (!msgh_simple) |
942 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
943 | } |
944 | |
945 | mig_routine_t diskfs_fsys_server_routines[] = { |
946 | _Xfsys_startup, |
947 | _Xfsys_goaway, |
948 | _Xfsys_getroot, |
949 | _Xfsys_getfile, |
950 | _Xfsys_syncfs, |
951 | _Xfsys_set_options, |
952 | _Xfsys_getpriv, |
953 | _Xfsys_init, |
954 | _Xfsys_forward, |
955 | _Xfsys_get_options, |
956 | 0, |
957 | 0, |
958 | }; |
959 | |
960 | mig_external boolean_t diskfs_fsys_server |
961 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
962 | { |
963 | mach_msg_header_t *InP = InHeadP; |
964 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
965 | |
966 | const mach_msg_type_t RetCodeType = { |
967 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
968 | /* msgt_size = */ 32, |
969 | /* msgt_number = */ 1, |
970 | /* msgt_inline = */ TRUE((boolean_t) 1), |
971 | /* msgt_longform = */ FALSE((boolean_t) 0), |
972 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
973 | /* msgt_unused = */ 0 |
974 | }; |
975 | |
976 | mig_routine_t routine; |
977 | |
978 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
979 | OutP->Head.msgh_size = sizeof *OutP; |
980 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
981 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
982 | OutP->Head.msgh_seqno = 0; |
983 | OutP->Head.msgh_id = InP->msgh_id + 100; |
984 | |
985 | OutP->RetCodeType = RetCodeType; |
986 | |
987 | if ((InP->msgh_id > 22011) || (InP->msgh_id < 22000) || |
988 | ((routine = diskfs_fsys_server_routines[InP->msgh_id - 22000]) == 0)) { |
989 | OutP->RetCode = MIG_BAD_ID-303; |
990 | return FALSE((boolean_t) 0); |
991 | } |
992 | (*routine) (InP, &OutP->Head); |
993 | return TRUE((boolean_t) 1); |
994 | } |
995 | |
996 | mig_external mig_routine_t diskfs_fsys_server_routine |
997 | (const mach_msg_header_t *InHeadP) |
998 | { |
999 | int msgh_id; |
1000 | |
1001 | msgh_id = InHeadP->msgh_id - 22000; |
1002 | |
1003 | if ((msgh_id > 11) || (msgh_id < 0)) |
1004 | return 0; |
1005 | |
1006 | return diskfs_fsys_server_routines[msgh_id]; |
1007 | } |
1008 |