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