kernel tree reorganization stage 1: Major cvs repository work (not logged as
[dragonfly.git] / sys / i386 / boot / dosboot / types.h
1 /*-\r
2  * Copyright (c) 1982, 1986, 1991, 1993\r
3  *      The Regents of the University of California.  All rights reserved.\r
4  * (c) UNIX System Laboratories, Inc.\r
5  * All or some portions of this file are derived from material licensed\r
6  * to the University of California by American Telephone and Telegraph\r
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with\r
8  * the permission of UNIX System Laboratories, Inc.\r
9  *\r
10  * Redistribution and use in source and binary forms, with or without\r
11  * modification, are permitted provided that the following conditions\r
12  * are met:\r
13  * 1. Redistributions of source code must retain the above copyright\r
14  *    notice, this list of conditions and the following disclaimer.\r
15  * 2. Redistributions in binary form must reproduce the above copyright\r
16  *    notice, this list of conditions and the following disclaimer in the\r
17  *    documentation and/or other materials provided with the distribution.\r
18  * 3. All advertising materials mentioning features or use of this software\r
19  *    must display the following acknowledgement:\r
20  *      This product includes software developed by the University of\r
21  *      California, Berkeley and its contributors.\r
22  * 4. Neither the name of the University nor the names of its contributors\r
23  *    may be used to endorse or promote products derived from this software\r
24  *    without specific prior written permission.\r
25  *\r
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
36  * SUCH DAMAGE.\r
37  *\r
38  *      @(#)types.h     8.4 (Berkeley) 1/21/94\r
39  * $FreeBSD: src/sys/i386/boot/dosboot/types.h,v 1.6 1999/12/29 04:32:52 peter Exp $\r
40  * $DragonFly: src/sys/i386/boot/dosboot/Attic/types.h,v 1.2 2003/06/17 04:28:34 dillon Exp $\r
41  */\r
42 \r
43 #ifndef _SYS_TYPES_H_\r
44 #define _SYS_TYPES_H_\r
45 \r
46 #include "cdefs.h"\r
47 \r
48 /* Machine type dependent parameters. */\r
49 #include "endian.h"\r
50 \r
51 #ifndef _POSIX_SOURCE\r
52 typedef unsigned char   u_char;\r
53 typedef unsigned short  u_short;\r
54 typedef unsigned int    u_int;\r
55 typedef unsigned long   u_long;\r
56 typedef unsigned short  ushort;         /* Sys V compatibility */\r
57 typedef unsigned int    uint;           /* Sys V compatibility */\r
58 #endif\r
59 \r
60 struct __help__ {\r
61         long a,b;\r
62 };\r
63 \r
64 typedef struct __help__ u_quad_t;       /* quads */\r
65 typedef struct __help__ quad_t;\r
66 typedef quad_t *        qaddr_t;\r
67 \r
68 typedef char *          caddr_t;        /* core address */\r
69 typedef long            daddr_t;        /* disk address */\r
70 typedef unsigned short  dev_t;          /* device number (cg: was u_long) */\r
71 typedef unsigned long   fixpt_t;        /* fixed point number */\r
72 typedef unsigned short  gid_t;          /* group id */\r
73 typedef unsigned long   ino_t;          /* inode number */\r
74 typedef unsigned short  mode_t;         /* permissions */\r
75 typedef unsigned short  nlink_t;        /* link count */\r
76 typedef long            off_t;          /* file offset (cg: was quad) */\r
77 typedef long            pid_t;          /* process id */\r
78 typedef long            segsz_t;        /* segment size */\r
79 typedef long            swblk_t;        /* swap offset */\r
80 typedef unsigned short  uid_t;          /* user id */\r
81 \r
82 /*\r
83  * This belongs in unistd.h, but is placed here to ensure that programs\r
84  * casting the second parameter of lseek to off_t will get the correct\r
85  * version of lseek.\r
86  */\r
87 #ifndef KERNEL\r
88 __BEGIN_DECLS\r
89 off_t    lseek __P((int, off_t, int));\r
90 __END_DECLS\r
91 #endif\r
92 \r
93 #ifndef _POSIX_SOURCE\r
94 /*\r
95  * minor() gives a cookie instead of an index since we don't want to\r
96  * change the meanings of bits 0-15 or waste time and space shifting\r
97  * bits 16-31 for devices that don't use them.\r
98  */\r
99 #define major(x)        ((int)(((u_int)(x) >> 8)&0xff)) /* major number */\r
100 #define minor(x)        ((int)((x)&0xffff00ff))         /* minor number */\r
101 #define makedev(x,y)    ((dev_t)(((x)<<8) | (y)))       /* create dev_t */\r
102 #endif\r
103 \r
104 #include "ansi.h"\r
105 /*#include <machine/types.h>*/\r
106 \r
107 #ifdef  _BSD_CLOCK_T_\r
108 typedef _BSD_CLOCK_T_   clock_t;\r
109 #undef  _BSD_CLOCK_T_\r
110 #endif\r
111 \r
112 #ifdef  _BSD_SIZE_T_\r
113 typedef _BSD_SIZE_T_    size_t;\r
114 #undef  _BSD_SIZE_T_\r
115 #endif\r
116 \r
117 #ifdef  _BSD_SSIZE_T_\r
118 typedef _BSD_SSIZE_T_   ssize_t;\r
119 #undef  _BSD_SSIZE_T_\r
120 #endif\r
121 \r
122 #ifdef  _BSD_TIME_T_\r
123 typedef _BSD_TIME_T_    time_t;\r
124 #undef  _BSD_TIME_T_\r
125 #endif\r
126 \r
127 #ifndef _POSIX_SOURCE\r
128 #define NBBY    8               /* number of bits in a byte */\r
129 \r
130 /*\r
131  * Select uses bit masks of file descriptors in longs.  These macros\r
132  * manipulate such bit fields (the filesystem macros use chars).\r
133  * FD_SETSIZE may be defined by the user, but the default here should\r
134  * be enough for most uses.\r
135  */\r
136 #ifndef FD_SETSIZE\r
137 #define FD_SETSIZE      256\r
138 #endif\r
139 \r
140 typedef long    fd_mask;\r
141 #define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */\r
142 \r
143 #ifndef howmany\r
144 #define howmany(x, y)   (((x)+((y)-1))/(y))\r
145 #endif\r
146 \r
147 typedef struct fd_set {\r
148         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];\r
149 } fd_set;\r
150 \r
151 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))\r
152 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))\r
153 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))\r
154 #define FD_COPY(f, t)   bcopy(f, t, sizeof(*(f)))\r
155 #define FD_ZERO(p)      bzero(p, sizeof(*(p)))\r
156 \r
157 #if defined(__STDC__) && defined(_KERNEL)\r
158 /*\r
159  * Forward structure declarations for function prototypes.  We include the\r
160  * common structures that cross subsystem boundaries here; others are mostly\r
161  * used in the same place that the structure is defined.\r
162  */\r
163 struct  proc;\r
164 struct  pgrp;\r
165 struct  ucred;\r
166 struct  rusage;\r
167 struct  file;\r
168 struct  buf;\r
169 struct  tty;\r
170 struct  uio;\r
171 #endif\r
172 \r
173 typedef long time_t;\r
174 \r
175 #endif /* !_POSIX_SOURCE */\r
176 #endif /* !_SYS_TYPES_H_ */\r