fidl_data_zx/
zx_common.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// DO NOT EDIT.
6// Generated from FIDL library `zx` by zither, a Fuchsia platform tool.
7
8#![allow(unused_imports)]
9
10use zerocopy::{FromBytes, IntoBytes};
11
12use crate::rights::*;
13
14pub type Status = i32;
15
16pub type Time = i64;
17
18pub type InstantMono = i64;
19
20pub type InstantBoot = i64;
21
22pub type Ticks = i64;
23
24pub type InstantMonoTicks = i64;
25
26pub type InstantBootTicks = i64;
27
28pub type Duration = i64;
29
30pub type DurationMono = i64;
31
32pub type DurationBoot = i64;
33
34pub type Koid = u64;
35
36pub type Off = u64;
37
38pub type Signals = u32;
39
40pub const CHANNEL_MAX_MSG_BYTES: u64 = 65536;
41
42pub const CHANNEL_MAX_MSG_HANDLES: u64 = 64;
43
44pub const IOB_MAX_REGIONS: u64 = 64;
45
46pub const MAX_NAME_LEN: u64 = 32;
47
48pub const MAX_CPUS: u64 = 512;
49
50#[repr(u32)]
51#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
52pub enum ObjType {
53    None = 0,
54    Process = 1,
55    Thread = 2,
56    Vmo = 3,
57    Channel = 4,
58    Event = 5,
59    Port = 6,
60    Interrupt = 9,
61    PciDevice = 11,
62    Log = 12,
63    Socket = 14,
64    Resource = 15,
65    Eventpair = 16,
66    Job = 17,
67    Vmar = 18,
68    Fifo = 19,
69    Guest = 20,
70    Vcpu = 21,
71    Timer = 22,
72    Iommu = 23,
73    Bti = 24,
74    Profile = 25,
75    Pmt = 26,
76    SuspendToken = 27,
77    Pager = 28,
78    Exception = 29,
79    Clock = 30,
80    Stream = 31,
81    Msi = 32,
82    Iob = 33,
83    Counter = 34,
84}
85
86impl ObjType {
87    pub fn from_raw(raw: u32) -> Option<Self> {
88        match raw {
89            0 => Some(Self::None),
90
91            1 => Some(Self::Process),
92
93            2 => Some(Self::Thread),
94
95            3 => Some(Self::Vmo),
96
97            4 => Some(Self::Channel),
98
99            5 => Some(Self::Event),
100
101            6 => Some(Self::Port),
102
103            9 => Some(Self::Interrupt),
104
105            11 => Some(Self::PciDevice),
106
107            12 => Some(Self::Log),
108
109            14 => Some(Self::Socket),
110
111            15 => Some(Self::Resource),
112
113            16 => Some(Self::Eventpair),
114
115            17 => Some(Self::Job),
116
117            18 => Some(Self::Vmar),
118
119            19 => Some(Self::Fifo),
120
121            20 => Some(Self::Guest),
122
123            21 => Some(Self::Vcpu),
124
125            22 => Some(Self::Timer),
126
127            23 => Some(Self::Iommu),
128
129            24 => Some(Self::Bti),
130
131            25 => Some(Self::Profile),
132
133            26 => Some(Self::Pmt),
134
135            27 => Some(Self::SuspendToken),
136
137            28 => Some(Self::Pager),
138
139            29 => Some(Self::Exception),
140
141            30 => Some(Self::Clock),
142
143            31 => Some(Self::Stream),
144
145            32 => Some(Self::Msi),
146
147            33 => Some(Self::Iob),
148
149            34 => Some(Self::Counter),
150
151            _ => None,
152        }
153    }
154}
155
156pub type Handle = u32;