xref: /xnu-8792.61.2/bsd/sys/kernel_types.h (revision 42e220869062b56f8d7d0726fd4c88954f87902c)
1*42e22086SApple OSS Distributions /*
2*42e22086SApple OSS Distributions  * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
3*42e22086SApple OSS Distributions  *
4*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*42e22086SApple OSS Distributions  *
6*42e22086SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*42e22086SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*42e22086SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*42e22086SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*42e22086SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*42e22086SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*42e22086SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*42e22086SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*42e22086SApple OSS Distributions  *
15*42e22086SApple OSS Distributions  * Please obtain a copy of the License at
16*42e22086SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*42e22086SApple OSS Distributions  *
18*42e22086SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*42e22086SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*42e22086SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*42e22086SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*42e22086SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*42e22086SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*42e22086SApple OSS Distributions  * limitations under the License.
25*42e22086SApple OSS Distributions  *
26*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*42e22086SApple OSS Distributions  */
28*42e22086SApple OSS Distributions 
29*42e22086SApple OSS Distributions #ifndef _KERN_SYS_KERNELTYPES_H_
30*42e22086SApple OSS Distributions #define _KERN_SYS_KERNELTYPES_H_
31*42e22086SApple OSS Distributions 
32*42e22086SApple OSS Distributions #include <sys/cdefs.h>
33*42e22086SApple OSS Distributions #include <sys/constrained_ctypes.h>
34*42e22086SApple OSS Distributions #include <sys/types.h>
35*42e22086SApple OSS Distributions #include <stdint.h>
36*42e22086SApple OSS Distributions 
37*42e22086SApple OSS Distributions #ifdef BSD_BUILD
38*42e22086SApple OSS Distributions /* Macros(?) to clear/set/test flags. */
39*42e22086SApple OSS Distributions #define SET(t, f)       (t) |= (f)
40*42e22086SApple OSS Distributions #define CLR(t, f)       (t) &= ~(f)
41*42e22086SApple OSS Distributions #define ISSET(t, f)     ((t) & (f))
42*42e22086SApple OSS Distributions #endif
43*42e22086SApple OSS Distributions 
44*42e22086SApple OSS Distributions 
45*42e22086SApple OSS Distributions typedef int64_t daddr64_t;
46*42e22086SApple OSS Distributions 
47*42e22086SApple OSS Distributions #ifndef BSD_BUILD
48*42e22086SApple OSS Distributions struct buf;
49*42e22086SApple OSS Distributions typedef struct buf * buf_t;
50*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
51*42e22086SApple OSS Distributions 
52*42e22086SApple OSS Distributions struct file;
53*42e22086SApple OSS Distributions typedef struct file * file_t;
54*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
55*42e22086SApple OSS Distributions 
56*42e22086SApple OSS Distributions #ifndef __LP64__
57*42e22086SApple OSS Distributions struct ucred;
58*42e22086SApple OSS Distributions typedef struct ucred * ucred_t;
59*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
60*42e22086SApple OSS Distributions #endif
61*42e22086SApple OSS Distributions 
62*42e22086SApple OSS Distributions #if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */
63*42e22086SApple OSS Distributions struct mount;
64*42e22086SApple OSS Distributions typedef struct mount * mount_t;
65*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
66*42e22086SApple OSS Distributions 
67*42e22086SApple OSS Distributions struct vnode;
68*42e22086SApple OSS Distributions typedef struct vnode * vnode_t;
69*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
70*42e22086SApple OSS Distributions #endif
71*42e22086SApple OSS Distributions 
72*42e22086SApple OSS Distributions struct proc;
73*42e22086SApple OSS Distributions typedef struct proc * proc_t;
74*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
75*42e22086SApple OSS Distributions 
76*42e22086SApple OSS Distributions struct proc_ident;
77*42e22086SApple OSS Distributions typedef struct proc_ident * proc_ident_t;
78*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
79*42e22086SApple OSS Distributions 
80*42e22086SApple OSS Distributions struct uio;
81*42e22086SApple OSS Distributions typedef struct uio * uio_t;
82*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
83*42e22086SApple OSS Distributions 
84*42e22086SApple OSS Distributions struct vfs_context;
85*42e22086SApple OSS Distributions typedef struct vfs_context * vfs_context_t;
86*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
87*42e22086SApple OSS Distributions 
88*42e22086SApple OSS Distributions struct vfstable;
89*42e22086SApple OSS Distributions typedef struct vfstable * vfstable_t;
90*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
91*42e22086SApple OSS Distributions 
92*42e22086SApple OSS Distributions struct __ifnet;
93*42e22086SApple OSS Distributions struct __mbuf;
94*42e22086SApple OSS Distributions struct __pkthdr;
95*42e22086SApple OSS Distributions struct __socket;
96*42e22086SApple OSS Distributions struct __sockopt;
97*42e22086SApple OSS Distributions struct __ifaddr;
98*42e22086SApple OSS Distributions struct __ifmultiaddr;
99*42e22086SApple OSS Distributions struct __ifnet_filter;
100*42e22086SApple OSS Distributions struct __rtentry;
101*42e22086SApple OSS Distributions struct __if_clone;
102*42e22086SApple OSS Distributions struct __bufattr;
103*42e22086SApple OSS Distributions 
104*42e22086SApple OSS Distributions typedef struct __ifnet*                 ifnet_t;
105*42e22086SApple OSS Distributions typedef struct __mbuf*                  mbuf_t;
106*42e22086SApple OSS Distributions typedef struct __pkthdr*                pkthdr_t;
107*42e22086SApple OSS Distributions typedef struct __socket*                socket_t;
108*42e22086SApple OSS Distributions typedef struct __sockopt*               sockopt_t;
109*42e22086SApple OSS Distributions typedef struct __ifaddr*                ifaddr_t;
110*42e22086SApple OSS Distributions typedef struct __ifmultiaddr*   ifmultiaddr_t;
111*42e22086SApple OSS Distributions typedef struct __ifnet_filter*  interface_filter_t;
112*42e22086SApple OSS Distributions typedef struct __rtentry*               route_t;
113*42e22086SApple OSS Distributions typedef struct __if_clone*              if_clone_t;
114*42e22086SApple OSS Distributions typedef struct __bufattr*               bufattr_t;
115*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet, ifnet);
116*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __mbuf, mbuf);
117*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __pkthdr, pkthdr);
118*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __socket, socket);
119*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __sockopt, sockopt);
120*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifaddr, ifaddr);
121*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifmultiaddr, ifmultiaddr);
122*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet_filter, ifnet_filter);
123*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __rtentry, rtentry);
124*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __if_clone, if_clone);
125*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __bufattr, bufattr);
126*42e22086SApple OSS Distributions 
127*42e22086SApple OSS Distributions #else /* BSD_BUILD */
128*42e22086SApple OSS Distributions 
129*42e22086SApple OSS Distributions typedef struct buf * buf_t;
130*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
131*42e22086SApple OSS Distributions 
132*42e22086SApple OSS Distributions typedef struct file * file_t;
133*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
134*42e22086SApple OSS Distributions 
135*42e22086SApple OSS Distributions #ifndef __LP64__
136*42e22086SApple OSS Distributions typedef struct ucred * ucred_t;
137*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
138*42e22086SApple OSS Distributions #endif
139*42e22086SApple OSS Distributions 
140*42e22086SApple OSS Distributions #if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */
141*42e22086SApple OSS Distributions 
142*42e22086SApple OSS Distributions typedef struct mount * mount_t;
143*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
144*42e22086SApple OSS Distributions 
145*42e22086SApple OSS Distributions typedef struct vnode * vnode_t;
146*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
147*42e22086SApple OSS Distributions #endif
148*42e22086SApple OSS Distributions typedef struct proc * proc_t;
149*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
150*42e22086SApple OSS Distributions 
151*42e22086SApple OSS Distributions typedef struct proc_ident * proc_ident_t;
152*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
153*42e22086SApple OSS Distributions 
154*42e22086SApple OSS Distributions typedef struct uio * uio_t;
155*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
156*42e22086SApple OSS Distributions 
157*42e22086SApple OSS Distributions typedef struct user_iovec * user_iovec_t;
158*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct user_iovec, user_iovec);
159*42e22086SApple OSS Distributions 
160*42e22086SApple OSS Distributions typedef struct vfs_context * vfs_context_t;
161*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
162*42e22086SApple OSS Distributions 
163*42e22086SApple OSS Distributions typedef struct vfstable * vfstable_t;
164*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
165*42e22086SApple OSS Distributions 
166*42e22086SApple OSS Distributions #ifdef KERNEL_PRIVATE
167*42e22086SApple OSS Distributions typedef struct kern_iovec * kern_iovec_t;
168*42e22086SApple OSS Distributions typedef struct ifnet*           ifnet_t;
169*42e22086SApple OSS Distributions typedef struct mbuf*            mbuf_t;
170*42e22086SApple OSS Distributions typedef struct pkthdr*          pkthdr_t;
171*42e22086SApple OSS Distributions typedef struct socket*          socket_t;
172*42e22086SApple OSS Distributions typedef struct sockopt*         sockopt_t;
173*42e22086SApple OSS Distributions typedef struct ifaddr*          ifaddr_t;
174*42e22086SApple OSS Distributions typedef struct ifmultiaddr*     ifmultiaddr_t;
175*42e22086SApple OSS Distributions typedef struct ifnet_filter*    interface_filter_t;
176*42e22086SApple OSS Distributions typedef struct rtentry*         route_t;
177*42e22086SApple OSS Distributions typedef struct if_clone*        if_clone_t;
178*42e22086SApple OSS Distributions typedef struct bufattr*         bufattr_t;
179*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct kern_iovec, kern_iovec);
180*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet, ifnet);
181*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mbuf, mbuf);
182*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct pkthdr, pkthdr);
183*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct socket, socket);
184*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockopt, sockopt);
185*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifaddr, ifaddr);
186*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifmultiaddr, ifmultiaddr);
187*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet_filter, ifnet_filter);
188*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct rtentry, rtentry);
189*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct if_clone, if_clone);
190*42e22086SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct bufattr, bufattr);
191*42e22086SApple OSS Distributions 
192*42e22086SApple OSS Distributions #endif /* KERNEL_PRIVATE */
193*42e22086SApple OSS Distributions 
194*42e22086SApple OSS Distributions #endif /* !BSD_BUILD */
195*42e22086SApple OSS Distributions 
196*42e22086SApple OSS Distributions #include <sys/_types/_guid_t.h>
197*42e22086SApple OSS Distributions 
198*42e22086SApple OSS Distributions #ifndef _KAUTH_ACE
199*42e22086SApple OSS Distributions #define _KAUTH_ACE
200*42e22086SApple OSS Distributions struct kauth_ace;
201*42e22086SApple OSS Distributions typedef struct kauth_ace * kauth_ace_t;
202*42e22086SApple OSS Distributions #endif
203*42e22086SApple OSS Distributions #ifndef _KAUTH_ACL
204*42e22086SApple OSS Distributions #define _KAUTH_ACL
205*42e22086SApple OSS Distributions struct kauth_acl;
206*42e22086SApple OSS Distributions typedef struct kauth_acl * kauth_acl_t;
207*42e22086SApple OSS Distributions #endif
208*42e22086SApple OSS Distributions #ifndef _KAUTH_FILESEC
209*42e22086SApple OSS Distributions #define _KAUTH_FILESEC
210*42e22086SApple OSS Distributions struct kauth_filesec;
211*42e22086SApple OSS Distributions typedef struct kauth_filesec * kauth_filesec_t;
212*42e22086SApple OSS Distributions #endif
213*42e22086SApple OSS Distributions 
214*42e22086SApple OSS Distributions #ifndef _KAUTH_ACTION_T
215*42e22086SApple OSS Distributions #define _KAUTH_ACTION_T
216*42e22086SApple OSS Distributions typedef int kauth_action_t;
217*42e22086SApple OSS Distributions #endif
218*42e22086SApple OSS Distributions 
219*42e22086SApple OSS Distributions #endif /* !_KERN_SYS_KERNELTYPES_H_ */
220