1255365Sdes/*
2255365Sdes * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
3255365Sdes *
4255365Sdes * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5255365Sdes *
6255365Sdes * This file contains Original Code and/or Modifications of Original Code
7255365Sdes * as defined in and that are subject to the Apple Public Source License
8255365Sdes * Version 2.0 (the 'License'). You may not use this file except in
9255365Sdes * compliance with the License. The rights granted to you under the License
10255365Sdes * may not be used to create, or enable the creation or redistribution of,
11255365Sdes * unlawful or unlicensed copies of an Apple operating system, or to
12255365Sdes * circumvent, violate, or enable the circumvention or violation of, any
13255365Sdes * terms of an Apple operating system software license agreement.
14255365Sdes *
15255365Sdes * Please obtain a copy of the License at
16255365Sdes * http://www.opensource.apple.com/apsl/ and read it before using this file.
17255365Sdes *
18255365Sdes * The Original Code and all software distributed under the License are
19255365Sdes * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20255365Sdes * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21255365Sdes * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22255365Sdes * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23255365Sdes * Please see the License for the specific language governing rights and
24255365Sdes * limitations under the License.
25255365Sdes *
26255365Sdes * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27255365Sdes */
28255365Sdes
29255365Sdes#ifndef _KERN_SYS_KERNELTYPES_H_
30255365Sdes#define _KERN_SYS_KERNELTYPES_H_
31255365Sdes
32255365Sdes#include <sys/cdefs.h>
33255365Sdes#include <sys/types.h>
34255365Sdes#include <stdint.h>
35255365Sdes
36255365Sdes#ifdef BSD_BUILD
37255365Sdes/* Macros(?) to clear/set/test flags. */
38255365Sdes#define	SET(t, f)	(t) |= (f)
39255365Sdes#define	CLR(t, f)	(t) &= ~(f)
40255365Sdes#define	ISSET(t, f)	((t) & (f))
41255365Sdes#endif
42255365Sdes
43255365Sdes
44255365Sdestypedef int errno_t;
45255365Sdestypedef int64_t daddr64_t;
46255365Sdes
47255365Sdes#ifndef BSD_BUILD
48255365Sdesstruct buf;
49255365Sdestypedef struct buf * buf_t;
50255365Sdes
51255365Sdesstruct file;
52255365Sdestypedef struct file * file_t;
53255365Sdes
54255365Sdes#ifndef __LP64__
55255365Sdesstruct ucred;
56255365Sdestypedef struct ucred * ucred_t;
57255365Sdes#endif
58
59struct mount;
60typedef struct mount * mount_t;
61
62struct vnode;
63typedef struct vnode * vnode_t;
64
65struct proc;
66typedef struct proc * proc_t;
67
68struct uio;
69typedef struct uio * uio_t;
70
71struct vfs_context;
72typedef struct vfs_context * vfs_context_t;
73
74struct vfstable;
75typedef struct vfstable * vfstable_t;
76
77struct __ifnet;
78struct __mbuf;
79struct __pkthdr;
80struct __socket;
81struct __sockopt;
82struct __ifaddr;
83struct __ifmultiaddr;
84struct __ifnet_filter;
85struct __rtentry;
86struct __if_clone;
87struct __bufattr;
88
89typedef	struct __ifnet*			ifnet_t;
90typedef	struct __mbuf*			mbuf_t;
91typedef	struct __pkthdr*		pkthdr_t;
92typedef	struct __socket*		socket_t;
93typedef struct __sockopt*		sockopt_t;
94typedef struct __ifaddr*		ifaddr_t;
95typedef struct __ifmultiaddr*	ifmultiaddr_t;
96typedef struct __ifnet_filter*	interface_filter_t;
97typedef struct __rtentry*		route_t;
98typedef struct __if_clone*		if_clone_t;
99typedef struct __bufattr*		bufattr_t;
100
101#else /* BSD_BUILD */
102
103typedef struct buf * buf_t;
104typedef struct file * file_t;
105#ifndef __LP64__
106typedef struct ucred * ucred_t;
107#endif
108typedef struct mount * mount_t;
109typedef struct vnode * vnode_t;
110typedef struct proc * proc_t;
111typedef struct uio * uio_t;
112typedef struct user_iovec * user_iovec_t;
113typedef struct vfs_context * vfs_context_t;
114typedef struct vfstable * vfstable_t;
115
116#if KERNEL_PRIVATE
117typedef struct kern_iovec * kern_iovec_t;
118typedef	struct ifnet*		ifnet_t;
119typedef	struct mbuf*		mbuf_t;
120typedef	struct pkthdr*		pkthdr_t;
121typedef	struct socket*		socket_t;
122typedef struct sockopt*		sockopt_t;
123typedef struct ifaddr*		ifaddr_t;
124typedef struct ifmultiaddr*	ifmultiaddr_t;
125typedef struct ifnet_filter*	interface_filter_t;
126typedef struct rtentry*		route_t;
127typedef struct if_clone*	if_clone_t;
128typedef struct bufattr*		bufattr_t;
129#endif /* KERNEL_PRIVATE */
130
131#endif /* !BSD_BUILD */
132
133#ifndef _KAUTH_GUID
134#define _KAUTH_GUID
135/* Apple-style globally unique identifier */
136typedef struct {
137#define KAUTH_GUID_SIZE	16	/* 128-bit identifier */
138	unsigned char g_guid[KAUTH_GUID_SIZE];
139} guid_t;
140#define _GUID_T
141#endif /* _KAUTH_GUID */
142
143#ifndef _KAUTH_ACE
144#define _KAUTH_ACE
145struct kauth_ace;
146typedef struct kauth_ace * kauth_ace_t;
147#endif
148#ifndef _KAUTH_ACL
149#define _KAUTH_ACL
150struct kauth_acl;
151typedef struct kauth_acl * kauth_acl_t;
152#endif
153#ifndef _KAUTH_FILESEC
154#define _KAUTH_FILESEC
155struct kauth_filesec;
156typedef struct kauth_filesec * kauth_filesec_t;
157#endif
158
159#endif /* !_KERN_SYS_KERNELTYPES_H_ */
160