Bug Summary

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