Bug Summary

File:obj-scan-build/libnetfs/fsServer.c
Location:line 2780, column 2
Description:Assigned value is garbage or undefined

Annotated Source Code

1/* Module fs */
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 file_exec */
57mig_internalstatic void _Xfile_exec
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 exec_taskType;
63 mach_port_t exec_task;
64 mach_msg_type_t flagsType;
65 int flags;
66 mach_msg_type_long_t argvType;
67 char argv[2048];
68 mach_msg_type_long_t envpType;
69 char envp[2048];
70 mach_msg_type_long_t fdarrayType;
71 mach_port_t fdarray[512];
72 mach_msg_type_long_t portarrayType;
73 mach_port_t portarray[512];
74 mach_msg_type_long_t intarrayType;
75 int intarray[512];
76 mach_msg_type_long_t deallocnamesType;
77 mach_port_t deallocnames[512];
78 mach_msg_type_long_t destroynamesType;
79 mach_port_t destroynames[512];
80 } Request;
81
82 typedef struct {
83 mach_msg_header_t Head;
84 mach_msg_type_t RetCodeType;
85 kern_return_t RetCode;
86 } Reply;
87
88 Request *In0P = (Request *) InHeadP;
89 Request *In1P;
90 Request *In2P;
91 Request *In3P;
92 Request *In4P;
93 Request *In5P;
94 Request *In6P;
95 Reply *OutP = (Reply *) OutHeadP;
96 mig_external kern_return_t netfs_S_file_exec
97 (protid_t exec_file, mach_port_t exec_task, int flags, data_t argv, mach_msg_type_number_t argvCnt, data_t envp, mach_msg_type_number_t envpCnt, portarray_t fdarray, mach_msg_type_number_t fdarrayCnt, portarray_t portarray, mach_msg_type_number_t portarrayCnt, intarray_t intarray, mach_msg_type_number_t intarrayCnt, mach_port_array_t deallocnames, mach_msg_type_number_t deallocnamesCnt, mach_port_array_t destroynames, mach_msg_type_number_t destroynamesCnt);
98
99 unsigned int msgh_size;
100 unsigned int msgh_size_delta;
101
102 const mach_msg_type_t exec_taskCheck = {
103 /* msgt_name = */ 17,
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 const mach_msg_type_t flagsCheck = {
113 /* msgt_name = */ 2,
114 /* msgt_size = */ 32,
115 /* msgt_number = */ 1,
116 /* msgt_inline = */ TRUE((boolean_t) 1),
117 /* msgt_longform = */ FALSE((boolean_t) 0),
118 /* msgt_deallocate = */ FALSE((boolean_t) 0),
119 /* msgt_unused = */ 0
120 };
121
122 protid_t exec_file;
123
124#if TypeCheck1
125 msgh_size = In0P->Head.msgh_size;
126 if (mig_unlikely ((msgh_size < 124) ||__builtin_expect (!! ((msgh_size < 124) || !(In0P->Head
.msgh_bits & 0x80000000U)), 0)
127 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 124) || !(In0P->Head
.msgh_bits & 0x80000000U)), 0)
)
128 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
129#endif /* TypeCheck */
130
131#if TypeCheck1
132 if (BAD_TYPECHECK(&In0P->exec_taskType, &exec_taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->exec_taskType); _c.t = *
(&exec_taskCheck);_t.w != _c.w; })), 0)
)
133 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
134#endif /* TypeCheck */
135
136#if TypeCheck1
137 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)
)
138 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
139#endif /* TypeCheck */
140
141#if TypeCheck1
142 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)
143 (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)
144 (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)
)
145 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
146#endif /* TypeCheck */
147
148 msgh_size_delta = (In0P->argvType.msgtl_header.msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *);
149#if TypeCheck1
150 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
151 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
152 msgh_size -= msgh_size_delta;
153#endif /* TypeCheck */
154
155 In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048);
156
157#if TypeCheck1
158 if (mig_unlikely ((In1P->envpType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->envpType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->envpType.msgtl_name != 8) ||
(In1P->envpType.msgtl_size != 8)), 0)
159 (In1P->envpType.msgtl_name != 8) ||__builtin_expect (!! ((In1P->envpType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->envpType.msgtl_name != 8) ||
(In1P->envpType.msgtl_size != 8)), 0)
160 (In1P->envpType.msgtl_size != 8))__builtin_expect (!! ((In1P->envpType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->envpType.msgtl_name != 8) ||
(In1P->envpType.msgtl_size != 8)), 0)
)
161 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
162#endif /* TypeCheck */
163
164 msgh_size_delta = (In1P->envpType.msgtl_header.msgt_inline) ? (In1P->envpType.msgtl_number + 3) & ~3 : sizeof(char *);
165#if TypeCheck1
166 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
167 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
168 msgh_size -= msgh_size_delta;
169#endif /* TypeCheck */
170
171 In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048);
172
173#if TypeCheck1
174 if (mig_unlikely ((In2P->fdarrayType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In2P->fdarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In2P->fdarrayType.msgtl_name != 17
) || (In2P->fdarrayType.msgtl_size != 32)), 0)
175 (In2P->fdarrayType.msgtl_name != 17) ||__builtin_expect (!! ((In2P->fdarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In2P->fdarrayType.msgtl_name != 17
) || (In2P->fdarrayType.msgtl_size != 32)), 0)
176 (In2P->fdarrayType.msgtl_size != 32))__builtin_expect (!! ((In2P->fdarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In2P->fdarrayType.msgtl_name != 17
) || (In2P->fdarrayType.msgtl_size != 32)), 0)
)
177 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
178#endif /* TypeCheck */
179
180 msgh_size_delta = (In2P->fdarrayType.msgtl_header.msgt_inline) ? 4 * In2P->fdarrayType.msgtl_number : sizeof(mach_port_t *);
181#if TypeCheck1
182 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
183 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
184 msgh_size -= msgh_size_delta;
185#endif /* TypeCheck */
186
187 In3P = (Request *) ((char *) In2P + msgh_size_delta - 2048);
188
189#if TypeCheck1
190 if (mig_unlikely ((In3P->portarrayType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In3P->portarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In3P->portarrayType.msgtl_name !=
17) || (In3P->portarrayType.msgtl_size != 32)), 0)
191 (In3P->portarrayType.msgtl_name != 17) ||__builtin_expect (!! ((In3P->portarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In3P->portarrayType.msgtl_name !=
17) || (In3P->portarrayType.msgtl_size != 32)), 0)
192 (In3P->portarrayType.msgtl_size != 32))__builtin_expect (!! ((In3P->portarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In3P->portarrayType.msgtl_name !=
17) || (In3P->portarrayType.msgtl_size != 32)), 0)
)
193 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
194#endif /* TypeCheck */
195
196 msgh_size_delta = (In3P->portarrayType.msgtl_header.msgt_inline) ? 4 * In3P->portarrayType.msgtl_number : sizeof(mach_port_t *);
197#if TypeCheck1
198 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
199 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
200 msgh_size -= msgh_size_delta;
201#endif /* TypeCheck */
202
203 In4P = (Request *) ((char *) In3P + msgh_size_delta - 2048);
204
205#if TypeCheck1
206 if (mig_unlikely ((In4P->intarrayType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In4P->intarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In4P->intarrayType.msgtl_name != 2
) || (In4P->intarrayType.msgtl_size != 32)), 0)
207 (In4P->intarrayType.msgtl_name != 2) ||__builtin_expect (!! ((In4P->intarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In4P->intarrayType.msgtl_name != 2
) || (In4P->intarrayType.msgtl_size != 32)), 0)
208 (In4P->intarrayType.msgtl_size != 32))__builtin_expect (!! ((In4P->intarrayType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In4P->intarrayType.msgtl_name != 2
) || (In4P->intarrayType.msgtl_size != 32)), 0)
)
209 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
210#endif /* TypeCheck */
211
212 msgh_size_delta = (In4P->intarrayType.msgtl_header.msgt_inline) ? 4 * In4P->intarrayType.msgtl_number : sizeof(int *);
213#if TypeCheck1
214 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
215 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
216 msgh_size -= msgh_size_delta;
217#endif /* TypeCheck */
218
219 In5P = (Request *) ((char *) In4P + msgh_size_delta - 2048);
220
221#if TypeCheck1
222 if (mig_unlikely ((In5P->deallocnamesType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In5P->deallocnamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In5P->deallocnamesType
.msgtl_name != 15) || (In5P->deallocnamesType.msgtl_size !=
32)), 0)
223 (In5P->deallocnamesType.msgtl_name != 15) ||__builtin_expect (!! ((In5P->deallocnamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In5P->deallocnamesType
.msgtl_name != 15) || (In5P->deallocnamesType.msgtl_size !=
32)), 0)
224 (In5P->deallocnamesType.msgtl_size != 32))__builtin_expect (!! ((In5P->deallocnamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In5P->deallocnamesType
.msgtl_name != 15) || (In5P->deallocnamesType.msgtl_size !=
32)), 0)
)
225 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
226#endif /* TypeCheck */
227
228 msgh_size_delta = (In5P->deallocnamesType.msgtl_header.msgt_inline) ? 4 * In5P->deallocnamesType.msgtl_number : sizeof(mach_port_t *);
229#if TypeCheck1
230 if (mig_unlikely (msgh_size < 124 + msgh_size_delta)__builtin_expect (!! (msgh_size < 124 + msgh_size_delta), 0
)
)
231 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
232 msgh_size -= msgh_size_delta;
233#endif /* TypeCheck */
234
235 In6P = (Request *) ((char *) In5P + msgh_size_delta - 2048);
236
237#if TypeCheck1
238 if (mig_unlikely ((In6P->destroynamesType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In6P->destroynamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In6P->destroynamesType
.msgtl_name != 15) || (In6P->destroynamesType.msgtl_size !=
32)), 0)
239 (In6P->destroynamesType.msgtl_name != 15) ||__builtin_expect (!! ((In6P->destroynamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In6P->destroynamesType
.msgtl_name != 15) || (In6P->destroynamesType.msgtl_size !=
32)), 0)
240 (In6P->destroynamesType.msgtl_size != 32))__builtin_expect (!! ((In6P->destroynamesType.msgtl_header
.msgt_longform != ((boolean_t) 1)) || (In6P->destroynamesType
.msgtl_name != 15) || (In6P->destroynamesType.msgtl_size !=
32)), 0)
)
241 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
242#endif /* TypeCheck */
243
244#if TypeCheck1
245 if (mig_unlikely (msgh_size != 124 + ((In6P->destroynamesType.msgtl_header.msgt_inline) ? 4 * In6P->destroynamesType.msgtl_number : sizeof(mach_port_t *)))__builtin_expect (!! (msgh_size != 124 + ((In6P->destroynamesType
.msgtl_header.msgt_inline) ? 4 * In6P->destroynamesType.msgtl_number
: sizeof(mach_port_t *))), 0)
)
246 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
247#endif /* TypeCheck */
248
249 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
250 exec_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
251 else
252 exec_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
253
254 OutP->RetCode = netfs_S_file_exec(exec_file, In0P->exec_task, In0P->flags, (In0P->argvType.msgtl_header.msgt_inline) ? In0P->argv : *((char **)In0P->argv), In0P->argvType.msgtl_number, (In1P->envpType.msgtl_header.msgt_inline) ? In1P->envp : *((char **)In1P->envp), In1P->envpType.msgtl_number, (In2P->fdarrayType.msgtl_header.msgt_inline) ? In2P->fdarray : *((mach_port_t **)In2P->fdarray), In2P->fdarrayType.msgtl_number, (In3P->portarrayType.msgtl_header.msgt_inline) ? In3P->portarray : *((mach_port_t **)In3P->portarray), In3P->portarrayType.msgtl_number, (In4P->intarrayType.msgtl_header.msgt_inline) ? In4P->intarray : *((int **)In4P->intarray), In4P->intarrayType.msgtl_number, (In5P->deallocnamesType.msgtl_header.msgt_inline) ? In5P->deallocnames : *((mach_port_t **)In5P->deallocnames), In5P->deallocnamesType.msgtl_number, (In6P->destroynamesType.msgtl_header.msgt_inline) ? In6P->destroynames : *((mach_port_t **)In6P->destroynames), In6P->destroynamesType.msgtl_number);
255 if (OutP->RetCode == KERN_SUCCESS0)
256 if (!In6P->destroynamesType.msgtl_header.msgt_inline)
257 __mig_deallocate(* (vm_offset_t *) In6P->destroynames, 4 * In6P->destroynamesType.msgtl_number);
258 if (OutP->RetCode == KERN_SUCCESS0)
259 if (!In5P->deallocnamesType.msgtl_header.msgt_inline)
260 __mig_deallocate(* (vm_offset_t *) In5P->deallocnames, 4 * In5P->deallocnamesType.msgtl_number);
261 if (OutP->RetCode == KERN_SUCCESS0)
262 if (!In4P->intarrayType.msgtl_header.msgt_inline)
263 __mig_deallocate(* (vm_offset_t *) In4P->intarray, 4 * In4P->intarrayType.msgtl_number);
264 if (OutP->RetCode == KERN_SUCCESS0)
265 if (!In3P->portarrayType.msgtl_header.msgt_inline)
266 __mig_deallocate(* (vm_offset_t *) In3P->portarray, 4 * In3P->portarrayType.msgtl_number);
267 if (OutP->RetCode == KERN_SUCCESS0)
268 if (!In2P->fdarrayType.msgtl_header.msgt_inline)
269 __mig_deallocate(* (vm_offset_t *) In2P->fdarray, 4 * In2P->fdarrayType.msgtl_number);
270 if (OutP->RetCode == KERN_SUCCESS0)
271 if (!In1P->envpType.msgtl_header.msgt_inline)
272 __mig_deallocate(* (vm_offset_t *) In1P->envp, In1P->envpType.msgtl_number);
273 if (OutP->RetCode == KERN_SUCCESS0)
274 if (!In0P->argvType.msgtl_header.msgt_inline)
275 __mig_deallocate(* (vm_offset_t *) In0P->argv, In0P->argvType.msgtl_number);
276 end_using_protid_port(exec_file);
277}
278
279/* Default implementation of netfs_S_file_exec */
280#ifdef MIG_EOPNOTSUPP
281kern_return_t __attribute__ ((weak))
282netfs_S_file_exec
283(
284 protid_t exec_file,
285 mach_port_t exec_task,
286 int flags,
287 data_t argv,
288 mach_msg_type_number_t argvCnt,
289 data_t envp,
290 mach_msg_type_number_t envpCnt,
291 portarray_t fdarray,
292 mach_msg_type_number_t fdarrayCnt,
293 portarray_t portarray,
294 mach_msg_type_number_t portarrayCnt,
295 intarray_t intarray,
296 mach_msg_type_number_t intarrayCnt,
297 mach_port_array_t deallocnames,
298 mach_msg_type_number_t deallocnamesCnt,
299 mach_port_array_t destroynames,
300 mach_msg_type_number_t destroynamesCnt
301) { return MIG_EOPNOTSUPP; }
302#endif /* MIG_EOPNOTSUPP */
303
304/* Routine file_chown */
305mig_internalstatic void _Xfile_chown
306 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
307{
308 typedef struct {
309 mach_msg_header_t Head;
310 mach_msg_type_t new_ownerType;
311 uid_t new_owner;
312 mach_msg_type_t new_groupType;
313 gid_t new_group;
314 } Request;
315
316 typedef struct {
317 mach_msg_header_t Head;
318 mach_msg_type_t RetCodeType;
319 kern_return_t RetCode;
320 } Reply;
321
322 Request *In0P = (Request *) InHeadP;
323 Reply *OutP = (Reply *) OutHeadP;
324 mig_external kern_return_t netfs_S_file_chown
325 (protid_t chown_file, uid_t new_owner, gid_t new_group);
326
327 const mach_msg_type_t new_ownerCheck = {
328 /* msgt_name = */ 2,
329 /* msgt_size = */ 32,
330 /* msgt_number = */ 1,
331 /* msgt_inline = */ TRUE((boolean_t) 1),
332 /* msgt_longform = */ FALSE((boolean_t) 0),
333 /* msgt_deallocate = */ FALSE((boolean_t) 0),
334 /* msgt_unused = */ 0
335 };
336
337 const mach_msg_type_t new_groupCheck = {
338 /* msgt_name = */ 2,
339 /* msgt_size = */ 32,
340 /* msgt_number = */ 1,
341 /* msgt_inline = */ TRUE((boolean_t) 1),
342 /* msgt_longform = */ FALSE((boolean_t) 0),
343 /* msgt_deallocate = */ FALSE((boolean_t) 0),
344 /* msgt_unused = */ 0
345 };
346
347 protid_t chown_file;
348
349#if TypeCheck1
350 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
351 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
352 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
353#endif /* TypeCheck */
354
355#if TypeCheck1
356 if (BAD_TYPECHECK(&In0P->new_ownerType, &new_ownerCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_ownerType); _c.t = *
(&new_ownerCheck);_t.w != _c.w; })), 0)
)
357 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
358#endif /* TypeCheck */
359
360#if TypeCheck1
361 if (BAD_TYPECHECK(&In0P->new_groupType, &new_groupCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_groupType); _c.t = *
(&new_groupCheck);_t.w != _c.w; })), 0)
)
362 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
363#endif /* TypeCheck */
364
365 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
366 chown_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
367 else
368 chown_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
369
370 OutP->RetCode = netfs_S_file_chown(chown_file, In0P->new_owner, In0P->new_group);
371 end_using_protid_port(chown_file);
372}
373
374/* Default implementation of netfs_S_file_chown */
375#ifdef MIG_EOPNOTSUPP
376kern_return_t __attribute__ ((weak))
377netfs_S_file_chown
378(
379 protid_t chown_file,
380 uid_t new_owner,
381 gid_t new_group
382) { return MIG_EOPNOTSUPP; }
383#endif /* MIG_EOPNOTSUPP */
384
385/* Routine file_chauthor */
386mig_internalstatic void _Xfile_chauthor
387 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
388{
389 typedef struct {
390 mach_msg_header_t Head;
391 mach_msg_type_t new_authorType;
392 uid_t new_author;
393 } Request;
394
395 typedef struct {
396 mach_msg_header_t Head;
397 mach_msg_type_t RetCodeType;
398 kern_return_t RetCode;
399 } Reply;
400
401 Request *In0P = (Request *) InHeadP;
402 Reply *OutP = (Reply *) OutHeadP;
403 mig_external kern_return_t netfs_S_file_chauthor
404 (protid_t chauth_file, uid_t new_author);
405
406 const mach_msg_type_t new_authorCheck = {
407 /* msgt_name = */ 2,
408 /* msgt_size = */ 32,
409 /* msgt_number = */ 1,
410 /* msgt_inline = */ TRUE((boolean_t) 1),
411 /* msgt_longform = */ FALSE((boolean_t) 0),
412 /* msgt_deallocate = */ FALSE((boolean_t) 0),
413 /* msgt_unused = */ 0
414 };
415
416 protid_t chauth_file;
417
418#if TypeCheck1
419 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
420 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
421 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
422#endif /* TypeCheck */
423
424#if TypeCheck1
425 if (BAD_TYPECHECK(&In0P->new_authorType, &new_authorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_authorType); _c.t = *
(&new_authorCheck);_t.w != _c.w; })), 0)
)
426 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
427#endif /* TypeCheck */
428
429 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
430 chauth_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
431 else
432 chauth_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
433
434 OutP->RetCode = netfs_S_file_chauthor(chauth_file, In0P->new_author);
435 end_using_protid_port(chauth_file);
436}
437
438/* Default implementation of netfs_S_file_chauthor */
439#ifdef MIG_EOPNOTSUPP
440kern_return_t __attribute__ ((weak))
441netfs_S_file_chauthor
442(
443 protid_t chauth_file,
444 uid_t new_author
445) { return MIG_EOPNOTSUPP; }
446#endif /* MIG_EOPNOTSUPP */
447
448/* Routine file_chmod */
449mig_internalstatic void _Xfile_chmod
450 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
451{
452 typedef struct {
453 mach_msg_header_t Head;
454 mach_msg_type_t new_modeType;
455 mode_t new_mode;
456 } Request;
457
458 typedef struct {
459 mach_msg_header_t Head;
460 mach_msg_type_t RetCodeType;
461 kern_return_t RetCode;
462 } Reply;
463
464 Request *In0P = (Request *) InHeadP;
465 Reply *OutP = (Reply *) OutHeadP;
466 mig_external kern_return_t netfs_S_file_chmod
467 (protid_t chmod_file, mode_t new_mode);
468
469 const mach_msg_type_t new_modeCheck = {
470 /* msgt_name = */ 2,
471 /* msgt_size = */ 32,
472 /* msgt_number = */ 1,
473 /* msgt_inline = */ TRUE((boolean_t) 1),
474 /* msgt_longform = */ FALSE((boolean_t) 0),
475 /* msgt_deallocate = */ FALSE((boolean_t) 0),
476 /* msgt_unused = */ 0
477 };
478
479 protid_t chmod_file;
480
481#if TypeCheck1
482 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
483 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
484 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
485#endif /* TypeCheck */
486
487#if TypeCheck1
488 if (BAD_TYPECHECK(&In0P->new_modeType, &new_modeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_modeType); _c.t = *(
&new_modeCheck);_t.w != _c.w; })), 0)
)
489 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
490#endif /* TypeCheck */
491
492 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
493 chmod_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
494 else
495 chmod_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
496
497 OutP->RetCode = netfs_S_file_chmod(chmod_file, In0P->new_mode);
498 end_using_protid_port(chmod_file);
499}
500
501/* Default implementation of netfs_S_file_chmod */
502#ifdef MIG_EOPNOTSUPP
503kern_return_t __attribute__ ((weak))
504netfs_S_file_chmod
505(
506 protid_t chmod_file,
507 mode_t new_mode
508) { return MIG_EOPNOTSUPP; }
509#endif /* MIG_EOPNOTSUPP */
510
511/* Routine file_chflags */
512mig_internalstatic void _Xfile_chflags
513 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
514{
515 typedef struct {
516 mach_msg_header_t Head;
517 mach_msg_type_t new_flagsType;
518 int new_flags;
519 } Request;
520
521 typedef struct {
522 mach_msg_header_t Head;
523 mach_msg_type_t RetCodeType;
524 kern_return_t RetCode;
525 } Reply;
526
527 Request *In0P = (Request *) InHeadP;
528 Reply *OutP = (Reply *) OutHeadP;
529 mig_external kern_return_t netfs_S_file_chflags
530 (protid_t chflags_file, int new_flags);
531
532 const mach_msg_type_t new_flagsCheck = {
533 /* msgt_name = */ 2,
534 /* msgt_size = */ 32,
535 /* msgt_number = */ 1,
536 /* msgt_inline = */ TRUE((boolean_t) 1),
537 /* msgt_longform = */ FALSE((boolean_t) 0),
538 /* msgt_deallocate = */ FALSE((boolean_t) 0),
539 /* msgt_unused = */ 0
540 };
541
542 protid_t chflags_file;
543
544#if TypeCheck1
545 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
546 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
547 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
548#endif /* TypeCheck */
549
550#if TypeCheck1
551 if (BAD_TYPECHECK(&In0P->new_flagsType, &new_flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_flagsType); _c.t = *
(&new_flagsCheck);_t.w != _c.w; })), 0)
)
552 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
553#endif /* TypeCheck */
554
555 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
556 chflags_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
557 else
558 chflags_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
559
560 OutP->RetCode = netfs_S_file_chflags(chflags_file, In0P->new_flags);
561 end_using_protid_port(chflags_file);
562}
563
564/* Default implementation of netfs_S_file_chflags */
565#ifdef MIG_EOPNOTSUPP
566kern_return_t __attribute__ ((weak))
567netfs_S_file_chflags
568(
569 protid_t chflags_file,
570 int new_flags
571) { return MIG_EOPNOTSUPP; }
572#endif /* MIG_EOPNOTSUPP */
573
574/* Routine file_utimes */
575mig_internalstatic void _Xfile_utimes
576 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
577{
578 typedef struct {
579 mach_msg_header_t Head;
580 mach_msg_type_t new_atimeType;
581 time_value_t new_atime;
582 mach_msg_type_t new_mtimeType;
583 time_value_t new_mtime;
584 } Request;
585
586 typedef struct {
587 mach_msg_header_t Head;
588 mach_msg_type_t RetCodeType;
589 kern_return_t RetCode;
590 } Reply;
591
592 Request *In0P = (Request *) InHeadP;
593 Reply *OutP = (Reply *) OutHeadP;
594 mig_external kern_return_t netfs_S_file_utimes
595 (protid_t utimes_file, time_value_t new_atime, time_value_t new_mtime);
596
597 const mach_msg_type_t new_atimeCheck = {
598 /* msgt_name = */ 2,
599 /* msgt_size = */ 32,
600 /* msgt_number = */ 2,
601 /* msgt_inline = */ TRUE((boolean_t) 1),
602 /* msgt_longform = */ FALSE((boolean_t) 0),
603 /* msgt_deallocate = */ FALSE((boolean_t) 0),
604 /* msgt_unused = */ 0
605 };
606
607 const mach_msg_type_t new_mtimeCheck = {
608 /* msgt_name = */ 2,
609 /* msgt_size = */ 32,
610 /* msgt_number = */ 2,
611 /* msgt_inline = */ TRUE((boolean_t) 1),
612 /* msgt_longform = */ FALSE((boolean_t) 0),
613 /* msgt_deallocate = */ FALSE((boolean_t) 0),
614 /* msgt_unused = */ 0
615 };
616
617 protid_t utimes_file;
618
619#if TypeCheck1
620 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
621 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
622 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
623#endif /* TypeCheck */
624
625#if TypeCheck1
626 if (BAD_TYPECHECK(&In0P->new_atimeType, &new_atimeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_atimeType); _c.t = *
(&new_atimeCheck);_t.w != _c.w; })), 0)
)
627 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
628#endif /* TypeCheck */
629
630#if TypeCheck1
631 if (BAD_TYPECHECK(&In0P->new_mtimeType, &new_mtimeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_mtimeType); _c.t = *
(&new_mtimeCheck);_t.w != _c.w; })), 0)
)
632 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
633#endif /* TypeCheck */
634
635 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
636 utimes_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
637 else
638 utimes_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
639
640 OutP->RetCode = netfs_S_file_utimes(utimes_file, In0P->new_atime, In0P->new_mtime);
641 end_using_protid_port(utimes_file);
642}
643
644/* Default implementation of netfs_S_file_utimes */
645#ifdef MIG_EOPNOTSUPP
646kern_return_t __attribute__ ((weak))
647netfs_S_file_utimes
648(
649 protid_t utimes_file,
650 time_value_t new_atime,
651 time_value_t new_mtime
652) { return MIG_EOPNOTSUPP; }
653#endif /* MIG_EOPNOTSUPP */
654
655/* Routine file_set_size */
656mig_internalstatic void _Xfile_set_size
657 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
658{
659 typedef struct {
660 mach_msg_header_t Head;
661 mach_msg_type_t new_sizeType;
662 loff_t new_size;
663 } Request;
664
665 typedef struct {
666 mach_msg_header_t Head;
667 mach_msg_type_t RetCodeType;
668 kern_return_t RetCode;
669 } Reply;
670
671 Request *In0P = (Request *) InHeadP;
672 Reply *OutP = (Reply *) OutHeadP;
673 mig_external kern_return_t netfs_S_file_set_size
674 (protid_t trunc_file, loff_t new_size);
675
676 const mach_msg_type_t new_sizeCheck = {
677 /* msgt_name = */ 11,
678 /* msgt_size = */ 64,
679 /* msgt_number = */ 1,
680 /* msgt_inline = */ TRUE((boolean_t) 1),
681 /* msgt_longform = */ FALSE((boolean_t) 0),
682 /* msgt_deallocate = */ FALSE((boolean_t) 0),
683 /* msgt_unused = */ 0
684 };
685
686 protid_t trunc_file;
687
688#if TypeCheck1
689 if (mig_unlikely ((In0P->Head.msgh_size != 36) ||__builtin_expect (!! ((In0P->Head.msgh_size != 36) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
690 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 36) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
691 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
692#endif /* TypeCheck */
693
694#if TypeCheck1
695 if (BAD_TYPECHECK(&In0P->new_sizeType, &new_sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_sizeType); _c.t = *(
&new_sizeCheck);_t.w != _c.w; })), 0)
)
696 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
697#endif /* TypeCheck */
698
699 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
700 trunc_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
701 else
702 trunc_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
703
704 OutP->RetCode = netfs_S_file_set_size(trunc_file, In0P->new_size);
705 end_using_protid_port(trunc_file);
706}
707
708/* Default implementation of netfs_S_file_set_size */
709#ifdef MIG_EOPNOTSUPP
710kern_return_t __attribute__ ((weak))
711netfs_S_file_set_size
712(
713 protid_t trunc_file,
714 loff_t new_size
715) { return MIG_EOPNOTSUPP; }
716#endif /* MIG_EOPNOTSUPP */
717
718/* Routine file_lock */
719mig_internalstatic void _Xfile_lock
720 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
721{
722 typedef struct {
723 mach_msg_header_t Head;
724 mach_msg_type_t flagsType;
725 int flags;
726 } Request;
727
728 typedef struct {
729 mach_msg_header_t Head;
730 mach_msg_type_t RetCodeType;
731 kern_return_t RetCode;
732 } Reply;
733
734 Request *In0P = (Request *) InHeadP;
735 Reply *OutP = (Reply *) OutHeadP;
736 mig_external kern_return_t netfs_S_file_lock
737 (protid_t lock_file, int flags);
738
739 const mach_msg_type_t flagsCheck = {
740 /* msgt_name = */ 2,
741 /* msgt_size = */ 32,
742 /* msgt_number = */ 1,
743 /* msgt_inline = */ TRUE((boolean_t) 1),
744 /* msgt_longform = */ FALSE((boolean_t) 0),
745 /* msgt_deallocate = */ FALSE((boolean_t) 0),
746 /* msgt_unused = */ 0
747 };
748
749 protid_t lock_file;
750
751#if TypeCheck1
752 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
753 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
754 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
755#endif /* TypeCheck */
756
757#if TypeCheck1
758 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)
)
759 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
760#endif /* TypeCheck */
761
762 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
763 lock_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
764 else
765 lock_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
766
767 OutP->RetCode = netfs_S_file_lock(lock_file, In0P->flags);
768 end_using_protid_port(lock_file);
769}
770
771/* Default implementation of netfs_S_file_lock */
772#ifdef MIG_EOPNOTSUPP
773kern_return_t __attribute__ ((weak))
774netfs_S_file_lock
775(
776 protid_t lock_file,
777 int flags
778) { return MIG_EOPNOTSUPP; }
779#endif /* MIG_EOPNOTSUPP */
780
781/* Routine file_lock_stat */
782mig_internalstatic void _Xfile_lock_stat
783 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
784{
785 typedef struct {
786 mach_msg_header_t Head;
787 } Request;
788
789 typedef struct {
790 mach_msg_header_t Head;
791 mach_msg_type_t RetCodeType;
792 kern_return_t RetCode;
793 mach_msg_type_t mystatusType;
794 int mystatus;
795 mach_msg_type_t otherstatusType;
796 int otherstatus;
797 } Reply;
798
799 Request *In0P = (Request *) InHeadP;
800 Reply *OutP = (Reply *) OutHeadP;
801 mig_external kern_return_t netfs_S_file_lock_stat
802 (protid_t lock_file, int *mystatus, int *otherstatus);
803
804 const mach_msg_type_t mystatusType = {
805 /* msgt_name = */ 2,
806 /* msgt_size = */ 32,
807 /* msgt_number = */ 1,
808 /* msgt_inline = */ TRUE((boolean_t) 1),
809 /* msgt_longform = */ FALSE((boolean_t) 0),
810 /* msgt_deallocate = */ FALSE((boolean_t) 0),
811 /* msgt_unused = */ 0
812 };
813
814 const mach_msg_type_t otherstatusType = {
815 /* msgt_name = */ 2,
816 /* msgt_size = */ 32,
817 /* msgt_number = */ 1,
818 /* msgt_inline = */ TRUE((boolean_t) 1),
819 /* msgt_longform = */ FALSE((boolean_t) 0),
820 /* msgt_deallocate = */ FALSE((boolean_t) 0),
821 /* msgt_unused = */ 0
822 };
823
824 protid_t lock_file;
825
826#if TypeCheck1
827 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
828 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
829 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
830#endif /* TypeCheck */
831
832 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
833 lock_file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
834 else
835 lock_file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
836
837 OutP->RetCode = netfs_S_file_lock_stat(lock_file, &OutP->mystatus, &OutP->otherstatus);
838 end_using_protid_port(lock_file);
839 if (OutP->RetCode != KERN_SUCCESS0)
840 return;
841
842 OutP->Head.msgh_size = 48;
843
844 OutP->mystatusType = mystatusType;
845
846 OutP->otherstatusType = otherstatusType;
847}
848
849/* Default implementation of netfs_S_file_lock_stat */
850#ifdef MIG_EOPNOTSUPP
851kern_return_t __attribute__ ((weak))
852netfs_S_file_lock_stat
853(
854 protid_t lock_file,
855 int *mystatus,
856 int *otherstatus
857) { return MIG_EOPNOTSUPP; }
858#endif /* MIG_EOPNOTSUPP */
859
860/* Routine file_check_access */
861mig_internalstatic void _Xfile_check_access
862 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
863{
864 typedef struct {
865 mach_msg_header_t Head;
866 } Request;
867
868 typedef struct {
869 mach_msg_header_t Head;
870 mach_msg_type_t RetCodeType;
871 kern_return_t RetCode;
872 mach_msg_type_t allowedType;
873 int allowed;
874 } Reply;
875
876 Request *In0P = (Request *) InHeadP;
877 Reply *OutP = (Reply *) OutHeadP;
878 mig_external kern_return_t netfs_S_file_check_access
879 (protid_t file, int *allowed);
880
881 const mach_msg_type_t allowedType = {
882 /* msgt_name = */ 2,
883 /* msgt_size = */ 32,
884 /* msgt_number = */ 1,
885 /* msgt_inline = */ TRUE((boolean_t) 1),
886 /* msgt_longform = */ FALSE((boolean_t) 0),
887 /* msgt_deallocate = */ FALSE((boolean_t) 0),
888 /* msgt_unused = */ 0
889 };
890
891 protid_t file;
892
893#if TypeCheck1
894 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
895 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
896 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
897#endif /* TypeCheck */
898
899 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
900 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
901 else
902 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
903
904 OutP->RetCode = netfs_S_file_check_access(file, &OutP->allowed);
905 end_using_protid_port(file);
906 if (OutP->RetCode != KERN_SUCCESS0)
907 return;
908
909 OutP->Head.msgh_size = 40;
910
911 OutP->allowedType = allowedType;
912}
913
914/* Default implementation of netfs_S_file_check_access */
915#ifdef MIG_EOPNOTSUPP
916kern_return_t __attribute__ ((weak))
917netfs_S_file_check_access
918(
919 protid_t file,
920 int *allowed
921) { return MIG_EOPNOTSUPP; }
922#endif /* MIG_EOPNOTSUPP */
923
924/* Routine file_notice_changes */
925mig_internalstatic void _Xfile_notice_changes
926 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
927{
928 typedef struct {
929 mach_msg_header_t Head;
930 mach_msg_type_t portType;
931 mach_port_t port;
932 } Request;
933
934 typedef struct {
935 mach_msg_header_t Head;
936 mach_msg_type_t RetCodeType;
937 kern_return_t RetCode;
938 } Reply;
939
940 Request *In0P = (Request *) InHeadP;
941 Reply *OutP = (Reply *) OutHeadP;
942 mig_external kern_return_t netfs_S_file_notice_changes
943 (protid_t file, mach_port_t port);
944
945 const mach_msg_type_t portCheck = {
946 /* msgt_name = */ 17,
947 /* msgt_size = */ 32,
948 /* msgt_number = */ 1,
949 /* msgt_inline = */ TRUE((boolean_t) 1),
950 /* msgt_longform = */ FALSE((boolean_t) 0),
951 /* msgt_deallocate = */ FALSE((boolean_t) 0),
952 /* msgt_unused = */ 0
953 };
954
955 protid_t file;
956
957#if TypeCheck1
958 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
959 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
960 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
961#endif /* TypeCheck */
962
963#if TypeCheck1
964 if (BAD_TYPECHECK(&In0P->portType, &portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->portType); _c.t = *(&
portCheck);_t.w != _c.w; })), 0)
)
965 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
966#endif /* TypeCheck */
967
968 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
969 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
970 else
971 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
972
973 OutP->RetCode = netfs_S_file_notice_changes(file, In0P->port);
974 end_using_protid_port(file);
975}
976
977/* Default implementation of netfs_S_file_notice_changes */
978#ifdef MIG_EOPNOTSUPP
979kern_return_t __attribute__ ((weak))
980netfs_S_file_notice_changes
981(
982 protid_t file,
983 mach_port_t port
984) { return MIG_EOPNOTSUPP; }
985#endif /* MIG_EOPNOTSUPP */
986
987/* Routine file_getcontrol */
988mig_internalstatic void _Xfile_getcontrol
989 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
990{
991 typedef struct {
992 mach_msg_header_t Head;
993 } Request;
994
995 typedef struct {
996 mach_msg_header_t Head;
997 mach_msg_type_t RetCodeType;
998 kern_return_t RetCode;
999 mach_msg_type_t controlType;
1000 mach_port_t control;
1001 } Reply;
1002
1003 Request *In0P = (Request *) InHeadP;
1004 Reply *OutP = (Reply *) OutHeadP;
1005 mig_external kern_return_t netfs_S_file_getcontrol
1006 (protid_t file, mach_port_t *control, mach_msg_type_name_t *controlPoly);
1007
1008 boolean_t msgh_simple = msgh_simple;
1009 const mach_msg_type_t controlType = {
1010 /* msgt_name = */ -1,
1011 /* msgt_size = */ 32,
1012 /* msgt_number = */ 1,
1013 /* msgt_inline = */ TRUE((boolean_t) 1),
1014 /* msgt_longform = */ FALSE((boolean_t) 0),
1015 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1016 /* msgt_unused = */ 0
1017 };
1018
1019 protid_t file;
1020 mach_msg_type_name_t controlPoly;
1021
1022#if TypeCheck1
1023 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1024 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1025 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1026#endif /* TypeCheck */
1027
1028 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1029 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1030 else
1031 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1032
1033 OutP->RetCode = netfs_S_file_getcontrol(file, &OutP->control, &controlPoly);
1034 end_using_protid_port(file);
1035 if (OutP->RetCode != KERN_SUCCESS0)
1036 return;
1037
1038 msgh_simple = TRUE((boolean_t) 1);
1039 OutP->Head.msgh_size = 40;
1040
1041 OutP->controlType = controlType;
1042
1043 if (MACH_MSG_TYPE_PORT_ANY(controlPoly)(((controlPoly) >= 16) && ((controlPoly) <= 21)
)
)
1044 msgh_simple = FALSE((boolean_t) 0);
1045
1046 OutP->controlType.msgt_name = controlPoly;
1047
1048 if (!msgh_simple)
1049 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1050}
1051
1052/* Default implementation of netfs_S_file_getcontrol */
1053#ifdef MIG_EOPNOTSUPP
1054kern_return_t __attribute__ ((weak))
1055netfs_S_file_getcontrol
1056(
1057 protid_t file,
1058 mach_port_t *control,
1059 mach_msg_type_name_t *controlPoly
1060) { return MIG_EOPNOTSUPP; }
1061#endif /* MIG_EOPNOTSUPP */
1062
1063/* Routine file_statfs */
1064mig_internalstatic void _Xfile_statfs
1065 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1066{
1067 typedef struct {
1068 mach_msg_header_t Head;
1069 } Request;
1070
1071 typedef struct {
1072 mach_msg_header_t Head;
1073 mach_msg_type_t RetCodeType;
1074 kern_return_t RetCode;
1075 mach_msg_type_t infoType;
1076 fsys_statfsbuf_t info;
1077 } Reply;
1078
1079 Request *In0P = (Request *) InHeadP;
1080 Reply *OutP = (Reply *) OutHeadP;
1081 mig_external kern_return_t netfs_S_file_statfs
1082 (protid_t file, fsys_statfsbuf_t *info);
1083
1084 const mach_msg_type_t infoType = {
1085 /* msgt_name = */ 2,
1086 /* msgt_size = */ 32,
1087 /* msgt_number = */ 22,
1088 /* msgt_inline = */ TRUE((boolean_t) 1),
1089 /* msgt_longform = */ FALSE((boolean_t) 0),
1090 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1091 /* msgt_unused = */ 0
1092 };
1093
1094 protid_t file;
1095
1096#if TypeCheck1
1097 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1098 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1099 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1100#endif /* TypeCheck */
1101
1102 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1103 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1104 else
1105 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1106
1107 OutP->RetCode = netfs_S_file_statfs(file, &OutP->info);
1108 end_using_protid_port(file);
1109 if (OutP->RetCode != KERN_SUCCESS0)
1110 return;
1111
1112 OutP->Head.msgh_size = 124;
1113
1114 OutP->infoType = infoType;
1115}
1116
1117/* Default implementation of netfs_S_file_statfs */
1118#ifdef MIG_EOPNOTSUPP
1119kern_return_t __attribute__ ((weak))
1120netfs_S_file_statfs
1121(
1122 protid_t file,
1123 fsys_statfsbuf_t *info
1124) { return MIG_EOPNOTSUPP; }
1125#endif /* MIG_EOPNOTSUPP */
1126
1127/* Routine file_sync */
1128mig_internalstatic void _Xfile_sync
1129 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1130{
1131 typedef struct {
1132 mach_msg_header_t Head;
1133 mach_msg_type_t waitType;
1134 int wait;
1135 mach_msg_type_t omit_metadataType;
1136 int omit_metadata;
1137 } Request;
1138
1139 typedef struct {
1140 mach_msg_header_t Head;
1141 mach_msg_type_t RetCodeType;
1142 kern_return_t RetCode;
1143 } Reply;
1144
1145 Request *In0P = (Request *) InHeadP;
1146 Reply *OutP = (Reply *) OutHeadP;
1147 mig_external kern_return_t netfs_S_file_sync
1148 (protid_t file, int wait, int omit_metadata);
1149
1150 const mach_msg_type_t waitCheck = {
1151 /* msgt_name = */ 2,
1152 /* msgt_size = */ 32,
1153 /* msgt_number = */ 1,
1154 /* msgt_inline = */ TRUE((boolean_t) 1),
1155 /* msgt_longform = */ FALSE((boolean_t) 0),
1156 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1157 /* msgt_unused = */ 0
1158 };
1159
1160 const mach_msg_type_t omit_metadataCheck = {
1161 /* msgt_name = */ 2,
1162 /* msgt_size = */ 32,
1163 /* msgt_number = */ 1,
1164 /* msgt_inline = */ TRUE((boolean_t) 1),
1165 /* msgt_longform = */ FALSE((boolean_t) 0),
1166 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1167 /* msgt_unused = */ 0
1168 };
1169
1170 protid_t file;
1171
1172#if TypeCheck1
1173 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1174 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1175 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1176#endif /* TypeCheck */
1177
1178#if TypeCheck1
1179 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)
)
1180 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1181#endif /* TypeCheck */
1182
1183#if TypeCheck1
1184 if (BAD_TYPECHECK(&In0P->omit_metadataType, &omit_metadataCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->omit_metadataType); _c.t
= *(&omit_metadataCheck);_t.w != _c.w; })), 0)
)
1185 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1186#endif /* TypeCheck */
1187
1188 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1189 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1190 else
1191 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1192
1193 OutP->RetCode = netfs_S_file_sync(file, In0P->wait, In0P->omit_metadata);
1194 end_using_protid_port(file);
1195}
1196
1197/* Default implementation of netfs_S_file_sync */
1198#ifdef MIG_EOPNOTSUPP
1199kern_return_t __attribute__ ((weak))
1200netfs_S_file_sync
1201(
1202 protid_t file,
1203 int wait,
1204 int omit_metadata
1205) { return MIG_EOPNOTSUPP; }
1206#endif /* MIG_EOPNOTSUPP */
1207
1208/* Routine file_syncfs */
1209mig_internalstatic void _Xfile_syncfs
1210 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1211{
1212 typedef struct {
1213 mach_msg_header_t Head;
1214 mach_msg_type_t waitType;
1215 int wait;
1216 mach_msg_type_t do_childrenType;
1217 int do_children;
1218 } Request;
1219
1220 typedef struct {
1221 mach_msg_header_t Head;
1222 mach_msg_type_t RetCodeType;
1223 kern_return_t RetCode;
1224 } Reply;
1225
1226 Request *In0P = (Request *) InHeadP;
1227 Reply *OutP = (Reply *) OutHeadP;
1228 mig_external kern_return_t netfs_S_file_syncfs
1229 (protid_t file, int wait, int do_children);
1230
1231 const mach_msg_type_t waitCheck = {
1232 /* msgt_name = */ 2,
1233 /* msgt_size = */ 32,
1234 /* msgt_number = */ 1,
1235 /* msgt_inline = */ TRUE((boolean_t) 1),
1236 /* msgt_longform = */ FALSE((boolean_t) 0),
1237 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1238 /* msgt_unused = */ 0
1239 };
1240
1241 const mach_msg_type_t do_childrenCheck = {
1242 /* msgt_name = */ 2,
1243 /* msgt_size = */ 32,
1244 /* msgt_number = */ 1,
1245 /* msgt_inline = */ TRUE((boolean_t) 1),
1246 /* msgt_longform = */ FALSE((boolean_t) 0),
1247 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1248 /* msgt_unused = */ 0
1249 };
1250
1251 protid_t file;
1252
1253#if TypeCheck1
1254 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1255 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1256 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1257#endif /* TypeCheck */
1258
1259#if TypeCheck1
1260 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)
)
1261 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1262#endif /* TypeCheck */
1263
1264#if TypeCheck1
1265 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)
)
1266 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1267#endif /* TypeCheck */
1268
1269 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1270 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1271 else
1272 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1273
1274 OutP->RetCode = netfs_S_file_syncfs(file, In0P->wait, In0P->do_children);
1275 end_using_protid_port(file);
1276}
1277
1278/* Default implementation of netfs_S_file_syncfs */
1279#ifdef MIG_EOPNOTSUPP
1280kern_return_t __attribute__ ((weak))
1281netfs_S_file_syncfs
1282(
1283 protid_t file,
1284 int wait,
1285 int do_children
1286) { return MIG_EOPNOTSUPP; }
1287#endif /* MIG_EOPNOTSUPP */
1288
1289/* Routine file_get_storage_info */
1290mig_internalstatic void _Xfile_get_storage_info
1291 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1292{
1293 typedef struct {
1294 mach_msg_header_t Head;
1295 } Request;
1296
1297 typedef struct {
1298 mach_msg_header_t Head;
1299 mach_msg_type_t RetCodeType;
1300 kern_return_t RetCode;
1301 mach_msg_type_long_t portsType;
1302 mach_port_t ports[512];
1303 mach_msg_type_long_t intsType;
1304 int ints[512];
1305 mach_msg_type_long_t offsetsType;
1306 loff_t offsets[256];
1307 mach_msg_type_long_t dataType;
1308 char data[2048];
1309 } Reply;
1310
1311 Request *In0P = (Request *) InHeadP;
1312 Reply *OutP = (Reply *) OutHeadP;
1313 mig_external kern_return_t netfs_S_file_get_storage_info
1314 (protid_t file, portarray_t *ports, mach_msg_type_name_t *portsPoly, mach_msg_type_number_t *portsCnt, intarray_t *ints, mach_msg_type_number_t *intsCnt, off_array_t *offsets, mach_msg_type_number_t *offsetsCnt, data_t *data, mach_msg_type_number_t *dataCnt);
1315
1316 boolean_t msgh_simple = msgh_simple;
1317 unsigned int msgh_size;
1318 unsigned int msgh_size_delta;
1319
1320 const mach_msg_type_long_t portsType = {
1321 {
1322 /* msgt_name = */ 0,
1323 /* msgt_size = */ 0,
1324 /* msgt_number = */ 0,
1325 /* msgt_inline = */ TRUE((boolean_t) 1),
1326 /* msgt_longform = */ TRUE((boolean_t) 1),
1327 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1328 /* msgt_unused = */ 0
1329 },
1330 /* msgtl_name = */ -1,
1331 /* msgtl_size = */ 32,
1332 /* msgtl_number = */ 512,
1333 };
1334
1335 const mach_msg_type_long_t intsType = {
1336 {
1337 /* msgt_name = */ 0,
1338 /* msgt_size = */ 0,
1339 /* msgt_number = */ 0,
1340 /* msgt_inline = */ TRUE((boolean_t) 1),
1341 /* msgt_longform = */ TRUE((boolean_t) 1),
1342 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1343 /* msgt_unused = */ 0
1344 },
1345 /* msgtl_name = */ 2,
1346 /* msgtl_size = */ 32,
1347 /* msgtl_number = */ 512,
1348 };
1349
1350 const mach_msg_type_long_t offsetsType = {
1351 {
1352 /* msgt_name = */ 0,
1353 /* msgt_size = */ 0,
1354 /* msgt_number = */ 0,
1355 /* msgt_inline = */ TRUE((boolean_t) 1),
1356 /* msgt_longform = */ TRUE((boolean_t) 1),
1357 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1358 /* msgt_unused = */ 0
1359 },
1360 /* msgtl_name = */ 11,
1361 /* msgtl_size = */ 64,
1362 /* msgtl_number = */ 256,
1363 };
1364
1365 const mach_msg_type_long_t dataType = {
1366 {
1367 /* msgt_name = */ 0,
1368 /* msgt_size = */ 0,
1369 /* msgt_number = */ 0,
1370 /* msgt_inline = */ TRUE((boolean_t) 1),
1371 /* msgt_longform = */ TRUE((boolean_t) 1),
1372 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1373 /* msgt_unused = */ 0
1374 },
1375 /* msgtl_name = */ 8,
1376 /* msgtl_size = */ 8,
1377 /* msgtl_number = */ 2048,
1378 };
1379
1380 protid_t file;
1381 mach_msg_type_name_t portsPoly;
1382 mach_msg_type_number_t portsCnt;
1383 int ints[512];
1384 mach_msg_type_number_t intsCnt;
1385 loff_t offsets[256];
1386 mach_msg_type_number_t offsetsCnt;
1387 char data[2048];
1388 mach_msg_type_number_t dataCnt;
1389
1390 mach_port_t *portsP;
1391 int *intsP;
1392 loff_t *offsetsP;
1393 char *dataP;
1394
1395#if TypeCheck1
1396 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1397 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1398 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1399#endif /* TypeCheck */
1400
1401 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1402 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1403 else
1404 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1405
1406 portsP = OutP->ports;
1407 portsCnt = 512;
1408
1409 intsP = ints;
1410 intsCnt = 512;
1411
1412 offsetsP = offsets;
1413 offsetsCnt = 256;
1414
1415 dataP = data;
1416 dataCnt = 2048;
1417
1418 OutP->RetCode = netfs_S_file_get_storage_info(file, &portsP, &portsPoly, &portsCnt, &intsP, &intsCnt, &offsetsP, &offsetsCnt, &dataP, &dataCnt);
1419 end_using_protid_port(file);
1420 if (OutP->RetCode != KERN_SUCCESS0)
1421 return;
1422
1423 msgh_simple = TRUE((boolean_t) 1);
1424
1425 OutP->portsType = portsType;
1426 if (portsP != OutP->ports) {
1427 OutP->portsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1428 OutP->portsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1429 *((mach_port_t **)OutP->ports) = portsP;
1430 msgh_simple = FALSE((boolean_t) 0);
1431 }
1432
1433 if (MACH_MSG_TYPE_PORT_ANY(portsPoly)(((portsPoly) >= 16) && ((portsPoly) <= 21)))
1434 msgh_simple = FALSE((boolean_t) 0);
1435
1436 OutP->portsType.msgtl_name = portsPoly;
1437
1438 OutP->portsType.msgtl_number = portsCnt;
1439 msgh_size_delta = (OutP->portsType.msgtl_header.msgt_inline) ? 4 * portsCnt : sizeof(mach_port_t *);
1440 msgh_size = 80 + msgh_size_delta;
1441 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048);
1442
1443 OutP->intsType = intsType;
1444
1445 if (intsP != ints) {
1446 OutP->intsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1447 OutP->intsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1448 *((int **)OutP->ints) = intsP;
1449 msgh_simple = FALSE((boolean_t) 0);
1450 }
1451 else {
1452 memcpy(OutP->ints, ints, 4 * intsCnt);
1453 }
1454
1455 OutP->intsType.msgtl_number = intsCnt;
1456 msgh_size_delta = (OutP->intsType.msgtl_header.msgt_inline) ? 4 * intsCnt : sizeof(int *);
1457 msgh_size += msgh_size_delta;
1458 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048);
1459
1460 OutP->offsetsType = offsetsType;
1461
1462 if (offsetsP != offsets) {
1463 OutP->offsetsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1464 OutP->offsetsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1465 *((loff_t **)OutP->offsets) = offsetsP;
1466 msgh_simple = FALSE((boolean_t) 0);
1467 }
1468 else {
1469 memcpy(OutP->offsets, offsets, 8 * offsetsCnt);
1470 }
1471
1472 OutP->offsetsType.msgtl_number = offsetsCnt;
1473 msgh_size_delta = (OutP->offsetsType.msgtl_header.msgt_inline) ? 8 * offsetsCnt : sizeof(loff_t *);
1474 msgh_size += msgh_size_delta;
1475 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048);
1476
1477 OutP->dataType = dataType;
1478
1479 if (dataP != data) {
1480 OutP->dataType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1481 OutP->dataType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1482 *((char **)OutP->data) = dataP;
1483 msgh_simple = FALSE((boolean_t) 0);
1484 }
1485 else {
1486 memcpy(OutP->data, data, dataCnt);
1487 }
1488
1489 OutP->dataType.msgtl_number = dataCnt;
1490 msgh_size += (OutP->dataType.msgtl_header.msgt_inline) ? (dataCnt + 3) & ~3 : sizeof(char *);
1491
1492 OutP = (Reply *) OutHeadP;
1493 if (!msgh_simple)
1494 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1495 OutP->Head.msgh_size = msgh_size;
1496}
1497
1498/* Default implementation of netfs_S_file_get_storage_info */
1499#ifdef MIG_EOPNOTSUPP
1500kern_return_t __attribute__ ((weak))
1501netfs_S_file_get_storage_info
1502(
1503 protid_t file,
1504 portarray_t *ports,
1505 mach_msg_type_name_t *portsPoly,
1506 mach_msg_type_number_t *portsCnt,
1507 intarray_t *ints,
1508 mach_msg_type_number_t *intsCnt,
1509 off_array_t *offsets,
1510 mach_msg_type_number_t *offsetsCnt,
1511 data_t *data,
1512 mach_msg_type_number_t *dataCnt
1513) { return MIG_EOPNOTSUPP; }
1514#endif /* MIG_EOPNOTSUPP */
1515
1516/* Routine file_getlinknode */
1517mig_internalstatic void _Xfile_getlinknode
1518 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1519{
1520 typedef struct {
1521 mach_msg_header_t Head;
1522 } Request;
1523
1524 typedef struct {
1525 mach_msg_header_t Head;
1526 mach_msg_type_t RetCodeType;
1527 kern_return_t RetCode;
1528 mach_msg_type_t linknodeType;
1529 mach_port_t linknode;
1530 } Reply;
1531
1532 Request *In0P = (Request *) InHeadP;
1533 Reply *OutP = (Reply *) OutHeadP;
1534 mig_external kern_return_t netfs_S_file_getlinknode
1535 (protid_t file, mach_port_t *linknode, mach_msg_type_name_t *linknodePoly);
1536
1537 boolean_t msgh_simple = msgh_simple;
1538 const mach_msg_type_t linknodeType = {
1539 /* msgt_name = */ -1,
1540 /* msgt_size = */ 32,
1541 /* msgt_number = */ 1,
1542 /* msgt_inline = */ TRUE((boolean_t) 1),
1543 /* msgt_longform = */ FALSE((boolean_t) 0),
1544 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1545 /* msgt_unused = */ 0
1546 };
1547
1548 protid_t file;
1549 mach_msg_type_name_t linknodePoly;
1550
1551#if TypeCheck1
1552 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1553 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1554 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1555#endif /* TypeCheck */
1556
1557 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1558 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1559 else
1560 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1561
1562 OutP->RetCode = netfs_S_file_getlinknode(file, &OutP->linknode, &linknodePoly);
1563 end_using_protid_port(file);
1564 if (OutP->RetCode != KERN_SUCCESS0)
1565 return;
1566
1567 msgh_simple = TRUE((boolean_t) 1);
1568 OutP->Head.msgh_size = 40;
1569
1570 OutP->linknodeType = linknodeType;
1571
1572 if (MACH_MSG_TYPE_PORT_ANY(linknodePoly)(((linknodePoly) >= 16) && ((linknodePoly) <= 21
))
)
1573 msgh_simple = FALSE((boolean_t) 0);
1574
1575 OutP->linknodeType.msgt_name = linknodePoly;
1576
1577 if (!msgh_simple)
1578 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1579}
1580
1581/* Default implementation of netfs_S_file_getlinknode */
1582#ifdef MIG_EOPNOTSUPP
1583kern_return_t __attribute__ ((weak))
1584netfs_S_file_getlinknode
1585(
1586 protid_t file,
1587 mach_port_t *linknode,
1588 mach_msg_type_name_t *linknodePoly
1589) { return MIG_EOPNOTSUPP; }
1590#endif /* MIG_EOPNOTSUPP */
1591
1592/* Routine file_getfh */
1593mig_internalstatic void _Xfile_getfh
1594 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1595{
1596 typedef struct {
1597 mach_msg_header_t Head;
1598 } Request;
1599
1600 typedef struct {
1601 mach_msg_header_t Head;
1602 mach_msg_type_t RetCodeType;
1603 kern_return_t RetCode;
1604 mach_msg_type_long_t filehandleType;
1605 char filehandle[2048];
1606 } Reply;
1607
1608 Request *In0P = (Request *) InHeadP;
1609 Reply *OutP = (Reply *) OutHeadP;
1610 mig_external kern_return_t netfs_S_file_getfh
1611 (protid_t file, data_t *filehandle, mach_msg_type_number_t *filehandleCnt);
1612
1613 boolean_t msgh_simple = msgh_simple;
1614 const mach_msg_type_long_t filehandleType = {
1615 {
1616 /* msgt_name = */ 0,
1617 /* msgt_size = */ 0,
1618 /* msgt_number = */ 0,
1619 /* msgt_inline = */ TRUE((boolean_t) 1),
1620 /* msgt_longform = */ TRUE((boolean_t) 1),
1621 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1622 /* msgt_unused = */ 0
1623 },
1624 /* msgtl_name = */ 8,
1625 /* msgtl_size = */ 8,
1626 /* msgtl_number = */ 2048,
1627 };
1628
1629 protid_t file;
1630 mach_msg_type_number_t filehandleCnt;
1631
1632 char *filehandleP;
1633
1634#if TypeCheck1
1635 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1636 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1637 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1638#endif /* TypeCheck */
1639
1640 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1641 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1642 else
1643 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1644
1645 filehandleP = OutP->filehandle;
1646 filehandleCnt = 2048;
1647
1648 OutP->RetCode = netfs_S_file_getfh(file, &filehandleP, &filehandleCnt);
1649 end_using_protid_port(file);
1650 if (OutP->RetCode != KERN_SUCCESS0)
1651 return;
1652
1653 msgh_simple = TRUE((boolean_t) 1);
1654
1655 OutP->filehandleType = filehandleType;
1656 if (filehandleP != OutP->filehandle) {
1657 OutP->filehandleType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1658 OutP->filehandleType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1659 *((char **)OutP->filehandle) = filehandleP;
1660 msgh_simple = FALSE((boolean_t) 0);
1661 }
1662
1663 OutP->filehandleType.msgtl_number = filehandleCnt;
1664 OutP->Head.msgh_size = 44 + ((OutP->filehandleType.msgtl_header.msgt_inline) ? (filehandleCnt + 3) & ~3 : sizeof(char *));
1665
1666 if (!msgh_simple)
1667 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1668}
1669
1670/* Default implementation of netfs_S_file_getfh */
1671#ifdef MIG_EOPNOTSUPP
1672kern_return_t __attribute__ ((weak))
1673netfs_S_file_getfh
1674(
1675 protid_t file,
1676 data_t *filehandle,
1677 mach_msg_type_number_t *filehandleCnt
1678) { return MIG_EOPNOTSUPP; }
1679#endif /* MIG_EOPNOTSUPP */
1680
1681/* Routine dir_lookup */
1682mig_internalstatic void _Xdir_lookup
1683 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1684{
1685 typedef struct {
1686 mach_msg_header_t Head;
1687 mach_msg_type_t file_nameType;
1688 string_t file_name;
1689 mach_msg_type_t flagsType;
1690 int flags;
1691 mach_msg_type_t modeType;
1692 mode_t mode;
1693 } Request;
1694
1695 typedef struct {
1696 mach_msg_header_t Head;
1697 mach_msg_type_t RetCodeType;
1698 kern_return_t RetCode;
1699 mach_msg_type_t do_retryType;
1700 retry_type do_retry;
1701 mach_msg_type_t retry_nameType;
1702 string_t retry_name;
1703 mach_msg_type_t resultType;
1704 mach_port_t result;
1705 } Reply;
1706
1707 Request *In0P = (Request *) InHeadP;
1708 Reply *OutP = (Reply *) OutHeadP;
1709 mig_external kern_return_t netfs_S_dir_lookup
1710 (protid_t start_dir, string_t file_name, int flags, mode_t mode, retry_type *do_retry, string_t retry_name, mach_port_t *result, mach_msg_type_name_t *resultPoly);
1711
1712 boolean_t msgh_simple = msgh_simple;
1713 const mach_msg_type_t file_nameCheck = {
1714 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
1715 /* msgt_size = */ 8,
1716 /* msgt_number = */ 1024,
1717 /* msgt_inline = */ TRUE((boolean_t) 1),
1718 /* msgt_longform = */ FALSE((boolean_t) 0),
1719 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1720 /* msgt_unused = */ 0
1721 };
1722
1723 const mach_msg_type_t flagsCheck = {
1724 /* msgt_name = */ 2,
1725 /* msgt_size = */ 32,
1726 /* msgt_number = */ 1,
1727 /* msgt_inline = */ TRUE((boolean_t) 1),
1728 /* msgt_longform = */ FALSE((boolean_t) 0),
1729 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1730 /* msgt_unused = */ 0
1731 };
1732
1733 const mach_msg_type_t modeCheck = {
1734 /* msgt_name = */ 2,
1735 /* msgt_size = */ 32,
1736 /* msgt_number = */ 1,
1737 /* msgt_inline = */ TRUE((boolean_t) 1),
1738 /* msgt_longform = */ FALSE((boolean_t) 0),
1739 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1740 /* msgt_unused = */ 0
1741 };
1742
1743 const mach_msg_type_t do_retryType = {
1744 /* msgt_name = */ 2,
1745 /* msgt_size = */ 32,
1746 /* msgt_number = */ 1,
1747 /* msgt_inline = */ TRUE((boolean_t) 1),
1748 /* msgt_longform = */ FALSE((boolean_t) 0),
1749 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1750 /* msgt_unused = */ 0
1751 };
1752
1753 const mach_msg_type_t retry_nameType = {
1754 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
1755 /* msgt_size = */ 8,
1756 /* msgt_number = */ 1024,
1757 /* msgt_inline = */ TRUE((boolean_t) 1),
1758 /* msgt_longform = */ FALSE((boolean_t) 0),
1759 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1760 /* msgt_unused = */ 0
1761 };
1762
1763 const mach_msg_type_t resultType = {
1764 /* msgt_name = */ -1,
1765 /* msgt_size = */ 32,
1766 /* msgt_number = */ 1,
1767 /* msgt_inline = */ TRUE((boolean_t) 1),
1768 /* msgt_longform = */ FALSE((boolean_t) 0),
1769 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1770 /* msgt_unused = */ 0
1771 };
1772
1773 protid_t start_dir;
1774 mach_msg_type_name_t resultPoly;
1775
1776#if TypeCheck1
1777 if (mig_unlikely ((In0P->Head.msgh_size != 1068) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1068) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1778 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1068) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1779 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1780#endif /* TypeCheck */
1781
1782#if TypeCheck1
1783 if (BAD_TYPECHECK(&In0P->file_nameType, &file_nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->file_nameType); _c.t = *
(&file_nameCheck);_t.w != _c.w; })), 0)
)
1784 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1785#endif /* TypeCheck */
1786
1787#if TypeCheck1
1788 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)
)
1789 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1790#endif /* TypeCheck */
1791
1792#if TypeCheck1
1793 if (BAD_TYPECHECK(&In0P->modeType, &modeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->modeType); _c.t = *(&
modeCheck);_t.w != _c.w; })), 0)
)
1794 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1795#endif /* TypeCheck */
1796
1797 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1798 start_dir = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1799 else
1800 start_dir = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1801
1802 OutP->RetCode = netfs_S_dir_lookup(start_dir, In0P->file_name, In0P->flags, In0P->mode, &OutP->do_retry, OutP->retry_name, &OutP->result, &resultPoly);
1803 end_using_protid_port(start_dir);
1804 if (OutP->RetCode != KERN_SUCCESS0)
1805 return;
1806
1807 msgh_simple = TRUE((boolean_t) 1);
1808 OutP->Head.msgh_size = 1076;
1809
1810 OutP->do_retryType = do_retryType;
1811
1812 OutP->retry_nameType = retry_nameType;
1813
1814 OutP->resultType = resultType;
1815
1816 if (MACH_MSG_TYPE_PORT_ANY(resultPoly)(((resultPoly) >= 16) && ((resultPoly) <= 21)))
1817 msgh_simple = FALSE((boolean_t) 0);
1818
1819 OutP->resultType.msgt_name = resultPoly;
1820
1821 if (!msgh_simple)
1822 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1823}
1824
1825/* Default implementation of netfs_S_dir_lookup */
1826#ifdef MIG_EOPNOTSUPP
1827kern_return_t __attribute__ ((weak))
1828netfs_S_dir_lookup
1829(
1830 protid_t start_dir,
1831 string_t file_name,
1832 int flags,
1833 mode_t mode,
1834 retry_type *do_retry,
1835 string_t retry_name,
1836 mach_port_t *result,
1837 mach_msg_type_name_t *resultPoly
1838) { return MIG_EOPNOTSUPP; }
1839#endif /* MIG_EOPNOTSUPP */
1840
1841/* Routine dir_readdir */
1842mig_internalstatic void _Xdir_readdir
1843 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1844{
1845 typedef struct {
1846 mach_msg_header_t Head;
1847 mach_msg_type_t entryType;
1848 int entry;
1849 mach_msg_type_t nentriesType;
1850 int nentries;
1851 mach_msg_type_t bufsizType;
1852 vm_size_t bufsiz;
1853 } Request;
1854
1855 typedef struct {
1856 mach_msg_header_t Head;
1857 mach_msg_type_t RetCodeType;
1858 kern_return_t RetCode;
1859 mach_msg_type_long_t dataType;
1860 char data[2048];
1861 mach_msg_type_t amountType;
1862 int amount;
1863 } Reply;
1864
1865 Request *In0P = (Request *) InHeadP;
1866 Reply *OutP = (Reply *) OutHeadP;
1867 mig_external kern_return_t netfs_S_dir_readdir
1868 (protid_t dir, data_t *data, mach_msg_type_number_t *dataCnt, boolean_t *dataDealloc, int entry, int nentries, vm_size_t bufsiz, int *amount);
1869
1870 boolean_t msgh_simple = msgh_simple;
1871 unsigned int msgh_size_delta;
1872
1873 const mach_msg_type_t entryCheck = {
1874 /* msgt_name = */ 2,
1875 /* msgt_size = */ 32,
1876 /* msgt_number = */ 1,
1877 /* msgt_inline = */ TRUE((boolean_t) 1),
1878 /* msgt_longform = */ FALSE((boolean_t) 0),
1879 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1880 /* msgt_unused = */ 0
1881 };
1882
1883 const mach_msg_type_t nentriesCheck = {
1884 /* msgt_name = */ 2,
1885 /* msgt_size = */ 32,
1886 /* msgt_number = */ 1,
1887 /* msgt_inline = */ TRUE((boolean_t) 1),
1888 /* msgt_longform = */ FALSE((boolean_t) 0),
1889 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1890 /* msgt_unused = */ 0
1891 };
1892
1893 const mach_msg_type_t bufsizCheck = {
1894 /* msgt_name = */ 2,
1895 /* msgt_size = */ 32,
1896 /* msgt_number = */ 1,
1897 /* msgt_inline = */ TRUE((boolean_t) 1),
1898 /* msgt_longform = */ FALSE((boolean_t) 0),
1899 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1900 /* msgt_unused = */ 0
1901 };
1902
1903 const mach_msg_type_long_t dataType = {
1904 {
1905 /* msgt_name = */ 0,
1906 /* msgt_size = */ 0,
1907 /* msgt_number = */ 0,
1908 /* msgt_inline = */ TRUE((boolean_t) 1),
1909 /* msgt_longform = */ TRUE((boolean_t) 1),
1910 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1911 /* msgt_unused = */ 0
1912 },
1913 /* msgtl_name = */ 8,
1914 /* msgtl_size = */ 8,
1915 /* msgtl_number = */ 2048,
1916 };
1917
1918 const mach_msg_type_t amountType = {
1919 /* msgt_name = */ 2,
1920 /* msgt_size = */ 32,
1921 /* msgt_number = */ 1,
1922 /* msgt_inline = */ TRUE((boolean_t) 1),
1923 /* msgt_longform = */ FALSE((boolean_t) 0),
1924 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1925 /* msgt_unused = */ 0
1926 };
1927
1928 protid_t dir;
1929 mach_msg_type_number_t dataCnt;
1930 boolean_t dataDealloc;
1931 int amount;
1932
1933 char *dataP;
1934
1935#if TypeCheck1
1936 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1937 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1938 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1939#endif /* TypeCheck */
1940
1941#if TypeCheck1
1942 if (BAD_TYPECHECK(&In0P->entryType, &entryCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->entryType); _c.t = *(&
entryCheck);_t.w != _c.w; })), 0)
)
1943 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1944#endif /* TypeCheck */
1945
1946#if TypeCheck1
1947 if (BAD_TYPECHECK(&In0P->nentriesType, &nentriesCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nentriesType); _c.t = *(
&nentriesCheck);_t.w != _c.w; })), 0)
)
1948 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1949#endif /* TypeCheck */
1950
1951#if TypeCheck1
1952 if (BAD_TYPECHECK(&In0P->bufsizType, &bufsizCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->bufsizType); _c.t = *(&
bufsizCheck);_t.w != _c.w; })), 0)
)
1953 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1954#endif /* TypeCheck */
1955
1956 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
1957 dir = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
1958 else
1959 dir = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
1960
1961 dataP = OutP->data;
1962 dataCnt = 2048;
1963
1964 OutP->RetCode = netfs_S_dir_readdir(dir, &dataP, &dataCnt, &dataDealloc, In0P->entry, In0P->nentries, In0P->bufsiz, &amount);
1965 end_using_protid_port(dir);
1966 if (OutP->RetCode != KERN_SUCCESS0)
1967 return;
1968
1969 msgh_simple = TRUE((boolean_t) 1);
1970
1971 OutP->dataType = dataType;
1972 if (dataP != OutP->data) {
1973 OutP->dataType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1974 OutP->dataType.msgtl_header.msgt_deallocate = dataDealloc;
1975 *((char **)OutP->data) = dataP;
1976 msgh_simple = FALSE((boolean_t) 0);
1977 }
1978
1979 OutP->dataType.msgtl_number = dataCnt;
1980 msgh_size_delta = (OutP->dataType.msgtl_header.msgt_inline) ? (dataCnt + 3) & ~3 : sizeof(char *);
1981 OutP->Head.msgh_size = 52 + msgh_size_delta;
1982 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048);
1983
1984 OutP->amountType = amountType;
1985
1986 OutP->amount = amount;
1987
1988 OutP = (Reply *) OutHeadP;
1989 if (!msgh_simple)
1990 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1991}
1992
1993/* Default implementation of netfs_S_dir_readdir */
1994#ifdef MIG_EOPNOTSUPP
1995kern_return_t __attribute__ ((weak))
1996netfs_S_dir_readdir
1997(
1998 protid_t dir,
1999 data_t *data,
2000 mach_msg_type_number_t *dataCnt,
2001 boolean_t *dataDealloc,
2002 int entry,
2003 int nentries,
2004 vm_size_t bufsiz,
2005 int *amount
2006) { return MIG_EOPNOTSUPP; }
2007#endif /* MIG_EOPNOTSUPP */
2008
2009/* Routine dir_mkdir */
2010mig_internalstatic void _Xdir_mkdir
2011 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2012{
2013 typedef struct {
2014 mach_msg_header_t Head;
2015 mach_msg_type_t nameType;
2016 string_t name;
2017 mach_msg_type_t modeType;
2018 mode_t mode;
2019 } Request;
2020
2021 typedef struct {
2022 mach_msg_header_t Head;
2023 mach_msg_type_t RetCodeType;
2024 kern_return_t RetCode;
2025 } Reply;
2026
2027 Request *In0P = (Request *) InHeadP;
2028 Reply *OutP = (Reply *) OutHeadP;
2029 mig_external kern_return_t netfs_S_dir_mkdir
2030 (protid_t directory, string_t name, mode_t mode);
2031
2032 const mach_msg_type_t nameCheck = {
2033 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2034 /* msgt_size = */ 8,
2035 /* msgt_number = */ 1024,
2036 /* msgt_inline = */ TRUE((boolean_t) 1),
2037 /* msgt_longform = */ FALSE((boolean_t) 0),
2038 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2039 /* msgt_unused = */ 0
2040 };
2041
2042 const mach_msg_type_t modeCheck = {
2043 /* msgt_name = */ 2,
2044 /* msgt_size = */ 32,
2045 /* msgt_number = */ 1,
2046 /* msgt_inline = */ TRUE((boolean_t) 1),
2047 /* msgt_longform = */ FALSE((boolean_t) 0),
2048 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2049 /* msgt_unused = */ 0
2050 };
2051
2052 protid_t directory;
2053
2054#if TypeCheck1
2055 if (mig_unlikely ((In0P->Head.msgh_size != 1060) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1060) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2056 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1060) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2057 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2058#endif /* TypeCheck */
2059
2060#if TypeCheck1
2061 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
2062 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2063#endif /* TypeCheck */
2064
2065#if TypeCheck1
2066 if (BAD_TYPECHECK(&In0P->modeType, &modeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->modeType); _c.t = *(&
modeCheck);_t.w != _c.w; })), 0)
)
2067 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2068#endif /* TypeCheck */
2069
2070 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2071 directory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2072 else
2073 directory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2074
2075 OutP->RetCode = netfs_S_dir_mkdir(directory, In0P->name, In0P->mode);
2076 end_using_protid_port(directory);
2077}
2078
2079/* Default implementation of netfs_S_dir_mkdir */
2080#ifdef MIG_EOPNOTSUPP
2081kern_return_t __attribute__ ((weak))
2082netfs_S_dir_mkdir
2083(
2084 protid_t directory,
2085 string_t name,
2086 mode_t mode
2087) { return MIG_EOPNOTSUPP; }
2088#endif /* MIG_EOPNOTSUPP */
2089
2090/* Routine dir_rmdir */
2091mig_internalstatic void _Xdir_rmdir
2092 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2093{
2094 typedef struct {
2095 mach_msg_header_t Head;
2096 mach_msg_type_t nameType;
2097 string_t name;
2098 } Request;
2099
2100 typedef struct {
2101 mach_msg_header_t Head;
2102 mach_msg_type_t RetCodeType;
2103 kern_return_t RetCode;
2104 } Reply;
2105
2106 Request *In0P = (Request *) InHeadP;
2107 Reply *OutP = (Reply *) OutHeadP;
2108 mig_external kern_return_t netfs_S_dir_rmdir
2109 (protid_t directory, string_t name);
2110
2111 const mach_msg_type_t nameCheck = {
2112 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2113 /* msgt_size = */ 8,
2114 /* msgt_number = */ 1024,
2115 /* msgt_inline = */ TRUE((boolean_t) 1),
2116 /* msgt_longform = */ FALSE((boolean_t) 0),
2117 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2118 /* msgt_unused = */ 0
2119 };
2120
2121 protid_t directory;
2122
2123#if TypeCheck1
2124 if (mig_unlikely ((In0P->Head.msgh_size != 1052) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2125 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2126 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2127#endif /* TypeCheck */
2128
2129#if TypeCheck1
2130 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
2131 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2132#endif /* TypeCheck */
2133
2134 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2135 directory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2136 else
2137 directory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2138
2139 OutP->RetCode = netfs_S_dir_rmdir(directory, In0P->name);
2140 end_using_protid_port(directory);
2141}
2142
2143/* Default implementation of netfs_S_dir_rmdir */
2144#ifdef MIG_EOPNOTSUPP
2145kern_return_t __attribute__ ((weak))
2146netfs_S_dir_rmdir
2147(
2148 protid_t directory,
2149 string_t name
2150) { return MIG_EOPNOTSUPP; }
2151#endif /* MIG_EOPNOTSUPP */
2152
2153/* Routine dir_unlink */
2154mig_internalstatic void _Xdir_unlink
2155 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2156{
2157 typedef struct {
2158 mach_msg_header_t Head;
2159 mach_msg_type_t nameType;
2160 string_t name;
2161 } Request;
2162
2163 typedef struct {
2164 mach_msg_header_t Head;
2165 mach_msg_type_t RetCodeType;
2166 kern_return_t RetCode;
2167 } Reply;
2168
2169 Request *In0P = (Request *) InHeadP;
2170 Reply *OutP = (Reply *) OutHeadP;
2171 mig_external kern_return_t netfs_S_dir_unlink
2172 (protid_t directory, string_t name);
2173
2174 const mach_msg_type_t nameCheck = {
2175 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2176 /* msgt_size = */ 8,
2177 /* msgt_number = */ 1024,
2178 /* msgt_inline = */ TRUE((boolean_t) 1),
2179 /* msgt_longform = */ FALSE((boolean_t) 0),
2180 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2181 /* msgt_unused = */ 0
2182 };
2183
2184 protid_t directory;
2185
2186#if TypeCheck1
2187 if (mig_unlikely ((In0P->Head.msgh_size != 1052) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2188 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2189 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2190#endif /* TypeCheck */
2191
2192#if TypeCheck1
2193 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
2194 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2195#endif /* TypeCheck */
2196
2197 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2198 directory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2199 else
2200 directory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2201
2202 OutP->RetCode = netfs_S_dir_unlink(directory, In0P->name);
2203 end_using_protid_port(directory);
2204}
2205
2206/* Default implementation of netfs_S_dir_unlink */
2207#ifdef MIG_EOPNOTSUPP
2208kern_return_t __attribute__ ((weak))
2209netfs_S_dir_unlink
2210(
2211 protid_t directory,
2212 string_t name
2213) { return MIG_EOPNOTSUPP; }
2214#endif /* MIG_EOPNOTSUPP */
2215
2216/* Routine dir_link */
2217mig_internalstatic void _Xdir_link
2218 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2219{
2220 typedef struct {
2221 mach_msg_header_t Head;
2222 mach_msg_type_t fileType;
2223 file_t file;
2224 mach_msg_type_t nameType;
2225 string_t name;
2226 mach_msg_type_t exclType;
2227 int excl;
2228 } Request;
2229
2230 typedef struct {
2231 mach_msg_header_t Head;
2232 mach_msg_type_t RetCodeType;
2233 kern_return_t RetCode;
2234 } Reply;
2235
2236 Request *In0P = (Request *) InHeadP;
2237 Reply *OutP = (Reply *) OutHeadP;
2238 mig_external kern_return_t netfs_S_dir_link
2239 (protid_t dir, protid_t file, string_t name, int excl);
2240
2241 const mach_msg_type_t fileCheck = {
2242 /* msgt_name = */ 17,
2243 /* msgt_size = */ 32,
2244 /* msgt_number = */ 1,
2245 /* msgt_inline = */ TRUE((boolean_t) 1),
2246 /* msgt_longform = */ FALSE((boolean_t) 0),
2247 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2248 /* msgt_unused = */ 0
2249 };
2250
2251 const mach_msg_type_t nameCheck = {
2252 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2253 /* msgt_size = */ 8,
2254 /* msgt_number = */ 1024,
2255 /* msgt_inline = */ TRUE((boolean_t) 1),
2256 /* msgt_longform = */ FALSE((boolean_t) 0),
2257 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2258 /* msgt_unused = */ 0
2259 };
2260
2261 const mach_msg_type_t exclCheck = {
2262 /* msgt_name = */ 2,
2263 /* msgt_size = */ 32,
2264 /* msgt_number = */ 1,
2265 /* msgt_inline = */ TRUE((boolean_t) 1),
2266 /* msgt_longform = */ FALSE((boolean_t) 0),
2267 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2268 /* msgt_unused = */ 0
2269 };
2270
2271 protid_t dir;
2272 protid_t file;
2273
2274#if TypeCheck1
2275 if (mig_unlikely ((In0P->Head.msgh_size != 1068) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1068) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
2276 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1068) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
)
2277 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2278#endif /* TypeCheck */
2279
2280#if TypeCheck1
2281 if (BAD_TYPECHECK(&In0P->fileType, &fileCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->fileType); _c.t = *(&
fileCheck);_t.w != _c.w; })), 0)
)
2282 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2283#endif /* TypeCheck */
2284
2285#if TypeCheck1
2286 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
2287 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2288#endif /* TypeCheck */
2289
2290#if TypeCheck1
2291 if (BAD_TYPECHECK(&In0P->exclType, &exclCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->exclType); _c.t = *(&
exclCheck);_t.w != _c.w; })), 0)
)
2292 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2293#endif /* TypeCheck */
2294
2295 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2296 dir = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2297 else
2298 dir = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2299
2300 file = begin_using_protid_port(In0P->file);
2301
2302 OutP->RetCode = netfs_S_dir_link(dir, file, In0P->name, In0P->excl);
2303 end_using_protid_port(file);
2304 end_using_protid_port(dir);
2305}
2306
2307/* Default implementation of netfs_S_dir_link */
2308#ifdef MIG_EOPNOTSUPP
2309kern_return_t __attribute__ ((weak))
2310netfs_S_dir_link
2311(
2312 protid_t dir,
2313 protid_t file,
2314 string_t name,
2315 int excl
2316) { return MIG_EOPNOTSUPP; }
2317#endif /* MIG_EOPNOTSUPP */
2318
2319/* Routine dir_rename */
2320mig_internalstatic void _Xdir_rename
2321 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2322{
2323 typedef struct {
2324 mach_msg_header_t Head;
2325 mach_msg_type_t oldnameType;
2326 string_t oldname;
2327 mach_msg_type_t newdirectoryType;
2328 file_t newdirectory;
2329 mach_msg_type_t newnameType;
2330 string_t newname;
2331 mach_msg_type_t exclType;
2332 int excl;
2333 } Request;
2334
2335 typedef struct {
2336 mach_msg_header_t Head;
2337 mach_msg_type_t RetCodeType;
2338 kern_return_t RetCode;
2339 } Reply;
2340
2341 Request *In0P = (Request *) InHeadP;
2342 Reply *OutP = (Reply *) OutHeadP;
2343 mig_external kern_return_t netfs_S_dir_rename
2344 (protid_t olddirectory, string_t oldname, protid_t newdirectory, string_t newname, int excl);
2345
2346 const mach_msg_type_t oldnameCheck = {
2347 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2348 /* msgt_size = */ 8,
2349 /* msgt_number = */ 1024,
2350 /* msgt_inline = */ TRUE((boolean_t) 1),
2351 /* msgt_longform = */ FALSE((boolean_t) 0),
2352 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2353 /* msgt_unused = */ 0
2354 };
2355
2356 const mach_msg_type_t newdirectoryCheck = {
2357 /* msgt_name = */ 17,
2358 /* msgt_size = */ 32,
2359 /* msgt_number = */ 1,
2360 /* msgt_inline = */ TRUE((boolean_t) 1),
2361 /* msgt_longform = */ FALSE((boolean_t) 0),
2362 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2363 /* msgt_unused = */ 0
2364 };
2365
2366 const mach_msg_type_t newnameCheck = {
2367 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
2368 /* msgt_size = */ 8,
2369 /* msgt_number = */ 1024,
2370 /* msgt_inline = */ TRUE((boolean_t) 1),
2371 /* msgt_longform = */ FALSE((boolean_t) 0),
2372 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2373 /* msgt_unused = */ 0
2374 };
2375
2376 const mach_msg_type_t exclCheck = {
2377 /* msgt_name = */ 2,
2378 /* msgt_size = */ 32,
2379 /* msgt_number = */ 1,
2380 /* msgt_inline = */ TRUE((boolean_t) 1),
2381 /* msgt_longform = */ FALSE((boolean_t) 0),
2382 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2383 /* msgt_unused = */ 0
2384 };
2385
2386 protid_t olddirectory;
2387 protid_t newdirectory;
2388
2389#if TypeCheck1
2390 if (mig_unlikely ((In0P->Head.msgh_size != 2096) ||__builtin_expect (!! ((In0P->Head.msgh_size != 2096) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
2391 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 2096) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
)
2392 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2393#endif /* TypeCheck */
2394
2395#if TypeCheck1
2396 if (BAD_TYPECHECK(&In0P->oldnameType, &oldnameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->oldnameType); _c.t = *(&
oldnameCheck);_t.w != _c.w; })), 0)
)
2397 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2398#endif /* TypeCheck */
2399
2400#if TypeCheck1
2401 if (BAD_TYPECHECK(&In0P->newdirectoryType, &newdirectoryCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->newdirectoryType); _c.t =
*(&newdirectoryCheck);_t.w != _c.w; })), 0)
)
2402 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2403#endif /* TypeCheck */
2404
2405#if TypeCheck1
2406 if (BAD_TYPECHECK(&In0P->newnameType, &newnameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->newnameType); _c.t = *(&
newnameCheck);_t.w != _c.w; })), 0)
)
2407 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2408#endif /* TypeCheck */
2409
2410#if TypeCheck1
2411 if (BAD_TYPECHECK(&In0P->exclType, &exclCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->exclType); _c.t = *(&
exclCheck);_t.w != _c.w; })), 0)
)
2412 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2413#endif /* TypeCheck */
2414
2415 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2416 olddirectory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2417 else
2418 olddirectory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2419
2420 newdirectory = begin_using_protid_port(In0P->newdirectory);
2421
2422 OutP->RetCode = netfs_S_dir_rename(olddirectory, In0P->oldname, newdirectory, In0P->newname, In0P->excl);
2423 end_using_protid_port(newdirectory);
2424 end_using_protid_port(olddirectory);
2425}
2426
2427/* Default implementation of netfs_S_dir_rename */
2428#ifdef MIG_EOPNOTSUPP
2429kern_return_t __attribute__ ((weak))
2430netfs_S_dir_rename
2431(
2432 protid_t olddirectory,
2433 string_t oldname,
2434 protid_t newdirectory,
2435 string_t newname,
2436 int excl
2437) { return MIG_EOPNOTSUPP; }
2438#endif /* MIG_EOPNOTSUPP */
2439
2440/* Routine dir_mkfile */
2441mig_internalstatic void _Xdir_mkfile
2442 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2443{
2444 typedef struct {
2445 mach_msg_header_t Head;
2446 mach_msg_type_t flagsType;
2447 int flags;
2448 mach_msg_type_t modeType;
2449 mode_t mode;
2450 } Request;
2451
2452 typedef struct {
2453 mach_msg_header_t Head;
2454 mach_msg_type_t RetCodeType;
2455 kern_return_t RetCode;
2456 mach_msg_type_t newnodeType;
2457 mach_port_t newnode;
2458 } Reply;
2459
2460 Request *In0P = (Request *) InHeadP;
2461 Reply *OutP = (Reply *) OutHeadP;
2462 mig_external kern_return_t netfs_S_dir_mkfile
2463 (protid_t directory, int flags, mode_t mode, mach_port_t *newnode, mach_msg_type_name_t *newnodePoly);
2464
2465 boolean_t msgh_simple = msgh_simple;
2466 const mach_msg_type_t flagsCheck = {
2467 /* msgt_name = */ 2,
2468 /* msgt_size = */ 32,
2469 /* msgt_number = */ 1,
2470 /* msgt_inline = */ TRUE((boolean_t) 1),
2471 /* msgt_longform = */ FALSE((boolean_t) 0),
2472 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2473 /* msgt_unused = */ 0
2474 };
2475
2476 const mach_msg_type_t modeCheck = {
2477 /* msgt_name = */ 2,
2478 /* msgt_size = */ 32,
2479 /* msgt_number = */ 1,
2480 /* msgt_inline = */ TRUE((boolean_t) 1),
2481 /* msgt_longform = */ FALSE((boolean_t) 0),
2482 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2483 /* msgt_unused = */ 0
2484 };
2485
2486 const mach_msg_type_t newnodeType = {
2487 /* msgt_name = */ -1,
2488 /* msgt_size = */ 32,
2489 /* msgt_number = */ 1,
2490 /* msgt_inline = */ TRUE((boolean_t) 1),
2491 /* msgt_longform = */ FALSE((boolean_t) 0),
2492 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2493 /* msgt_unused = */ 0
2494 };
2495
2496 protid_t directory;
2497 mach_msg_type_name_t newnodePoly;
2498
2499#if TypeCheck1
2500 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2501 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2502 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2503#endif /* TypeCheck */
2504
2505#if TypeCheck1
2506 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)
)
2507 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2508#endif /* TypeCheck */
2509
2510#if TypeCheck1
2511 if (BAD_TYPECHECK(&In0P->modeType, &modeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->modeType); _c.t = *(&
modeCheck);_t.w != _c.w; })), 0)
)
2512 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2513#endif /* TypeCheck */
2514
2515 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2516 directory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2517 else
2518 directory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2519
2520 OutP->RetCode = netfs_S_dir_mkfile(directory, In0P->flags, In0P->mode, &OutP->newnode, &newnodePoly);
2521 end_using_protid_port(directory);
2522 if (OutP->RetCode != KERN_SUCCESS0)
2523 return;
2524
2525 msgh_simple = TRUE((boolean_t) 1);
2526 OutP->Head.msgh_size = 40;
2527
2528 OutP->newnodeType = newnodeType;
2529
2530 if (MACH_MSG_TYPE_PORT_ANY(newnodePoly)(((newnodePoly) >= 16) && ((newnodePoly) <= 21)
)
)
2531 msgh_simple = FALSE((boolean_t) 0);
2532
2533 OutP->newnodeType.msgt_name = newnodePoly;
2534
2535 if (!msgh_simple)
2536 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2537}
2538
2539/* Default implementation of netfs_S_dir_mkfile */
2540#ifdef MIG_EOPNOTSUPP
2541kern_return_t __attribute__ ((weak))
2542netfs_S_dir_mkfile
2543(
2544 protid_t directory,
2545 int flags,
2546 mode_t mode,
2547 mach_port_t *newnode,
2548 mach_msg_type_name_t *newnodePoly
2549) { return MIG_EOPNOTSUPP; }
2550#endif /* MIG_EOPNOTSUPP */
2551
2552/* Routine dir_notice_changes */
2553mig_internalstatic void _Xdir_notice_changes
2554 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2555{
2556 typedef struct {
2557 mach_msg_header_t Head;
2558 mach_msg_type_t portType;
2559 mach_port_t port;
2560 } Request;
2561
2562 typedef struct {
2563 mach_msg_header_t Head;
2564 mach_msg_type_t RetCodeType;
2565 kern_return_t RetCode;
2566 } Reply;
2567
2568 Request *In0P = (Request *) InHeadP;
2569 Reply *OutP = (Reply *) OutHeadP;
2570 mig_external kern_return_t netfs_S_dir_notice_changes
2571 (protid_t directory, mach_port_t port);
2572
2573 const mach_msg_type_t portCheck = {
2574 /* msgt_name = */ 17,
2575 /* msgt_size = */ 32,
2576 /* msgt_number = */ 1,
2577 /* msgt_inline = */ TRUE((boolean_t) 1),
2578 /* msgt_longform = */ FALSE((boolean_t) 0),
2579 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2580 /* msgt_unused = */ 0
2581 };
2582
2583 protid_t directory;
2584
2585#if TypeCheck1
2586 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
2587 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2588 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2589#endif /* TypeCheck */
2590
2591#if TypeCheck1
2592 if (BAD_TYPECHECK(&In0P->portType, &portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->portType); _c.t = *(&
portCheck);_t.w != _c.w; })), 0)
)
2593 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2594#endif /* TypeCheck */
2595
2596 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2597 directory = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2598 else
2599 directory = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2600
2601 OutP->RetCode = netfs_S_dir_notice_changes(directory, In0P->port);
2602 end_using_protid_port(directory);
2603}
2604
2605/* Default implementation of netfs_S_dir_notice_changes */
2606#ifdef MIG_EOPNOTSUPP
2607kern_return_t __attribute__ ((weak))
2608netfs_S_dir_notice_changes
2609(
2610 protid_t directory,
2611 mach_port_t port
2612) { return MIG_EOPNOTSUPP; }
2613#endif /* MIG_EOPNOTSUPP */
2614
2615/* Routine file_set_translator */
2616mig_internalstatic void _Xfile_set_translator
2617 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2618{
2619 typedef struct {
2620 mach_msg_header_t Head;
2621 mach_msg_type_t passive_flagsType;
2622 int passive_flags;
2623 mach_msg_type_t active_flagsType;
2624 int active_flags;
2625 mach_msg_type_t oldtrans_flagsType;
2626 int oldtrans_flags;
2627 mach_msg_type_long_t passiveType;
2628 char passive[2048];
2629 mach_msg_type_t activeType;
2630 mach_port_t active;
2631 } Request;
2632
2633 typedef struct {
2634 mach_msg_header_t Head;
2635 mach_msg_type_t RetCodeType;
2636 kern_return_t RetCode;
2637 } Reply;
2638
2639 Request *In0P = (Request *) InHeadP;
2640 Request *In1P;
2641 Reply *OutP = (Reply *) OutHeadP;
2642 mig_external kern_return_t netfs_S_file_set_translator
2643 (protid_t file, int passive_flags, int active_flags, int oldtrans_flags, data_t passive, mach_msg_type_number_t passiveCnt, mach_port_t active);
2644
2645 unsigned int msgh_size;
2646 unsigned int msgh_size_delta;
2647
2648 const mach_msg_type_t passive_flagsCheck = {
2649 /* msgt_name = */ 2,
2650 /* msgt_size = */ 32,
2651 /* msgt_number = */ 1,
2652 /* msgt_inline = */ TRUE((boolean_t) 1),
2653 /* msgt_longform = */ FALSE((boolean_t) 0),
2654 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2655 /* msgt_unused = */ 0
2656 };
2657
2658 const mach_msg_type_t active_flagsCheck = {
2659 /* msgt_name = */ 2,
2660 /* msgt_size = */ 32,
2661 /* msgt_number = */ 1,
2662 /* msgt_inline = */ TRUE((boolean_t) 1),
2663 /* msgt_longform = */ FALSE((boolean_t) 0),
2664 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2665 /* msgt_unused = */ 0
2666 };
2667
2668 const mach_msg_type_t oldtrans_flagsCheck = {
2669 /* msgt_name = */ 2,
2670 /* msgt_size = */ 32,
2671 /* msgt_number = */ 1,
2672 /* msgt_inline = */ TRUE((boolean_t) 1),
2673 /* msgt_longform = */ FALSE((boolean_t) 0),
2674 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2675 /* msgt_unused = */ 0
2676 };
2677
2678 const mach_msg_type_t activeCheck = {
2679 /* msgt_name = */ 17,
2680 /* msgt_size = */ 32,
2681 /* msgt_number = */ 1,
2682 /* msgt_inline = */ TRUE((boolean_t) 1),
2683 /* msgt_longform = */ FALSE((boolean_t) 0),
2684 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2685 /* msgt_unused = */ 0
2686 };
2687
2688 protid_t file;
2689
2690#if TypeCheck1
2691 msgh_size = In0P->Head.msgh_size;
2692 if (mig_unlikely ((msgh_size < 68) ||__builtin_expect (!! ((msgh_size < 68) || !(In0P->Head.
msgh_bits & 0x80000000U)), 0)
2693 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 68) || !(In0P->Head.
msgh_bits & 0x80000000U)), 0)
)
2694 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2695#endif /* TypeCheck */
2696
2697#if TypeCheck1
2698 if (BAD_TYPECHECK(&In0P->passive_flagsType, &passive_flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->passive_flagsType); _c.t
= *(&passive_flagsCheck);_t.w != _c.w; })), 0)
)
2699 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2700#endif /* TypeCheck */
2701
2702#if TypeCheck1
2703 if (BAD_TYPECHECK(&In0P->active_flagsType, &active_flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->active_flagsType); _c.t =
*(&active_flagsCheck);_t.w != _c.w; })), 0)
)
2704 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2705#endif /* TypeCheck */
2706
2707#if TypeCheck1
2708 if (BAD_TYPECHECK(&In0P->oldtrans_flagsType, &oldtrans_flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->oldtrans_flagsType); _c.
t = *(&oldtrans_flagsCheck);_t.w != _c.w; })), 0)
)
2709 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2710#endif /* TypeCheck */
2711
2712#if TypeCheck1
2713 if (mig_unlikely ((In0P->passiveType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->passiveType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->passiveType.msgtl_name != 8
) || (In0P->passiveType.msgtl_size != 8)), 0)
2714 (In0P->passiveType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->passiveType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->passiveType.msgtl_name != 8
) || (In0P->passiveType.msgtl_size != 8)), 0)
2715 (In0P->passiveType.msgtl_size != 8))__builtin_expect (!! ((In0P->passiveType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->passiveType.msgtl_name != 8
) || (In0P->passiveType.msgtl_size != 8)), 0)
)
2716 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2717#endif /* TypeCheck */
2718
2719 msgh_size_delta = (In0P->passiveType.msgtl_header.msgt_inline) ? (In0P->passiveType.msgtl_number + 3) & ~3 : sizeof(char *);
2720#if TypeCheck1
2721 if (mig_unlikely (msgh_size != 68 + msgh_size_delta)__builtin_expect (!! (msgh_size != 68 + msgh_size_delta), 0))
2722 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2723#endif /* TypeCheck */
2724
2725 In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048);
2726
2727#if TypeCheck1
2728 if (BAD_TYPECHECK(&In1P->activeType, &activeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In1P->activeType); _c.t = *(&
activeCheck);_t.w != _c.w; })), 0)
)
2729 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2730#endif /* TypeCheck */
2731
2732 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2733 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2734 else
2735 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2736
2737 OutP->RetCode = netfs_S_file_set_translator(file, In0P->passive_flags, In0P->active_flags, In0P->oldtrans_flags, (In0P->passiveType.msgtl_header.msgt_inline) ? In0P->passive : *((char **)In0P->passive), In0P->passiveType.msgtl_number, In1P->active);
2738 if (OutP->RetCode == KERN_SUCCESS0)
2739 if (!In0P->passiveType.msgtl_header.msgt_inline)
2740 __mig_deallocate(* (vm_offset_t *) In0P->passive, In0P->passiveType.msgtl_number);
2741 end_using_protid_port(file);
2742}
2743
2744/* Default implementation of netfs_S_file_set_translator */
2745#ifdef MIG_EOPNOTSUPP
2746kern_return_t __attribute__ ((weak))
2747netfs_S_file_set_translator
2748(
2749 protid_t file,
2750 int passive_flags,
2751 int active_flags,
2752 int oldtrans_flags,
2753 data_t passive,
2754 mach_msg_type_number_t passiveCnt,
2755 mach_port_t active
2756) { return MIG_EOPNOTSUPP; }
2757#endif /* MIG_EOPNOTSUPP */
2758
2759/* Routine file_get_translator */
2760mig_internalstatic void _Xfile_get_translator
2761 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2762{
2763 typedef struct {
2764 mach_msg_header_t Head;
2765 } Request;
2766
2767 typedef struct {
2768 mach_msg_header_t Head;
2769 mach_msg_type_t RetCodeType;
2770 kern_return_t RetCode;
2771 mach_msg_type_long_t translatorType;
2772 char translator[2048];
2773 } Reply;
2774
2775 Request *In0P = (Request *) InHeadP;
2776 Reply *OutP = (Reply *) OutHeadP;
2777 mig_external kern_return_t netfs_S_file_get_translator
2778 (protid_t file, data_t *translator, mach_msg_type_number_t *translatorCnt);
2779
2780 boolean_t msgh_simple = msgh_simple;
Assigned value is garbage or undefined
2781 const mach_msg_type_long_t translatorType = {
2782 {
2783 /* msgt_name = */ 0,
2784 /* msgt_size = */ 0,
2785 /* msgt_number = */ 0,
2786 /* msgt_inline = */ TRUE((boolean_t) 1),
2787 /* msgt_longform = */ TRUE((boolean_t) 1),
2788 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2789 /* msgt_unused = */ 0
2790 },
2791 /* msgtl_name = */ 8,
2792 /* msgtl_size = */ 8,
2793 /* msgtl_number = */ 2048,
2794 };
2795
2796 protid_t file;
2797 mach_msg_type_number_t translatorCnt;
2798
2799 char *translatorP;
2800
2801#if TypeCheck1
2802 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2803 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2804 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2805#endif /* TypeCheck */
2806
2807 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2808 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2809 else
2810 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2811
2812 translatorP = OutP->translator;
2813 translatorCnt = 2048;
2814
2815 OutP->RetCode = netfs_S_file_get_translator(file, &translatorP, &translatorCnt);
2816 end_using_protid_port(file);
2817 if (OutP->RetCode != KERN_SUCCESS0)
2818 return;
2819
2820 msgh_simple = TRUE((boolean_t) 1);
2821
2822 OutP->translatorType = translatorType;
2823 if (translatorP != OutP->translator) {
2824 OutP->translatorType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
2825 OutP->translatorType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
2826 *((char **)OutP->translator) = translatorP;
2827 msgh_simple = FALSE((boolean_t) 0);
2828 }
2829
2830 OutP->translatorType.msgtl_number = translatorCnt;
2831 OutP->Head.msgh_size = 44 + ((OutP->translatorType.msgtl_header.msgt_inline) ? (translatorCnt + 3) & ~3 : sizeof(char *));
2832
2833 if (!msgh_simple)
2834 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2835}
2836
2837/* Default implementation of netfs_S_file_get_translator */
2838#ifdef MIG_EOPNOTSUPP
2839kern_return_t __attribute__ ((weak))
2840netfs_S_file_get_translator
2841(
2842 protid_t file,
2843 data_t *translator,
2844 mach_msg_type_number_t *translatorCnt
2845) { return MIG_EOPNOTSUPP; }
2846#endif /* MIG_EOPNOTSUPP */
2847
2848/* Routine file_get_translator_cntl */
2849mig_internalstatic void _Xfile_get_translator_cntl
2850 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2851{
2852 typedef struct {
2853 mach_msg_header_t Head;
2854 } Request;
2855
2856 typedef struct {
2857 mach_msg_header_t Head;
2858 mach_msg_type_t RetCodeType;
2859 kern_return_t RetCode;
2860 mach_msg_type_t translator_cntlType;
2861 mach_port_t translator_cntl;
2862 } Reply;
2863
2864 Request *In0P = (Request *) InHeadP;
2865 Reply *OutP = (Reply *) OutHeadP;
2866 mig_external kern_return_t netfs_S_file_get_translator_cntl
2867 (protid_t file, mach_port_t *translator_cntl, mach_msg_type_name_t *translator_cntlPoly);
2868
2869 boolean_t msgh_simple = msgh_simple;
2870 const mach_msg_type_t translator_cntlType = {
2871 /* msgt_name = */ -1,
2872 /* msgt_size = */ 32,
2873 /* msgt_number = */ 1,
2874 /* msgt_inline = */ TRUE((boolean_t) 1),
2875 /* msgt_longform = */ FALSE((boolean_t) 0),
2876 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2877 /* msgt_unused = */ 0
2878 };
2879
2880 protid_t file;
2881 mach_msg_type_name_t translator_cntlPoly;
2882
2883#if TypeCheck1
2884 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2885 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2886 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2887#endif /* TypeCheck */
2888
2889 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2890 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2891 else
2892 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2893
2894 OutP->RetCode = netfs_S_file_get_translator_cntl(file, &OutP->translator_cntl, &translator_cntlPoly);
2895 end_using_protid_port(file);
2896 if (OutP->RetCode != KERN_SUCCESS0)
2897 return;
2898
2899 msgh_simple = TRUE((boolean_t) 1);
2900 OutP->Head.msgh_size = 40;
2901
2902 OutP->translator_cntlType = translator_cntlType;
2903
2904 if (MACH_MSG_TYPE_PORT_ANY(translator_cntlPoly)(((translator_cntlPoly) >= 16) && ((translator_cntlPoly
) <= 21))
)
2905 msgh_simple = FALSE((boolean_t) 0);
2906
2907 OutP->translator_cntlType.msgt_name = translator_cntlPoly;
2908
2909 if (!msgh_simple)
2910 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2911}
2912
2913/* Default implementation of netfs_S_file_get_translator_cntl */
2914#ifdef MIG_EOPNOTSUPP
2915kern_return_t __attribute__ ((weak))
2916netfs_S_file_get_translator_cntl
2917(
2918 protid_t file,
2919 mach_port_t *translator_cntl,
2920 mach_msg_type_name_t *translator_cntlPoly
2921) { return MIG_EOPNOTSUPP; }
2922#endif /* MIG_EOPNOTSUPP */
2923
2924/* Routine file_get_fs_options */
2925mig_internalstatic void _Xfile_get_fs_options
2926 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2927{
2928 typedef struct {
2929 mach_msg_header_t Head;
2930 } Request;
2931
2932 typedef struct {
2933 mach_msg_header_t Head;
2934 mach_msg_type_t RetCodeType;
2935 kern_return_t RetCode;
2936 mach_msg_type_long_t optionsType;
2937 char options[2048];
2938 } Reply;
2939
2940 Request *In0P = (Request *) InHeadP;
2941 Reply *OutP = (Reply *) OutHeadP;
2942 mig_external kern_return_t netfs_S_file_get_fs_options
2943 (protid_t file, data_t *options, mach_msg_type_number_t *optionsCnt);
2944
2945 boolean_t msgh_simple = msgh_simple;
2946 const mach_msg_type_long_t optionsType = {
2947 {
2948 /* msgt_name = */ 0,
2949 /* msgt_size = */ 0,
2950 /* msgt_number = */ 0,
2951 /* msgt_inline = */ TRUE((boolean_t) 1),
2952 /* msgt_longform = */ TRUE((boolean_t) 1),
2953 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2954 /* msgt_unused = */ 0
2955 },
2956 /* msgtl_name = */ 8,
2957 /* msgtl_size = */ 8,
2958 /* msgtl_number = */ 2048,
2959 };
2960
2961 protid_t file;
2962 mach_msg_type_number_t optionsCnt;
2963
2964 char *optionsP;
2965
2966#if TypeCheck1
2967 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2968 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2969 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2970#endif /* TypeCheck */
2971
2972 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
2973 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
2974 else
2975 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
2976
2977 optionsP = OutP->options;
2978 optionsCnt = 2048;
2979
2980 OutP->RetCode = netfs_S_file_get_fs_options(file, &optionsP, &optionsCnt);
2981 end_using_protid_port(file);
2982 if (OutP->RetCode != KERN_SUCCESS0)
2983 return;
2984
2985 msgh_simple = TRUE((boolean_t) 1);
2986
2987 OutP->optionsType = optionsType;
2988 if (optionsP != OutP->options) {
2989 OutP->optionsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
2990 OutP->optionsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
2991 *((char **)OutP->options) = optionsP;
2992 msgh_simple = FALSE((boolean_t) 0);
2993 }
2994
2995 OutP->optionsType.msgtl_number = optionsCnt;
2996 OutP->Head.msgh_size = 44 + ((OutP->optionsType.msgtl_header.msgt_inline) ? (optionsCnt + 3) & ~3 : sizeof(char *));
2997
2998 if (!msgh_simple)
2999 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
3000}
3001
3002/* Default implementation of netfs_S_file_get_fs_options */
3003#ifdef MIG_EOPNOTSUPP
3004kern_return_t __attribute__ ((weak))
3005netfs_S_file_get_fs_options
3006(
3007 protid_t file,
3008 data_t *options,
3009 mach_msg_type_number_t *optionsCnt
3010) { return MIG_EOPNOTSUPP; }
3011#endif /* MIG_EOPNOTSUPP */
3012
3013/* Routine file_reparent */
3014mig_internalstatic void _Xfile_reparent
3015 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3016{
3017 typedef struct {
3018 mach_msg_header_t Head;
3019 mach_msg_type_t parentType;
3020 mach_port_t parent;
3021 } Request;
3022
3023 typedef struct {
3024 mach_msg_header_t Head;
3025 mach_msg_type_t RetCodeType;
3026 kern_return_t RetCode;
3027 mach_msg_type_t new_fileType;
3028 mach_port_t new_file;
3029 } Reply;
3030
3031 Request *In0P = (Request *) InHeadP;
3032 Reply *OutP = (Reply *) OutHeadP;
3033 mig_external kern_return_t netfs_S_file_reparent
3034 (protid_t file, mach_port_t parent, mach_port_t *new_file, mach_msg_type_name_t *new_filePoly);
3035
3036 boolean_t msgh_simple = msgh_simple;
3037 const mach_msg_type_t parentCheck = {
3038 /* msgt_name = */ 17,
3039 /* msgt_size = */ 32,
3040 /* msgt_number = */ 1,
3041 /* msgt_inline = */ TRUE((boolean_t) 1),
3042 /* msgt_longform = */ FALSE((boolean_t) 0),
3043 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3044 /* msgt_unused = */ 0
3045 };
3046
3047 const mach_msg_type_t new_fileType = {
3048 /* msgt_name = */ -1,
3049 /* msgt_size = */ 32,
3050 /* msgt_number = */ 1,
3051 /* msgt_inline = */ TRUE((boolean_t) 1),
3052 /* msgt_longform = */ FALSE((boolean_t) 0),
3053 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3054 /* msgt_unused = */ 0
3055 };
3056
3057 protid_t file;
3058 mach_port_t parent;
3059 mach_msg_type_name_t new_filePoly;
3060
3061#if TypeCheck1
3062 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
3063 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3064 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3065#endif /* TypeCheck */
3066
3067#if TypeCheck1
3068 if (BAD_TYPECHECK(&In0P->parentType, &parentCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->parentType); _c.t = *(&
parentCheck);_t.w != _c.w; })), 0)
)
3069 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3070#endif /* TypeCheck */
3071
3072 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
3073 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
3074 else
3075 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
3076
3077 parent = In0P->parent;
3078
3079 OutP->RetCode = netfs_S_file_reparent(file, parent, &OutP->new_file, &new_filePoly);
3080 end_using_protid_port(file);
3081 if (OutP->RetCode != KERN_SUCCESS0)
3082 return;
3083
3084 msgh_simple = TRUE((boolean_t) 1);
3085 OutP->Head.msgh_size = 40;
3086
3087 OutP->new_fileType = new_fileType;
3088
3089 if (MACH_MSG_TYPE_PORT_ANY(new_filePoly)(((new_filePoly) >= 16) && ((new_filePoly) <= 21
))
)
3090 msgh_simple = FALSE((boolean_t) 0);
3091
3092 OutP->new_fileType.msgt_name = new_filePoly;
3093
3094 if (!msgh_simple)
3095 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
3096}
3097
3098/* Default implementation of netfs_S_file_reparent */
3099#ifdef MIG_EOPNOTSUPP
3100kern_return_t __attribute__ ((weak))
3101netfs_S_file_reparent
3102(
3103 protid_t file,
3104 mach_port_t parent,
3105 mach_port_t *new_file,
3106 mach_msg_type_name_t *new_filePoly
3107) { return MIG_EOPNOTSUPP; }
3108#endif /* MIG_EOPNOTSUPP */
3109
3110/* Routine file_get_children */
3111mig_internalstatic void _Xfile_get_children
3112 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3113{
3114 typedef struct {
3115 mach_msg_header_t Head;
3116 } Request;
3117
3118 typedef struct {
3119 mach_msg_header_t Head;
3120 mach_msg_type_t RetCodeType;
3121 kern_return_t RetCode;
3122 mach_msg_type_long_t childrenType;
3123 char children[2048];
3124 } Reply;
3125
3126 Request *In0P = (Request *) InHeadP;
3127 Reply *OutP = (Reply *) OutHeadP;
3128 mig_external kern_return_t netfs_S_file_get_children
3129 (protid_t file, data_t *children, mach_msg_type_number_t *childrenCnt);
3130
3131 boolean_t msgh_simple = msgh_simple;
3132 const mach_msg_type_long_t childrenType = {
3133 {
3134 /* msgt_name = */ 0,
3135 /* msgt_size = */ 0,
3136 /* msgt_number = */ 0,
3137 /* msgt_inline = */ TRUE((boolean_t) 1),
3138 /* msgt_longform = */ TRUE((boolean_t) 1),
3139 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3140 /* msgt_unused = */ 0
3141 },
3142 /* msgtl_name = */ 8,
3143 /* msgtl_size = */ 8,
3144 /* msgtl_number = */ 2048,
3145 };
3146
3147 protid_t file;
3148 mach_msg_type_number_t childrenCnt;
3149
3150 char *childrenP;
3151
3152#if TypeCheck1
3153 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3154 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3155 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3156#endif /* TypeCheck */
3157
3158 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
3159 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
3160 else
3161 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
3162
3163 childrenP = OutP->children;
3164 childrenCnt = 2048;
3165
3166 OutP->RetCode = netfs_S_file_get_children(file, &childrenP, &childrenCnt);
3167 end_using_protid_port(file);
3168 if (OutP->RetCode != KERN_SUCCESS0)
3169 return;
3170
3171 msgh_simple = TRUE((boolean_t) 1);
3172
3173 OutP->childrenType = childrenType;
3174 if (childrenP != OutP->children) {
3175 OutP->childrenType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
3176 *((char **)OutP->children) = childrenP;
3177 msgh_simple = FALSE((boolean_t) 0);
3178 }
3179
3180 OutP->childrenType.msgtl_number = childrenCnt;
3181 OutP->Head.msgh_size = 44 + ((OutP->childrenType.msgtl_header.msgt_inline) ? (childrenCnt + 3) & ~3 : sizeof(char *));
3182
3183 if (!msgh_simple)
3184 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
3185}
3186
3187/* Default implementation of netfs_S_file_get_children */
3188#ifdef MIG_EOPNOTSUPP
3189kern_return_t __attribute__ ((weak))
3190netfs_S_file_get_children
3191(
3192 protid_t file,
3193 data_t *children,
3194 mach_msg_type_number_t *childrenCnt
3195) { return MIG_EOPNOTSUPP; }
3196#endif /* MIG_EOPNOTSUPP */
3197
3198/* Routine file_get_source */
3199mig_internalstatic void _Xfile_get_source
3200 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3201{
3202 typedef struct {
3203 mach_msg_header_t Head;
3204 } Request;
3205
3206 typedef struct {
3207 mach_msg_header_t Head;
3208 mach_msg_type_t RetCodeType;
3209 kern_return_t RetCode;
3210 mach_msg_type_t sourceType;
3211 string_t source;
3212 } Reply;
3213
3214 Request *In0P = (Request *) InHeadP;
3215 Reply *OutP = (Reply *) OutHeadP;
3216 mig_external kern_return_t netfs_S_file_get_source
3217 (protid_t file, string_t source);
3218
3219 const mach_msg_type_t sourceType = {
3220 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
3221 /* msgt_size = */ 8,
3222 /* msgt_number = */ 1024,
3223 /* msgt_inline = */ TRUE((boolean_t) 1),
3224 /* msgt_longform = */ FALSE((boolean_t) 0),
3225 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3226 /* msgt_unused = */ 0
3227 };
3228
3229 protid_t file;
3230
3231#if TypeCheck1
3232 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3233 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3234 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3235#endif /* TypeCheck */
3236
3237 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
3238 file = begin_using_protid_payload(In0P->Head.msgh_protected_payload);
3239 else
3240 file = begin_using_protid_port(In0P->Head.msgh_request_portmsgh_local_port);
3241
3242 OutP->RetCode = netfs_S_file_get_source(file, OutP->source);
3243 end_using_protid_port(file);
3244 if (OutP->RetCode != KERN_SUCCESS0)
3245 return;
3246
3247 OutP->Head.msgh_size = 1060;
3248
3249 OutP->sourceType = sourceType;
3250}
3251
3252/* Default implementation of netfs_S_file_get_source */
3253#ifdef MIG_EOPNOTSUPP
3254kern_return_t __attribute__ ((weak))
3255netfs_S_file_get_source
3256(
3257 protid_t file,
3258 string_t source
3259) { return MIG_EOPNOTSUPP; }
3260#endif /* MIG_EOPNOTSUPP */
3261
3262mig_routine_t netfs_fs_server_routines[] = {
3263 _Xfile_exec,
3264 _Xfile_chown,
3265 _Xfile_chauthor,
3266 _Xfile_chmod,
3267 _Xfile_chflags,
3268 _Xfile_utimes,
3269 _Xfile_set_size,
3270 _Xfile_lock,
3271 _Xfile_lock_stat,
3272 _Xfile_check_access,
3273 _Xfile_notice_changes,
3274 _Xfile_getcontrol,
3275 _Xfile_statfs,
3276 _Xfile_sync,
3277 _Xfile_syncfs,
3278 _Xfile_get_storage_info,
3279 _Xfile_getlinknode,
3280 _Xfile_getfh,
3281 _Xdir_lookup,
3282 _Xdir_readdir,
3283 _Xdir_mkdir,
3284 _Xdir_rmdir,
3285 _Xdir_unlink,
3286 _Xdir_link,
3287 _Xdir_rename,
3288 _Xdir_mkfile,
3289 _Xdir_notice_changes,
3290 _Xfile_set_translator,
3291 _Xfile_get_translator,
3292 _Xfile_get_translator_cntl,
3293 _Xfile_get_fs_options,
3294 _Xfile_reparent,
3295 _Xfile_get_children,
3296 _Xfile_get_source,
3297};
3298
3299mig_external boolean_t netfs_fs_server
3300 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3301{
3302 mach_msg_header_t *InP = InHeadP;
3303 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
3304
3305 const mach_msg_type_t RetCodeType = {
3306 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
3307 /* msgt_size = */ 32,
3308 /* msgt_number = */ 1,
3309 /* msgt_inline = */ TRUE((boolean_t) 1),
3310 /* msgt_longform = */ FALSE((boolean_t) 0),
3311 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3312 /* msgt_unused = */ 0
3313 };
3314
3315 mig_routine_t routine;
3316
3317 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8));
3318 OutP->Head.msgh_size = sizeof *OutP;
3319 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port;
3320 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
3321 OutP->Head.msgh_seqno = 0;
3322 OutP->Head.msgh_id = InP->msgh_id + 100;
3323
3324 OutP->RetCodeType = RetCodeType;
3325
3326 if ((InP->msgh_id > 20033) || (InP->msgh_id < 20000) ||
3327 ((routine = netfs_fs_server_routines[InP->msgh_id - 20000]) == 0)) {
3328 OutP->RetCode = MIG_BAD_ID-303;
3329 return FALSE((boolean_t) 0);
3330 }
3331 (*routine) (InP, &OutP->Head);
3332 return TRUE((boolean_t) 1);
3333}
3334
3335mig_external mig_routine_t netfs_fs_server_routine
3336 (const mach_msg_header_t *InHeadP)
3337{
3338 int msgh_id;
3339
3340 msgh_id = InHeadP->msgh_id - 20000;
3341
3342 if ((msgh_id > 33) || (msgh_id < 0))
3343 return 0;
3344
3345 return netfs_fs_server_routines[msgh_id];
3346}
3347