Bug Summary

File:obj-scan-build/libnetfs/fsysServer.c
Location:line 1097, column 12
Description:Value stored to 'msgh_simple' during its initialization is never read

Annotated Source Code

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