1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum DispatcherState {
14 Running,
15 ShuttingDown,
16 Shutdown,
17 Destroyed,
18 #[doc(hidden)]
19 __SourceBreaking {
20 unknown_ordinal: u32,
21 },
22}
23
24#[macro_export]
26macro_rules! DispatcherStateUnknown {
27 () => {
28 _
29 };
30}
31
32impl DispatcherState {
33 #[inline]
34 pub fn from_primitive(prim: u32) -> Option<Self> {
35 match prim {
36 1 => Some(Self::Running),
37 2 => Some(Self::ShuttingDown),
38 3 => Some(Self::Shutdown),
39 4 => Some(Self::Destroyed),
40 _ => None,
41 }
42 }
43
44 #[inline]
45 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
46 match prim {
47 1 => Self::Running,
48 2 => Self::ShuttingDown,
49 3 => Self::Shutdown,
50 4 => Self::Destroyed,
51 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
52 }
53 }
54
55 #[inline]
56 pub fn unknown() -> Self {
57 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
58 }
59
60 #[inline]
61 pub const fn into_primitive(self) -> u32 {
62 match self {
63 Self::Running => 1,
64 Self::ShuttingDown => 2,
65 Self::Shutdown => 3,
66 Self::Destroyed => 4,
67 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
68 }
69 }
70
71 #[inline]
72 pub fn is_unknown(&self) -> bool {
73 match self {
74 Self::__SourceBreaking { unknown_ordinal: _ } => true,
75 _ => false,
76 }
77 }
78}
79
80#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82#[repr(C)]
83pub struct DispatcherDebugStats {
84 pub num_total_requests: u64,
85 pub num_inlined_requests: u64,
86 pub non_inlined: NonInlinedRequestStats,
87}
88
89impl fidl::Persistable for DispatcherDebugStats {}
90
91#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct DispatcherInfo {
94 pub driver: String,
95 pub name: String,
96 pub options: u32,
97 pub scheduler_role: String,
98 pub dispatcher_ptr: u64,
99 pub driver_ptr: u64,
100 pub synchronized: bool,
101 pub allow_sync_calls: bool,
102 pub state: DispatcherState,
103 pub destroy_context: String,
104 pub has_destroy_user_initiated: bool,
105 pub destroy_user_initiated: bool,
106 pub debug_stats: DispatcherDebugStats,
107 pub num_queued_tasks: u64,
108 pub queued_tasks: Vec<QueuedTaskInfo>,
109}
110
111impl fidl::Persistable for DispatcherInfo {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114pub struct DriverHealthCheckRequest {
115 pub request: fidl_fuchsia_driver_framework_common::HealthCheckRequest,
116}
117
118impl fidl::Persistable for DriverHealthCheckRequest {}
119
120#[derive(Clone, Debug, PartialEq)]
121pub struct DriverOnHealthAlertRequest {
122 pub alert: fidl_fuchsia_driver_framework_common::HealthAlert,
123}
124
125impl fidl::Persistable for DriverOnHealthAlertRequest {}
126
127#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
129#[repr(C)]
130pub struct NonInlinedRequestStats {
131 pub allow_sync_calls: u64,
132 pub parallel_dispatch: u64,
133 pub task: u64,
134 pub unknown_thread: u64,
135 pub reentrant: u64,
136 pub channel_wait_not_yet_registered: u64,
137 pub no_thread_migration: u64,
138}
139
140impl fidl::Persistable for NonInlinedRequestStats {}
141
142#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
144pub struct ProcessInfo {
145 pub job_koid: u64,
146 pub process_koid: u64,
147 pub main_thread_koid: u64,
148 pub threads: Vec<ThreadInfo>,
149 pub dispatchers: Vec<DispatcherInfo>,
150}
151
152impl fidl::Persistable for ProcessInfo {}
153
154#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
156pub struct QueuedTaskInfo {
157 pub ptr: u64,
158 pub handler: u64,
159 pub initiating_dispatcher: u64,
160 pub initiating_dispatcher_name: String,
161 pub initiating_driver: u64,
162 pub initiating_driver_url: String,
163}
164
165impl fidl::Persistable for QueuedTaskInfo {}
166
167#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
169pub struct ThreadInfo {
170 pub koid: u64,
171 pub name: String,
172 pub scheduler_role: String,
173}
174
175impl fidl::Persistable for ThreadInfo {}
176
177pub mod driver_ordinals {
178 pub const STOP: u64 = 0x4039e87556689b5f;
179 pub const HEALTH_CHECK: u64 = 0x23bec81c5c7e8d4f;
180 pub const ON_HEALTH_ALERT: u64 = 0x1d324152db5df29f;
181}
182
183pub mod driver_host_ordinals {
184 pub const START: u64 = 0x1848852bd195bde5;
185 pub const START_LOADED_DRIVER: u64 = 0x51957548318c9368;
186 pub const GET_PROCESS_INFO: u64 = 0x1b2d1b727a614973;
187 pub const INSTALL_LOADER: u64 = 0x7022edafc5fcf5a3;
188 pub const TRIGGER_STACK_TRACE: u64 = 0x3bb449b803e49353;
189 pub const FIND_DRIVER_CRASH_INFO_BY_THREAD_KOID: u64 = 0x18b3b336b45a7916;
190}
191
192mod internal {
193 use super::*;
194 unsafe impl fidl::encoding::TypeMarker for DispatcherState {
195 type Owned = Self;
196
197 #[inline(always)]
198 fn inline_align(_context: fidl::encoding::Context) -> usize {
199 std::mem::align_of::<u32>()
200 }
201
202 #[inline(always)]
203 fn inline_size(_context: fidl::encoding::Context) -> usize {
204 std::mem::size_of::<u32>()
205 }
206
207 #[inline(always)]
208 fn encode_is_copy() -> bool {
209 false
210 }
211
212 #[inline(always)]
213 fn decode_is_copy() -> bool {
214 false
215 }
216 }
217
218 impl fidl::encoding::ValueTypeMarker for DispatcherState {
219 type Borrowed<'a> = Self;
220 #[inline(always)]
221 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
222 *value
223 }
224 }
225
226 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
227 for DispatcherState
228 {
229 #[inline]
230 unsafe fn encode(
231 self,
232 encoder: &mut fidl::encoding::Encoder<'_, D>,
233 offset: usize,
234 _depth: fidl::encoding::Depth,
235 ) -> fidl::Result<()> {
236 encoder.debug_check_bounds::<Self>(offset);
237 encoder.write_num(self.into_primitive(), offset);
238 Ok(())
239 }
240 }
241
242 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherState {
243 #[inline(always)]
244 fn new_empty() -> Self {
245 Self::unknown()
246 }
247
248 #[inline]
249 unsafe fn decode(
250 &mut self,
251 decoder: &mut fidl::encoding::Decoder<'_, D>,
252 offset: usize,
253 _depth: fidl::encoding::Depth,
254 ) -> fidl::Result<()> {
255 decoder.debug_check_bounds::<Self>(offset);
256 let prim = decoder.read_num::<u32>(offset);
257
258 *self = Self::from_primitive_allow_unknown(prim);
259 Ok(())
260 }
261 }
262
263 impl fidl::encoding::ValueTypeMarker for DispatcherDebugStats {
264 type Borrowed<'a> = &'a Self;
265 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
266 value
267 }
268 }
269
270 unsafe impl fidl::encoding::TypeMarker for DispatcherDebugStats {
271 type Owned = Self;
272
273 #[inline(always)]
274 fn inline_align(_context: fidl::encoding::Context) -> usize {
275 8
276 }
277
278 #[inline(always)]
279 fn inline_size(_context: fidl::encoding::Context) -> usize {
280 72
281 }
282 #[inline(always)]
283 fn encode_is_copy() -> bool {
284 true
285 }
286
287 #[inline(always)]
288 fn decode_is_copy() -> bool {
289 true
290 }
291 }
292
293 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DispatcherDebugStats, D>
294 for &DispatcherDebugStats
295 {
296 #[inline]
297 unsafe fn encode(
298 self,
299 encoder: &mut fidl::encoding::Encoder<'_, D>,
300 offset: usize,
301 _depth: fidl::encoding::Depth,
302 ) -> fidl::Result<()> {
303 encoder.debug_check_bounds::<DispatcherDebugStats>(offset);
304 unsafe {
305 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
307 (buf_ptr as *mut DispatcherDebugStats)
308 .write_unaligned((self as *const DispatcherDebugStats).read());
309 }
312 Ok(())
313 }
314 }
315 unsafe impl<
316 D: fidl::encoding::ResourceDialect,
317 T0: fidl::encoding::Encode<u64, D>,
318 T1: fidl::encoding::Encode<u64, D>,
319 T2: fidl::encoding::Encode<NonInlinedRequestStats, D>,
320 > fidl::encoding::Encode<DispatcherDebugStats, D> for (T0, T1, T2)
321 {
322 #[inline]
323 unsafe fn encode(
324 self,
325 encoder: &mut fidl::encoding::Encoder<'_, D>,
326 offset: usize,
327 depth: fidl::encoding::Depth,
328 ) -> fidl::Result<()> {
329 encoder.debug_check_bounds::<DispatcherDebugStats>(offset);
330 self.0.encode(encoder, offset + 0, depth)?;
334 self.1.encode(encoder, offset + 8, depth)?;
335 self.2.encode(encoder, offset + 16, depth)?;
336 Ok(())
337 }
338 }
339
340 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherDebugStats {
341 #[inline(always)]
342 fn new_empty() -> Self {
343 Self {
344 num_total_requests: fidl::new_empty!(u64, D),
345 num_inlined_requests: fidl::new_empty!(u64, D),
346 non_inlined: fidl::new_empty!(NonInlinedRequestStats, D),
347 }
348 }
349
350 #[inline]
351 unsafe fn decode(
352 &mut self,
353 decoder: &mut fidl::encoding::Decoder<'_, D>,
354 offset: usize,
355 _depth: fidl::encoding::Depth,
356 ) -> fidl::Result<()> {
357 decoder.debug_check_bounds::<Self>(offset);
358 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
359 unsafe {
362 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 72);
363 }
364 Ok(())
365 }
366 }
367
368 impl fidl::encoding::ValueTypeMarker for DispatcherInfo {
369 type Borrowed<'a> = &'a Self;
370 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
371 value
372 }
373 }
374
375 unsafe impl fidl::encoding::TypeMarker for DispatcherInfo {
376 type Owned = Self;
377
378 #[inline(always)]
379 fn inline_align(_context: fidl::encoding::Context) -> usize {
380 8
381 }
382
383 #[inline(always)]
384 fn inline_size(_context: fidl::encoding::Context) -> usize {
385 200
386 }
387 }
388
389 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DispatcherInfo, D>
390 for &DispatcherInfo
391 {
392 #[inline]
393 unsafe fn encode(
394 self,
395 encoder: &mut fidl::encoding::Encoder<'_, D>,
396 offset: usize,
397 _depth: fidl::encoding::Depth,
398 ) -> fidl::Result<()> {
399 encoder.debug_check_bounds::<DispatcherInfo>(offset);
400 fidl::encoding::Encode::<DispatcherInfo, D>::encode(
402 (
403 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.driver),
404 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
405 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
406 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.scheduler_role),
407 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dispatcher_ptr),
408 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_ptr),
409 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.synchronized),
410 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.allow_sync_calls),
411 <DispatcherState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
412 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.destroy_context),
413 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_destroy_user_initiated),
414 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.destroy_user_initiated),
415 <DispatcherDebugStats as fidl::encoding::ValueTypeMarker>::borrow(&self.debug_stats),
416 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_queued_tasks),
417 <fidl::encoding::UnboundedVector<QueuedTaskInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.queued_tasks),
418 ),
419 encoder, offset, _depth
420 )
421 }
422 }
423 unsafe impl<
424 D: fidl::encoding::ResourceDialect,
425 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
426 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
427 T2: fidl::encoding::Encode<u32, D>,
428 T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
429 T4: fidl::encoding::Encode<u64, D>,
430 T5: fidl::encoding::Encode<u64, D>,
431 T6: fidl::encoding::Encode<bool, D>,
432 T7: fidl::encoding::Encode<bool, D>,
433 T8: fidl::encoding::Encode<DispatcherState, D>,
434 T9: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
435 T10: fidl::encoding::Encode<bool, D>,
436 T11: fidl::encoding::Encode<bool, D>,
437 T12: fidl::encoding::Encode<DispatcherDebugStats, D>,
438 T13: fidl::encoding::Encode<u64, D>,
439 T14: fidl::encoding::Encode<fidl::encoding::UnboundedVector<QueuedTaskInfo>, D>,
440 > fidl::encoding::Encode<DispatcherInfo, D>
441 for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
442 {
443 #[inline]
444 unsafe fn encode(
445 self,
446 encoder: &mut fidl::encoding::Encoder<'_, D>,
447 offset: usize,
448 depth: fidl::encoding::Depth,
449 ) -> fidl::Result<()> {
450 encoder.debug_check_bounds::<DispatcherInfo>(offset);
451 unsafe {
454 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
455 (ptr as *mut u64).write_unaligned(0);
456 }
457 unsafe {
458 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
459 (ptr as *mut u64).write_unaligned(0);
460 }
461 unsafe {
462 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(96);
463 (ptr as *mut u64).write_unaligned(0);
464 }
465 self.0.encode(encoder, offset + 0, depth)?;
467 self.1.encode(encoder, offset + 16, depth)?;
468 self.2.encode(encoder, offset + 32, depth)?;
469 self.3.encode(encoder, offset + 40, depth)?;
470 self.4.encode(encoder, offset + 56, depth)?;
471 self.5.encode(encoder, offset + 64, depth)?;
472 self.6.encode(encoder, offset + 72, depth)?;
473 self.7.encode(encoder, offset + 73, depth)?;
474 self.8.encode(encoder, offset + 76, depth)?;
475 self.9.encode(encoder, offset + 80, depth)?;
476 self.10.encode(encoder, offset + 96, depth)?;
477 self.11.encode(encoder, offset + 97, depth)?;
478 self.12.encode(encoder, offset + 104, depth)?;
479 self.13.encode(encoder, offset + 176, depth)?;
480 self.14.encode(encoder, offset + 184, depth)?;
481 Ok(())
482 }
483 }
484
485 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherInfo {
486 #[inline(always)]
487 fn new_empty() -> Self {
488 Self {
489 driver: fidl::new_empty!(fidl::encoding::UnboundedString, D),
490 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
491 options: fidl::new_empty!(u32, D),
492 scheduler_role: fidl::new_empty!(fidl::encoding::UnboundedString, D),
493 dispatcher_ptr: fidl::new_empty!(u64, D),
494 driver_ptr: fidl::new_empty!(u64, D),
495 synchronized: fidl::new_empty!(bool, D),
496 allow_sync_calls: fidl::new_empty!(bool, D),
497 state: fidl::new_empty!(DispatcherState, D),
498 destroy_context: fidl::new_empty!(fidl::encoding::UnboundedString, D),
499 has_destroy_user_initiated: fidl::new_empty!(bool, D),
500 destroy_user_initiated: fidl::new_empty!(bool, D),
501 debug_stats: fidl::new_empty!(DispatcherDebugStats, D),
502 num_queued_tasks: fidl::new_empty!(u64, D),
503 queued_tasks: fidl::new_empty!(fidl::encoding::UnboundedVector<QueuedTaskInfo>, D),
504 }
505 }
506
507 #[inline]
508 unsafe fn decode(
509 &mut self,
510 decoder: &mut fidl::encoding::Decoder<'_, D>,
511 offset: usize,
512 _depth: fidl::encoding::Depth,
513 ) -> fidl::Result<()> {
514 decoder.debug_check_bounds::<Self>(offset);
515 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
517 let padval = unsafe { (ptr as *const u64).read_unaligned() };
518 let mask = 0xffffffff00000000u64;
519 let maskedval = padval & mask;
520 if maskedval != 0 {
521 return Err(fidl::Error::NonZeroPadding {
522 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
523 });
524 }
525 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
526 let padval = unsafe { (ptr as *const u64).read_unaligned() };
527 let mask = 0xffff0000u64;
528 let maskedval = padval & mask;
529 if maskedval != 0 {
530 return Err(fidl::Error::NonZeroPadding {
531 padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
532 });
533 }
534 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(96) };
535 let padval = unsafe { (ptr as *const u64).read_unaligned() };
536 let mask = 0xffffffffffff0000u64;
537 let maskedval = padval & mask;
538 if maskedval != 0 {
539 return Err(fidl::Error::NonZeroPadding {
540 padding_start: offset + 96 + ((mask as u64).trailing_zeros() / 8) as usize,
541 });
542 }
543 fidl::decode!(
544 fidl::encoding::UnboundedString,
545 D,
546 &mut self.driver,
547 decoder,
548 offset + 0,
549 _depth
550 )?;
551 fidl::decode!(
552 fidl::encoding::UnboundedString,
553 D,
554 &mut self.name,
555 decoder,
556 offset + 16,
557 _depth
558 )?;
559 fidl::decode!(u32, D, &mut self.options, decoder, offset + 32, _depth)?;
560 fidl::decode!(
561 fidl::encoding::UnboundedString,
562 D,
563 &mut self.scheduler_role,
564 decoder,
565 offset + 40,
566 _depth
567 )?;
568 fidl::decode!(u64, D, &mut self.dispatcher_ptr, decoder, offset + 56, _depth)?;
569 fidl::decode!(u64, D, &mut self.driver_ptr, decoder, offset + 64, _depth)?;
570 fidl::decode!(bool, D, &mut self.synchronized, decoder, offset + 72, _depth)?;
571 fidl::decode!(bool, D, &mut self.allow_sync_calls, decoder, offset + 73, _depth)?;
572 fidl::decode!(DispatcherState, D, &mut self.state, decoder, offset + 76, _depth)?;
573 fidl::decode!(
574 fidl::encoding::UnboundedString,
575 D,
576 &mut self.destroy_context,
577 decoder,
578 offset + 80,
579 _depth
580 )?;
581 fidl::decode!(
582 bool,
583 D,
584 &mut self.has_destroy_user_initiated,
585 decoder,
586 offset + 96,
587 _depth
588 )?;
589 fidl::decode!(bool, D, &mut self.destroy_user_initiated, decoder, offset + 97, _depth)?;
590 fidl::decode!(
591 DispatcherDebugStats,
592 D,
593 &mut self.debug_stats,
594 decoder,
595 offset + 104,
596 _depth
597 )?;
598 fidl::decode!(u64, D, &mut self.num_queued_tasks, decoder, offset + 176, _depth)?;
599 fidl::decode!(
600 fidl::encoding::UnboundedVector<QueuedTaskInfo>,
601 D,
602 &mut self.queued_tasks,
603 decoder,
604 offset + 184,
605 _depth
606 )?;
607 Ok(())
608 }
609 }
610
611 impl fidl::encoding::ValueTypeMarker for DriverHealthCheckRequest {
612 type Borrowed<'a> = &'a Self;
613 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
614 value
615 }
616 }
617
618 unsafe impl fidl::encoding::TypeMarker for DriverHealthCheckRequest {
619 type Owned = Self;
620
621 #[inline(always)]
622 fn inline_align(_context: fidl::encoding::Context) -> usize {
623 4
624 }
625
626 #[inline(always)]
627 fn inline_size(_context: fidl::encoding::Context) -> usize {
628 4
629 }
630 }
631
632 unsafe impl<D: fidl::encoding::ResourceDialect>
633 fidl::encoding::Encode<DriverHealthCheckRequest, D> for &DriverHealthCheckRequest
634 {
635 #[inline]
636 unsafe fn encode(
637 self,
638 encoder: &mut fidl::encoding::Encoder<'_, D>,
639 offset: usize,
640 _depth: fidl::encoding::Depth,
641 ) -> fidl::Result<()> {
642 encoder.debug_check_bounds::<DriverHealthCheckRequest>(offset);
643 fidl::encoding::Encode::<DriverHealthCheckRequest, D>::encode(
645 (
646 <fidl_fuchsia_driver_framework_common::HealthCheckRequest as fidl::encoding::ValueTypeMarker>::borrow(&self.request),
647 ),
648 encoder, offset, _depth
649 )
650 }
651 }
652 unsafe impl<
653 D: fidl::encoding::ResourceDialect,
654 T0: fidl::encoding::Encode<fidl_fuchsia_driver_framework_common::HealthCheckRequest, D>,
655 > fidl::encoding::Encode<DriverHealthCheckRequest, D> for (T0,)
656 {
657 #[inline]
658 unsafe fn encode(
659 self,
660 encoder: &mut fidl::encoding::Encoder<'_, D>,
661 offset: usize,
662 depth: fidl::encoding::Depth,
663 ) -> fidl::Result<()> {
664 encoder.debug_check_bounds::<DriverHealthCheckRequest>(offset);
665 self.0.encode(encoder, offset + 0, depth)?;
669 Ok(())
670 }
671 }
672
673 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
674 for DriverHealthCheckRequest
675 {
676 #[inline(always)]
677 fn new_empty() -> Self {
678 Self {
679 request: fidl::new_empty!(
680 fidl_fuchsia_driver_framework_common::HealthCheckRequest,
681 D
682 ),
683 }
684 }
685
686 #[inline]
687 unsafe fn decode(
688 &mut self,
689 decoder: &mut fidl::encoding::Decoder<'_, D>,
690 offset: usize,
691 _depth: fidl::encoding::Depth,
692 ) -> fidl::Result<()> {
693 decoder.debug_check_bounds::<Self>(offset);
694 fidl::decode!(
696 fidl_fuchsia_driver_framework_common::HealthCheckRequest,
697 D,
698 &mut self.request,
699 decoder,
700 offset + 0,
701 _depth
702 )?;
703 Ok(())
704 }
705 }
706
707 impl fidl::encoding::ValueTypeMarker for DriverOnHealthAlertRequest {
708 type Borrowed<'a> = &'a Self;
709 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
710 value
711 }
712 }
713
714 unsafe impl fidl::encoding::TypeMarker for DriverOnHealthAlertRequest {
715 type Owned = Self;
716
717 #[inline(always)]
718 fn inline_align(_context: fidl::encoding::Context) -> usize {
719 8
720 }
721
722 #[inline(always)]
723 fn inline_size(_context: fidl::encoding::Context) -> usize {
724 16
725 }
726 }
727
728 unsafe impl<D: fidl::encoding::ResourceDialect>
729 fidl::encoding::Encode<DriverOnHealthAlertRequest, D> for &DriverOnHealthAlertRequest
730 {
731 #[inline]
732 unsafe fn encode(
733 self,
734 encoder: &mut fidl::encoding::Encoder<'_, D>,
735 offset: usize,
736 _depth: fidl::encoding::Depth,
737 ) -> fidl::Result<()> {
738 encoder.debug_check_bounds::<DriverOnHealthAlertRequest>(offset);
739 fidl::encoding::Encode::<DriverOnHealthAlertRequest, D>::encode(
741 (
742 <fidl_fuchsia_driver_framework_common::HealthAlert as fidl::encoding::ValueTypeMarker>::borrow(&self.alert),
743 ),
744 encoder, offset, _depth
745 )
746 }
747 }
748 unsafe impl<
749 D: fidl::encoding::ResourceDialect,
750 T0: fidl::encoding::Encode<fidl_fuchsia_driver_framework_common::HealthAlert, D>,
751 > fidl::encoding::Encode<DriverOnHealthAlertRequest, D> for (T0,)
752 {
753 #[inline]
754 unsafe fn encode(
755 self,
756 encoder: &mut fidl::encoding::Encoder<'_, D>,
757 offset: usize,
758 depth: fidl::encoding::Depth,
759 ) -> fidl::Result<()> {
760 encoder.debug_check_bounds::<DriverOnHealthAlertRequest>(offset);
761 self.0.encode(encoder, offset + 0, depth)?;
765 Ok(())
766 }
767 }
768
769 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
770 for DriverOnHealthAlertRequest
771 {
772 #[inline(always)]
773 fn new_empty() -> Self {
774 Self { alert: fidl::new_empty!(fidl_fuchsia_driver_framework_common::HealthAlert, D) }
775 }
776
777 #[inline]
778 unsafe fn decode(
779 &mut self,
780 decoder: &mut fidl::encoding::Decoder<'_, D>,
781 offset: usize,
782 _depth: fidl::encoding::Depth,
783 ) -> fidl::Result<()> {
784 decoder.debug_check_bounds::<Self>(offset);
785 fidl::decode!(
787 fidl_fuchsia_driver_framework_common::HealthAlert,
788 D,
789 &mut self.alert,
790 decoder,
791 offset + 0,
792 _depth
793 )?;
794 Ok(())
795 }
796 }
797
798 impl fidl::encoding::ValueTypeMarker for NonInlinedRequestStats {
799 type Borrowed<'a> = &'a Self;
800 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
801 value
802 }
803 }
804
805 unsafe impl fidl::encoding::TypeMarker for NonInlinedRequestStats {
806 type Owned = Self;
807
808 #[inline(always)]
809 fn inline_align(_context: fidl::encoding::Context) -> usize {
810 8
811 }
812
813 #[inline(always)]
814 fn inline_size(_context: fidl::encoding::Context) -> usize {
815 56
816 }
817 #[inline(always)]
818 fn encode_is_copy() -> bool {
819 true
820 }
821
822 #[inline(always)]
823 fn decode_is_copy() -> bool {
824 true
825 }
826 }
827
828 unsafe impl<D: fidl::encoding::ResourceDialect>
829 fidl::encoding::Encode<NonInlinedRequestStats, D> for &NonInlinedRequestStats
830 {
831 #[inline]
832 unsafe fn encode(
833 self,
834 encoder: &mut fidl::encoding::Encoder<'_, D>,
835 offset: usize,
836 _depth: fidl::encoding::Depth,
837 ) -> fidl::Result<()> {
838 encoder.debug_check_bounds::<NonInlinedRequestStats>(offset);
839 unsafe {
840 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
842 (buf_ptr as *mut NonInlinedRequestStats)
843 .write_unaligned((self as *const NonInlinedRequestStats).read());
844 }
847 Ok(())
848 }
849 }
850 unsafe impl<
851 D: fidl::encoding::ResourceDialect,
852 T0: fidl::encoding::Encode<u64, D>,
853 T1: fidl::encoding::Encode<u64, D>,
854 T2: fidl::encoding::Encode<u64, D>,
855 T3: fidl::encoding::Encode<u64, D>,
856 T4: fidl::encoding::Encode<u64, D>,
857 T5: fidl::encoding::Encode<u64, D>,
858 T6: fidl::encoding::Encode<u64, D>,
859 > fidl::encoding::Encode<NonInlinedRequestStats, D> for (T0, T1, T2, T3, T4, T5, T6)
860 {
861 #[inline]
862 unsafe fn encode(
863 self,
864 encoder: &mut fidl::encoding::Encoder<'_, D>,
865 offset: usize,
866 depth: fidl::encoding::Depth,
867 ) -> fidl::Result<()> {
868 encoder.debug_check_bounds::<NonInlinedRequestStats>(offset);
869 self.0.encode(encoder, offset + 0, depth)?;
873 self.1.encode(encoder, offset + 8, depth)?;
874 self.2.encode(encoder, offset + 16, depth)?;
875 self.3.encode(encoder, offset + 24, depth)?;
876 self.4.encode(encoder, offset + 32, depth)?;
877 self.5.encode(encoder, offset + 40, depth)?;
878 self.6.encode(encoder, offset + 48, depth)?;
879 Ok(())
880 }
881 }
882
883 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
884 for NonInlinedRequestStats
885 {
886 #[inline(always)]
887 fn new_empty() -> Self {
888 Self {
889 allow_sync_calls: fidl::new_empty!(u64, D),
890 parallel_dispatch: fidl::new_empty!(u64, D),
891 task: fidl::new_empty!(u64, D),
892 unknown_thread: fidl::new_empty!(u64, D),
893 reentrant: fidl::new_empty!(u64, D),
894 channel_wait_not_yet_registered: fidl::new_empty!(u64, D),
895 no_thread_migration: fidl::new_empty!(u64, D),
896 }
897 }
898
899 #[inline]
900 unsafe fn decode(
901 &mut self,
902 decoder: &mut fidl::encoding::Decoder<'_, D>,
903 offset: usize,
904 _depth: fidl::encoding::Depth,
905 ) -> fidl::Result<()> {
906 decoder.debug_check_bounds::<Self>(offset);
907 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
908 unsafe {
911 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
912 }
913 Ok(())
914 }
915 }
916
917 impl fidl::encoding::ValueTypeMarker for ProcessInfo {
918 type Borrowed<'a> = &'a Self;
919 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
920 value
921 }
922 }
923
924 unsafe impl fidl::encoding::TypeMarker for ProcessInfo {
925 type Owned = Self;
926
927 #[inline(always)]
928 fn inline_align(_context: fidl::encoding::Context) -> usize {
929 8
930 }
931
932 #[inline(always)]
933 fn inline_size(_context: fidl::encoding::Context) -> usize {
934 56
935 }
936 }
937
938 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProcessInfo, D>
939 for &ProcessInfo
940 {
941 #[inline]
942 unsafe fn encode(
943 self,
944 encoder: &mut fidl::encoding::Encoder<'_, D>,
945 offset: usize,
946 _depth: fidl::encoding::Depth,
947 ) -> fidl::Result<()> {
948 encoder.debug_check_bounds::<ProcessInfo>(offset);
949 fidl::encoding::Encode::<ProcessInfo, D>::encode(
951 (
952 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.job_koid),
953 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.process_koid),
954 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.main_thread_koid),
955 <fidl::encoding::UnboundedVector<ThreadInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.threads),
956 <fidl::encoding::UnboundedVector<DispatcherInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.dispatchers),
957 ),
958 encoder, offset, _depth
959 )
960 }
961 }
962 unsafe impl<
963 D: fidl::encoding::ResourceDialect,
964 T0: fidl::encoding::Encode<u64, D>,
965 T1: fidl::encoding::Encode<u64, D>,
966 T2: fidl::encoding::Encode<u64, D>,
967 T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ThreadInfo>, D>,
968 T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DispatcherInfo>, D>,
969 > fidl::encoding::Encode<ProcessInfo, D> for (T0, T1, T2, T3, T4)
970 {
971 #[inline]
972 unsafe fn encode(
973 self,
974 encoder: &mut fidl::encoding::Encoder<'_, D>,
975 offset: usize,
976 depth: fidl::encoding::Depth,
977 ) -> fidl::Result<()> {
978 encoder.debug_check_bounds::<ProcessInfo>(offset);
979 self.0.encode(encoder, offset + 0, depth)?;
983 self.1.encode(encoder, offset + 8, depth)?;
984 self.2.encode(encoder, offset + 16, depth)?;
985 self.3.encode(encoder, offset + 24, depth)?;
986 self.4.encode(encoder, offset + 40, depth)?;
987 Ok(())
988 }
989 }
990
991 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProcessInfo {
992 #[inline(always)]
993 fn new_empty() -> Self {
994 Self {
995 job_koid: fidl::new_empty!(u64, D),
996 process_koid: fidl::new_empty!(u64, D),
997 main_thread_koid: fidl::new_empty!(u64, D),
998 threads: fidl::new_empty!(fidl::encoding::UnboundedVector<ThreadInfo>, D),
999 dispatchers: fidl::new_empty!(fidl::encoding::UnboundedVector<DispatcherInfo>, D),
1000 }
1001 }
1002
1003 #[inline]
1004 unsafe fn decode(
1005 &mut self,
1006 decoder: &mut fidl::encoding::Decoder<'_, D>,
1007 offset: usize,
1008 _depth: fidl::encoding::Depth,
1009 ) -> fidl::Result<()> {
1010 decoder.debug_check_bounds::<Self>(offset);
1011 fidl::decode!(u64, D, &mut self.job_koid, decoder, offset + 0, _depth)?;
1013 fidl::decode!(u64, D, &mut self.process_koid, decoder, offset + 8, _depth)?;
1014 fidl::decode!(u64, D, &mut self.main_thread_koid, decoder, offset + 16, _depth)?;
1015 fidl::decode!(
1016 fidl::encoding::UnboundedVector<ThreadInfo>,
1017 D,
1018 &mut self.threads,
1019 decoder,
1020 offset + 24,
1021 _depth
1022 )?;
1023 fidl::decode!(
1024 fidl::encoding::UnboundedVector<DispatcherInfo>,
1025 D,
1026 &mut self.dispatchers,
1027 decoder,
1028 offset + 40,
1029 _depth
1030 )?;
1031 Ok(())
1032 }
1033 }
1034
1035 impl fidl::encoding::ValueTypeMarker for QueuedTaskInfo {
1036 type Borrowed<'a> = &'a Self;
1037 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1038 value
1039 }
1040 }
1041
1042 unsafe impl fidl::encoding::TypeMarker for QueuedTaskInfo {
1043 type Owned = Self;
1044
1045 #[inline(always)]
1046 fn inline_align(_context: fidl::encoding::Context) -> usize {
1047 8
1048 }
1049
1050 #[inline(always)]
1051 fn inline_size(_context: fidl::encoding::Context) -> usize {
1052 64
1053 }
1054 }
1055
1056 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<QueuedTaskInfo, D>
1057 for &QueuedTaskInfo
1058 {
1059 #[inline]
1060 unsafe fn encode(
1061 self,
1062 encoder: &mut fidl::encoding::Encoder<'_, D>,
1063 offset: usize,
1064 _depth: fidl::encoding::Depth,
1065 ) -> fidl::Result<()> {
1066 encoder.debug_check_bounds::<QueuedTaskInfo>(offset);
1067 fidl::encoding::Encode::<QueuedTaskInfo, D>::encode(
1069 (
1070 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ptr),
1071 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.handler),
1072 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.initiating_dispatcher),
1073 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1074 &self.initiating_dispatcher_name,
1075 ),
1076 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.initiating_driver),
1077 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1078 &self.initiating_driver_url,
1079 ),
1080 ),
1081 encoder,
1082 offset,
1083 _depth,
1084 )
1085 }
1086 }
1087 unsafe impl<
1088 D: fidl::encoding::ResourceDialect,
1089 T0: fidl::encoding::Encode<u64, D>,
1090 T1: fidl::encoding::Encode<u64, D>,
1091 T2: fidl::encoding::Encode<u64, D>,
1092 T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1093 T4: fidl::encoding::Encode<u64, D>,
1094 T5: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1095 > fidl::encoding::Encode<QueuedTaskInfo, D> for (T0, T1, T2, T3, T4, T5)
1096 {
1097 #[inline]
1098 unsafe fn encode(
1099 self,
1100 encoder: &mut fidl::encoding::Encoder<'_, D>,
1101 offset: usize,
1102 depth: fidl::encoding::Depth,
1103 ) -> fidl::Result<()> {
1104 encoder.debug_check_bounds::<QueuedTaskInfo>(offset);
1105 self.0.encode(encoder, offset + 0, depth)?;
1109 self.1.encode(encoder, offset + 8, depth)?;
1110 self.2.encode(encoder, offset + 16, depth)?;
1111 self.3.encode(encoder, offset + 24, depth)?;
1112 self.4.encode(encoder, offset + 40, depth)?;
1113 self.5.encode(encoder, offset + 48, depth)?;
1114 Ok(())
1115 }
1116 }
1117
1118 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QueuedTaskInfo {
1119 #[inline(always)]
1120 fn new_empty() -> Self {
1121 Self {
1122 ptr: fidl::new_empty!(u64, D),
1123 handler: fidl::new_empty!(u64, D),
1124 initiating_dispatcher: fidl::new_empty!(u64, D),
1125 initiating_dispatcher_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1126 initiating_driver: fidl::new_empty!(u64, D),
1127 initiating_driver_url: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1128 }
1129 }
1130
1131 #[inline]
1132 unsafe fn decode(
1133 &mut self,
1134 decoder: &mut fidl::encoding::Decoder<'_, D>,
1135 offset: usize,
1136 _depth: fidl::encoding::Depth,
1137 ) -> fidl::Result<()> {
1138 decoder.debug_check_bounds::<Self>(offset);
1139 fidl::decode!(u64, D, &mut self.ptr, decoder, offset + 0, _depth)?;
1141 fidl::decode!(u64, D, &mut self.handler, decoder, offset + 8, _depth)?;
1142 fidl::decode!(u64, D, &mut self.initiating_dispatcher, decoder, offset + 16, _depth)?;
1143 fidl::decode!(
1144 fidl::encoding::UnboundedString,
1145 D,
1146 &mut self.initiating_dispatcher_name,
1147 decoder,
1148 offset + 24,
1149 _depth
1150 )?;
1151 fidl::decode!(u64, D, &mut self.initiating_driver, decoder, offset + 40, _depth)?;
1152 fidl::decode!(
1153 fidl::encoding::UnboundedString,
1154 D,
1155 &mut self.initiating_driver_url,
1156 decoder,
1157 offset + 48,
1158 _depth
1159 )?;
1160 Ok(())
1161 }
1162 }
1163
1164 impl fidl::encoding::ValueTypeMarker for ThreadInfo {
1165 type Borrowed<'a> = &'a Self;
1166 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1167 value
1168 }
1169 }
1170
1171 unsafe impl fidl::encoding::TypeMarker for ThreadInfo {
1172 type Owned = Self;
1173
1174 #[inline(always)]
1175 fn inline_align(_context: fidl::encoding::Context) -> usize {
1176 8
1177 }
1178
1179 #[inline(always)]
1180 fn inline_size(_context: fidl::encoding::Context) -> usize {
1181 40
1182 }
1183 }
1184
1185 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ThreadInfo, D>
1186 for &ThreadInfo
1187 {
1188 #[inline]
1189 unsafe fn encode(
1190 self,
1191 encoder: &mut fidl::encoding::Encoder<'_, D>,
1192 offset: usize,
1193 _depth: fidl::encoding::Depth,
1194 ) -> fidl::Result<()> {
1195 encoder.debug_check_bounds::<ThreadInfo>(offset);
1196 fidl::encoding::Encode::<ThreadInfo, D>::encode(
1198 (
1199 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.koid),
1200 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1201 &self.name,
1202 ),
1203 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1204 &self.scheduler_role,
1205 ),
1206 ),
1207 encoder,
1208 offset,
1209 _depth,
1210 )
1211 }
1212 }
1213 unsafe impl<
1214 D: fidl::encoding::ResourceDialect,
1215 T0: fidl::encoding::Encode<u64, D>,
1216 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1217 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1218 > fidl::encoding::Encode<ThreadInfo, D> for (T0, T1, T2)
1219 {
1220 #[inline]
1221 unsafe fn encode(
1222 self,
1223 encoder: &mut fidl::encoding::Encoder<'_, D>,
1224 offset: usize,
1225 depth: fidl::encoding::Depth,
1226 ) -> fidl::Result<()> {
1227 encoder.debug_check_bounds::<ThreadInfo>(offset);
1228 self.0.encode(encoder, offset + 0, depth)?;
1232 self.1.encode(encoder, offset + 8, depth)?;
1233 self.2.encode(encoder, offset + 24, depth)?;
1234 Ok(())
1235 }
1236 }
1237
1238 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThreadInfo {
1239 #[inline(always)]
1240 fn new_empty() -> Self {
1241 Self {
1242 koid: fidl::new_empty!(u64, D),
1243 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1244 scheduler_role: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1245 }
1246 }
1247
1248 #[inline]
1249 unsafe fn decode(
1250 &mut self,
1251 decoder: &mut fidl::encoding::Decoder<'_, D>,
1252 offset: usize,
1253 _depth: fidl::encoding::Depth,
1254 ) -> fidl::Result<()> {
1255 decoder.debug_check_bounds::<Self>(offset);
1256 fidl::decode!(u64, D, &mut self.koid, decoder, offset + 0, _depth)?;
1258 fidl::decode!(
1259 fidl::encoding::UnboundedString,
1260 D,
1261 &mut self.name,
1262 decoder,
1263 offset + 8,
1264 _depth
1265 )?;
1266 fidl::decode!(
1267 fidl::encoding::UnboundedString,
1268 D,
1269 &mut self.scheduler_role,
1270 decoder,
1271 offset + 24,
1272 _depth
1273 )?;
1274 Ok(())
1275 }
1276 }
1277}