1 | /* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IOWorkGroup.iig */ |
2 | |
3 | #undef IIG_IMPLEMENTATION |
4 | #define IIG_IMPLEMENTATION IOWorkGroup.iig |
5 | |
6 | #if KERNEL |
7 | #include <libkern/c++/OSString.h> |
8 | #else |
9 | #include <DriverKit/DriverKit.h> |
10 | #endif /* KERNEL */ |
11 | #include <DriverKit/IOReturn.h> |
12 | #include <DriverKit/IOWorkGroup.h> |
13 | |
14 | |
15 | #if __has_builtin(__builtin_load_member_function_pointer) |
16 | #define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func) |
17 | #else |
18 | #define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; }) |
19 | #endif |
20 | |
21 | |
22 | struct IOWorkGroup_Create_Msg_Content |
23 | { |
24 | IORPCMessage __hdr; |
25 | OSObjectRef __object; |
26 | OSString * name; |
27 | #if !defined(__LP64__) |
28 | uint32_t __namePad; |
29 | #endif /* !defined(__LP64__) */ |
30 | OSObjectRef userClient; |
31 | }; |
32 | #pragma pack(4) |
33 | struct IOWorkGroup_Create_Msg |
34 | { |
35 | IORPCMessageMach mach; |
36 | mach_msg_port_descriptor_t __object__descriptor; |
37 | mach_msg_ool_descriptor_t name__descriptor; |
38 | mach_msg_port_descriptor_t userClient__descriptor; |
39 | IOWorkGroup_Create_Msg_Content content; |
40 | }; |
41 | #pragma pack() |
42 | #define IOWorkGroup_Create_Msg_ObjRefs (3) |
43 | |
44 | struct IOWorkGroup_Create_Rpl_Content |
45 | { |
46 | IORPCMessage __hdr; |
47 | OSObjectRef workgroup; |
48 | }; |
49 | #pragma pack(4) |
50 | struct IOWorkGroup_Create_Rpl |
51 | { |
52 | IORPCMessageMach mach; |
53 | mach_msg_port_descriptor_t workgroup__descriptor; |
54 | IOWorkGroup_Create_Rpl_Content content; |
55 | }; |
56 | #pragma pack() |
57 | #define IOWorkGroup_Create_Rpl_ObjRefs (1) |
58 | |
59 | |
60 | typedef union |
61 | { |
62 | const IORPC rpc; |
63 | struct |
64 | { |
65 | const struct IOWorkGroup_Create_Msg * message; |
66 | struct IOWorkGroup_Create_Rpl * reply; |
67 | uint32_t sendSize; |
68 | uint32_t replySize; |
69 | }; |
70 | } |
71 | IOWorkGroup_Create_Invocation; |
72 | struct IOWorkGroup_SetWorkGroupPort_Msg_Content |
73 | { |
74 | IORPCMessage __hdr; |
75 | OSObjectRef __object; |
76 | }; |
77 | #pragma pack(4) |
78 | struct IOWorkGroup_SetWorkGroupPort_Msg |
79 | { |
80 | IORPCMessageMach mach; |
81 | mach_msg_port_descriptor_t __object__descriptor; |
82 | mach_msg_port_descriptor_t port__descriptor; |
83 | IOWorkGroup_SetWorkGroupPort_Msg_Content content; |
84 | }; |
85 | #pragma pack() |
86 | #define IOWorkGroup_SetWorkGroupPort_Msg_ObjRefs (1) |
87 | |
88 | struct IOWorkGroup_SetWorkGroupPort_Rpl_Content |
89 | { |
90 | IORPCMessage __hdr; |
91 | }; |
92 | #pragma pack(4) |
93 | struct IOWorkGroup_SetWorkGroupPort_Rpl |
94 | { |
95 | IORPCMessageMach mach; |
96 | IOWorkGroup_SetWorkGroupPort_Rpl_Content content; |
97 | }; |
98 | #pragma pack() |
99 | #define IOWorkGroup_SetWorkGroupPort_Rpl_ObjRefs (0) |
100 | |
101 | |
102 | typedef union |
103 | { |
104 | const IORPC rpc; |
105 | struct |
106 | { |
107 | const struct IOWorkGroup_SetWorkGroupPort_Msg * message; |
108 | struct IOWorkGroup_SetWorkGroupPort_Rpl * reply; |
109 | uint32_t sendSize; |
110 | uint32_t replySize; |
111 | }; |
112 | } |
113 | IOWorkGroup_SetWorkGroupPort_Invocation; |
114 | struct IOWorkGroup_InvalidateKernel_Msg_Content |
115 | { |
116 | IORPCMessage __hdr; |
117 | OSObjectRef __object; |
118 | OSObjectRef client; |
119 | }; |
120 | #pragma pack(4) |
121 | struct IOWorkGroup_InvalidateKernel_Msg |
122 | { |
123 | IORPCMessageMach mach; |
124 | mach_msg_port_descriptor_t __object__descriptor; |
125 | mach_msg_port_descriptor_t client__descriptor; |
126 | IOWorkGroup_InvalidateKernel_Msg_Content content; |
127 | }; |
128 | #pragma pack() |
129 | #define IOWorkGroup_InvalidateKernel_Msg_ObjRefs (2) |
130 | |
131 | struct IOWorkGroup_InvalidateKernel_Rpl_Content |
132 | { |
133 | IORPCMessage __hdr; |
134 | }; |
135 | #pragma pack(4) |
136 | struct IOWorkGroup_InvalidateKernel_Rpl |
137 | { |
138 | IORPCMessageMach mach; |
139 | IOWorkGroup_InvalidateKernel_Rpl_Content content; |
140 | }; |
141 | #pragma pack() |
142 | #define IOWorkGroup_InvalidateKernel_Rpl_ObjRefs (0) |
143 | |
144 | |
145 | typedef union |
146 | { |
147 | const IORPC rpc; |
148 | struct |
149 | { |
150 | const struct IOWorkGroup_InvalidateKernel_Msg * message; |
151 | struct IOWorkGroup_InvalidateKernel_Rpl * reply; |
152 | uint32_t sendSize; |
153 | uint32_t replySize; |
154 | }; |
155 | } |
156 | IOWorkGroup_InvalidateKernel_Invocation; |
157 | #if !KERNEL |
158 | extern OSMetaClass * gOSContainerMetaClass; |
159 | extern OSMetaClass * gOSDataMetaClass; |
160 | extern OSMetaClass * gOSNumberMetaClass; |
161 | extern OSMetaClass * gOSBooleanMetaClass; |
162 | extern OSMetaClass * gOSDictionaryMetaClass; |
163 | extern OSMetaClass * gOSArrayMetaClass; |
164 | extern OSMetaClass * gOSSetMetaClass; |
165 | extern OSMetaClass * gOSOrderedSetMetaClass; |
166 | extern OSMetaClass * gIODispatchQueueMetaClass; |
167 | extern OSMetaClass * gOSStringMetaClass; |
168 | extern OSMetaClass * gIOServiceStateNotificationDispatchSourceMetaClass; |
169 | extern OSMetaClass * gIOMemoryMapMetaClass; |
170 | extern OSMetaClass * gOSAction_IOUserClient_KernelCompletionMetaClass; |
171 | #endif /* !KERNEL */ |
172 | |
173 | #if KERNEL |
174 | OSDefineMetaClassAndStructors(IOWorkGroup, OSObject); |
175 | #endif /* KERNEL */ |
176 | |
177 | #if !KERNEL |
178 | |
179 | #define IOWorkGroup_QueueNames "" |
180 | |
181 | #define IOWorkGroup_MethodNames "" |
182 | |
183 | #define IOWorkGroupMetaClass_MethodNames "" |
184 | |
185 | struct OSClassDescription_IOWorkGroup_t |
186 | { |
187 | OSClassDescription base; |
188 | uint64_t methodOptions[2 * 0]; |
189 | uint64_t metaMethodOptions[2 * 0]; |
190 | char queueNames[sizeof(IOWorkGroup_QueueNames)]; |
191 | char methodNames[sizeof(IOWorkGroup_MethodNames)]; |
192 | char metaMethodNames[sizeof(IOWorkGroupMetaClass_MethodNames)]; |
193 | }; |
194 | |
195 | const struct OSClassDescription_IOWorkGroup_t |
196 | OSClassDescription_IOWorkGroup = |
197 | { |
198 | .base = |
199 | { |
200 | .descriptionSize = sizeof(OSClassDescription_IOWorkGroup_t), |
201 | .name = "IOWorkGroup" , |
202 | .superName = "OSObject" , |
203 | .methodOptionsSize = 2 * sizeof(uint64_t) * 0, |
204 | .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOWorkGroup_t, methodOptions), |
205 | .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0, |
206 | .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOWorkGroup_t, metaMethodOptions), |
207 | .queueNamesSize = sizeof(IOWorkGroup_QueueNames), |
208 | .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IOWorkGroup_t, queueNames), |
209 | .methodNamesSize = sizeof(IOWorkGroup_MethodNames), |
210 | .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOWorkGroup_t, methodNames), |
211 | .metaMethodNamesSize = sizeof(IOWorkGroupMetaClass_MethodNames), |
212 | .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOWorkGroup_t, metaMethodNames), |
213 | .flags = 1*kOSClassCanRemote, |
214 | }, |
215 | .methodOptions = |
216 | { |
217 | }, |
218 | .metaMethodOptions = |
219 | { |
220 | }, |
221 | .queueNames = IOWorkGroup_QueueNames, |
222 | .methodNames = IOWorkGroup_MethodNames, |
223 | .metaMethodNames = IOWorkGroupMetaClass_MethodNames, |
224 | }; |
225 | |
226 | OSMetaClass * gIOWorkGroupMetaClass; |
227 | |
228 | static kern_return_t |
229 | IOWorkGroup_New(OSMetaClass * instance); |
230 | |
231 | const OSClassLoadInformation |
232 | IOWorkGroup_Class = |
233 | { |
234 | .description = &OSClassDescription_IOWorkGroup.base, |
235 | .metaPointer = &gIOWorkGroupMetaClass, |
236 | .version = 1, |
237 | .instanceSize = sizeof(IOWorkGroup), |
238 | |
239 | .New = &IOWorkGroup_New, |
240 | }; |
241 | |
242 | extern const void * const |
243 | gIOWorkGroup_Declaration; |
244 | const void * const |
245 | gIOWorkGroup_Declaration |
246 | __attribute__((visibility("hidden" ),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip" ),no_sanitize("address" ))) |
247 | = &IOWorkGroup_Class; |
248 | |
249 | static kern_return_t |
250 | IOWorkGroup_New(OSMetaClass * instance) |
251 | { |
252 | if (!new(instance) IOWorkGroupMetaClass) return (kIOReturnNoMemory); |
253 | return (kIOReturnSuccess); |
254 | } |
255 | |
256 | kern_return_t |
257 | IOWorkGroupMetaClass::New(OSObject * instance) |
258 | { |
259 | if (!new(instance) IOWorkGroup) return (kIOReturnNoMemory); |
260 | return (kIOReturnSuccess); |
261 | } |
262 | |
263 | #endif /* !KERNEL */ |
264 | |
265 | kern_return_t |
266 | IOWorkGroup::Dispatch(const IORPC rpc) |
267 | { |
268 | return _Dispatch(self: this, rpc); |
269 | } |
270 | |
271 | kern_return_t |
272 | IOWorkGroup::_Dispatch(IOWorkGroup * self, const IORPC rpc) |
273 | { |
274 | kern_return_t ret = kIOReturnUnsupported; |
275 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
276 | |
277 | switch (msg->msgid) |
278 | { |
279 | case IOWorkGroup_SetWorkGroupPort_ID: |
280 | { |
281 | ret = IOWorkGroup::SetWorkGroupPort_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOWorkGroup::SetWorkGroupPort_Handler, *self, &IOWorkGroup::SetWorkGroupPort_Impl)); |
282 | break; |
283 | } |
284 | #if KERNEL |
285 | case IOWorkGroup_InvalidateKernel_ID: |
286 | { |
287 | ret = IOWorkGroup::InvalidateKernel_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOWorkGroup::InvalidateKernel_Handler, *self, &IOWorkGroup::InvalidateKernel_Impl)); |
288 | break; |
289 | } |
290 | #endif /* !KERNEL */ |
291 | |
292 | default: |
293 | ret = OSObject::_Dispatch(self, rpc); |
294 | break; |
295 | } |
296 | |
297 | return (ret); |
298 | } |
299 | |
300 | #if KERNEL |
301 | kern_return_t |
302 | IOWorkGroup::MetaClass::Dispatch(const IORPC rpc) |
303 | { |
304 | #else /* KERNEL */ |
305 | kern_return_t |
306 | IOWorkGroupMetaClass::Dispatch(const IORPC rpc) |
307 | { |
308 | #endif /* !KERNEL */ |
309 | |
310 | kern_return_t ret = kIOReturnUnsupported; |
311 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
312 | |
313 | switch (msg->msgid) |
314 | { |
315 | #if KERNEL |
316 | case IOWorkGroup_Create_ID: |
317 | ret = IOWorkGroup::Create_Invoke(rpc, func: &IOWorkGroup::Create_Impl); |
318 | break; |
319 | #endif /* !KERNEL */ |
320 | |
321 | default: |
322 | ret = OSMetaClassBase::Dispatch(rpc); |
323 | break; |
324 | } |
325 | |
326 | return (ret); |
327 | } |
328 | |
329 | kern_return_t |
330 | IOWorkGroup::Create_Call( |
331 | OSString * name, |
332 | IOUserClient * userClient, |
333 | IOWorkGroup ** workgroup) |
334 | { |
335 | kern_return_t ret; |
336 | union |
337 | { |
338 | IOWorkGroup_Create_Msg msg; |
339 | struct |
340 | { |
341 | IOWorkGroup_Create_Rpl rpl; |
342 | mach_msg_max_trailer_t trailer; |
343 | } rpl; |
344 | } buf; |
345 | struct IOWorkGroup_Create_Msg * msg = &buf.msg; |
346 | struct IOWorkGroup_Create_Rpl * rpl = &buf.rpl.rpl; |
347 | |
348 | memset(s: msg, c: 0, n: sizeof(struct IOWorkGroup_Create_Msg)); |
349 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
350 | msg->mach.msgh.msgh_size = sizeof(*msg); |
351 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
352 | | 0*kIORPCMessageSimpleReply |
353 | | 0*kIORPCMessageLocalHost |
354 | | 0*kIORPCMessageOnqueue; |
355 | msg->content.__hdr.msgid = IOWorkGroup_Create_ID; |
356 | msg->content.__object = (OSObjectRef) OSTypeID(IOWorkGroup); |
357 | msg->content.__hdr.objectRefs = IOWorkGroup_Create_Msg_ObjRefs; |
358 | msg->mach.msgh_body.msgh_descriptor_count = 3; |
359 | |
360 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
361 | |
362 | msg->name__descriptor.type = MACH_MSG_OOL_DESCRIPTOR; |
363 | msg->name__descriptor.copy = MACH_MSG_VIRTUAL_COPY; |
364 | msg->name__descriptor.address = (void *) __builtin_offsetof(IOWorkGroup_Create_Msg_Content, name); |
365 | msg->content.name = name; |
366 | |
367 | msg->userClient__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
368 | msg->content.userClient = (OSObjectRef) userClient; |
369 | |
370 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
371 | ret = OSMTypeID(IOWorkGroup)->Invoke(rpc); |
372 | |
373 | if (kIOReturnSuccess == ret) |
374 | do { |
375 | { |
376 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
377 | if (rpl->content.__hdr.msgid != IOWorkGroup_Create_ID) { ret = kIOReturnIPCError; break; }; |
378 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
379 | if (IOWorkGroup_Create_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
380 | } |
381 | } |
382 | while (false); |
383 | if (kIOReturnSuccess == ret) |
384 | { |
385 | *workgroup = OSDynamicCast(IOWorkGroup, (OSObject *) rpl->content.workgroup); |
386 | if (rpl->content.workgroup && !*workgroup) ret = kIOReturnBadArgument; |
387 | } |
388 | |
389 | |
390 | return (ret); |
391 | } |
392 | |
393 | kern_return_t |
394 | IOWorkGroup::SetWorkGroupPort( |
395 | mach_port_t port, |
396 | OSDispatchMethod supermethod) |
397 | { |
398 | kern_return_t ret; |
399 | union |
400 | { |
401 | IOWorkGroup_SetWorkGroupPort_Msg msg; |
402 | struct |
403 | { |
404 | IOWorkGroup_SetWorkGroupPort_Rpl rpl; |
405 | mach_msg_max_trailer_t trailer; |
406 | } rpl; |
407 | } buf; |
408 | struct IOWorkGroup_SetWorkGroupPort_Msg * msg = &buf.msg; |
409 | struct IOWorkGroup_SetWorkGroupPort_Rpl * rpl = &buf.rpl.rpl; |
410 | |
411 | memset(s: msg, c: 0, n: sizeof(struct IOWorkGroup_SetWorkGroupPort_Msg)); |
412 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
413 | msg->mach.msgh.msgh_size = sizeof(*msg); |
414 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
415 | | 1*kIORPCMessageSimpleReply |
416 | | 0*kIORPCMessageLocalHost |
417 | | 0*kIORPCMessageOnqueue; |
418 | msg->content.__hdr.msgid = IOWorkGroup_SetWorkGroupPort_ID; |
419 | msg->content.__object = (OSObjectRef) this; |
420 | msg->content.__hdr.objectRefs = IOWorkGroup_SetWorkGroupPort_Msg_ObjRefs; |
421 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
422 | |
423 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
424 | |
425 | msg->port__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
426 | msg->port__descriptor.disposition = MACH_MSG_TYPE_COPY_SEND; |
427 | msg->port__descriptor.name = port; |
428 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
429 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
430 | else ret = ((OSObject *)this)->Invoke(rpc); |
431 | |
432 | if (kIOReturnSuccess == ret) |
433 | do { |
434 | { |
435 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
436 | if (rpl->content.__hdr.msgid != IOWorkGroup_SetWorkGroupPort_ID) { ret = kIOReturnIPCError; break; }; |
437 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
438 | if (IOWorkGroup_SetWorkGroupPort_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
439 | } |
440 | } |
441 | while (false); |
442 | if (kIOReturnSuccess == ret) |
443 | { |
444 | } |
445 | |
446 | |
447 | return (ret); |
448 | } |
449 | |
450 | kern_return_t |
451 | IOWorkGroup::InvalidateKernel( |
452 | IOUserClient * client, |
453 | OSDispatchMethod supermethod) |
454 | { |
455 | kern_return_t ret; |
456 | union |
457 | { |
458 | IOWorkGroup_InvalidateKernel_Msg msg; |
459 | struct |
460 | { |
461 | IOWorkGroup_InvalidateKernel_Rpl rpl; |
462 | mach_msg_max_trailer_t trailer; |
463 | } rpl; |
464 | } buf; |
465 | struct IOWorkGroup_InvalidateKernel_Msg * msg = &buf.msg; |
466 | struct IOWorkGroup_InvalidateKernel_Rpl * rpl = &buf.rpl.rpl; |
467 | |
468 | memset(s: msg, c: 0, n: sizeof(struct IOWorkGroup_InvalidateKernel_Msg)); |
469 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
470 | msg->mach.msgh.msgh_size = sizeof(*msg); |
471 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
472 | | 1*kIORPCMessageSimpleReply |
473 | | 0*kIORPCMessageLocalHost |
474 | | 0*kIORPCMessageOnqueue; |
475 | msg->content.__hdr.msgid = IOWorkGroup_InvalidateKernel_ID; |
476 | msg->content.__object = (OSObjectRef) this; |
477 | msg->content.__hdr.objectRefs = IOWorkGroup_InvalidateKernel_Msg_ObjRefs; |
478 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
479 | |
480 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
481 | |
482 | msg->client__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
483 | msg->content.client = (OSObjectRef) client; |
484 | |
485 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
486 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
487 | else ret = ((OSObject *)this)->Invoke(rpc); |
488 | |
489 | if (kIOReturnSuccess == ret) |
490 | do { |
491 | { |
492 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
493 | if (rpl->content.__hdr.msgid != IOWorkGroup_InvalidateKernel_ID) { ret = kIOReturnIPCError; break; }; |
494 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
495 | if (IOWorkGroup_InvalidateKernel_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
496 | } |
497 | } |
498 | while (false); |
499 | if (kIOReturnSuccess == ret) |
500 | { |
501 | } |
502 | |
503 | |
504 | return (ret); |
505 | } |
506 | |
507 | kern_return_t |
508 | IOWorkGroup::Create_Invoke(const IORPC _rpc, |
509 | Create_Handler func) |
510 | { |
511 | IOWorkGroup_Create_Invocation rpc = { .rpc: _rpc }; |
512 | kern_return_t ret; |
513 | IOUserClient * userClient; |
514 | |
515 | if (3 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
516 | if (IOWorkGroup_Create_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
517 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOWorkGroup_Create_Msg)) return (kIOReturnIPCError); |
518 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOWorkGroup_Create_Rpl)) return (kIOReturnIPCError); |
519 | if (((OSObject *) rpc.message->content.name) != NULL && OSDynamicCast(OSString, (OSObject *) rpc.message->content.name) == NULL) { return kIOReturnBadArgument; } |
520 | userClient = OSDynamicCast(IOUserClient, (OSObject *) rpc.message->content.userClient); |
521 | if (!userClient && rpc.message->content.userClient) return (kIOReturnBadArgument); |
522 | |
523 | ret = (*func)( rpc.message->content.name, |
524 | userClient, |
525 | (IOWorkGroup **)&rpc.reply->content.workgroup); |
526 | |
527 | if (kIOReturnSuccess != ret) return (ret); |
528 | |
529 | rpc.reply->content.__hdr.msgid = IOWorkGroup_Create_ID; |
530 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
531 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
532 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
533 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
534 | rpc.reply->content.__hdr.objectRefs = IOWorkGroup_Create_Rpl_ObjRefs; |
535 | rpc.reply->workgroup__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
536 | |
537 | return (ret); |
538 | } |
539 | |
540 | kern_return_t |
541 | IOWorkGroup::SetWorkGroupPort_Invoke(const IORPC _rpc, |
542 | OSMetaClassBase * target, |
543 | SetWorkGroupPort_Handler func) |
544 | { |
545 | IOWorkGroup_SetWorkGroupPort_Invocation rpc = { .rpc: _rpc }; |
546 | kern_return_t ret; |
547 | |
548 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
549 | if (IOWorkGroup_SetWorkGroupPort_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
550 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOWorkGroup_SetWorkGroupPort_Msg)) return (kIOReturnIPCError); |
551 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOWorkGroup_SetWorkGroupPort_Rpl)) return (kIOReturnIPCError); |
552 | |
553 | ret = (*func)(target, |
554 | rpc.message->port__descriptor.name); |
555 | |
556 | if (kIOReturnSuccess != ret) return (ret); |
557 | |
558 | rpc.reply->content.__hdr.msgid = IOWorkGroup_SetWorkGroupPort_ID; |
559 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
560 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
561 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
562 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
563 | rpc.reply->content.__hdr.objectRefs = IOWorkGroup_SetWorkGroupPort_Rpl_ObjRefs; |
564 | |
565 | return (ret); |
566 | } |
567 | |
568 | kern_return_t |
569 | IOWorkGroup::InvalidateKernel_Invoke(const IORPC _rpc, |
570 | OSMetaClassBase * target, |
571 | InvalidateKernel_Handler func) |
572 | { |
573 | IOWorkGroup_InvalidateKernel_Invocation rpc = { .rpc: _rpc }; |
574 | kern_return_t ret; |
575 | IOUserClient * client; |
576 | |
577 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
578 | if (IOWorkGroup_InvalidateKernel_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
579 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOWorkGroup_InvalidateKernel_Msg)) return (kIOReturnIPCError); |
580 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOWorkGroup_InvalidateKernel_Rpl)) return (kIOReturnIPCError); |
581 | client = OSDynamicCast(IOUserClient, (OSObject *) rpc.message->content.client); |
582 | if (!client && rpc.message->content.client) return (kIOReturnBadArgument); |
583 | |
584 | ret = (*func)(target, |
585 | client); |
586 | |
587 | if (kIOReturnSuccess != ret) return (ret); |
588 | |
589 | rpc.reply->content.__hdr.msgid = IOWorkGroup_InvalidateKernel_ID; |
590 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
591 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
592 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
593 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
594 | rpc.reply->content.__hdr.objectRefs = IOWorkGroup_InvalidateKernel_Rpl_ObjRefs; |
595 | |
596 | return (ret); |
597 | } |
598 | |
599 | |
600 | |
601 | |