Initial import from FreeBSD RELENG_4:
[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  */\r
41 \r
42 #ifndef _SYS_TYPES_H_\r
43 #define _SYS_TYPES_H_\r
44 \r
45 #include "cdefs.h"\r
46 \r
47 /* Machine type dependent parameters. */\r
48 #include "endian.h"\r
49 \r
50 #ifndef _POSIX_SOURCE\r
51 typedef unsigned char   u_char;\r
52 typedef unsigned short  u_short;\r
53 typedef unsigned int    u_int;\r
54 typedef unsigned long   u_long;\r
55 typedef unsigned short  ushort;         /* Sys V compatibility */\r
56 typedef unsigned int    uint;           /* Sys V compatibility */\r
57 #endif\r
58 \r
59 struct __help__ {\r
60         long a,b;\r
61 };\r
62 \r
63 typedef struct __help__ u_quad_t;       /* quads */\r
64 typedef struct __help__ quad_t;\r
65 typedef quad_t *        qaddr_t;\r
66 \r
67 typedef char *          caddr_t;        /* core address */\r
68 typedef long            daddr_t;        /* disk address */\r
69 typedef unsigned short  dev_t;          /* device number (cg: was u_long) */\r
70 typedef unsigned long   fixpt_t;        /* fixed point number */\r
71 typedef unsigned short  gid_t;          /* group id */\r
72 typedef unsigned long   ino_t;          /* inode number */\r
73 typedef unsigned short  mode_t;         /* permissions */\r
74 typedef unsigned short  nlink_t;        /* link count */\r
75 typedef long            off_t;          /* file offset (cg: was quad) */\r
76 typedef long            pid_t;          /* process id */\r
77 typedef long            segsz_t;        /* segment size */\r
78 typedef long            swblk_t;        /* swap offset */\r
79 typedef unsigned short  uid_t;          /* user id */\r
80 \r
81 /*\r
82  * This belongs in unistd.h, but is placed here to ensure that programs\r
83  * casting the second parameter of lseek to off_t will get the correct\r
84  * version of lseek.\r
85  */\r
86 #ifndef KERNEL\r
87 __BEGIN_DECLS\r
88 off_t    lseek __P((int, off_t, int));\r
89 __END_DECLS\r
90 #endif\r
91 \r
92 #ifndef _POSIX_SOURCE\r
93 /*\r
94  * minor() gives a cookie instead of an index since we don't want to\r
95  * change the meanings of bits 0-15 or waste time and space shifting\r
96  * bits 16-31 for devices that don't use them.\r
97  */\r
98 #define major(x)        ((int)(((u_int)(x) >> 8)&0xff)) /* major number */\r
99 #define minor(x)        ((int)((x)&0xffff00ff))         /* minor number */\r
100 #define makedev(x,y)    ((dev_t)(((x)<<8) | (y)))       /* create dev_t */\r
101 #endif\r
102 \r
103 #include "ansi.h"\r
104 /*#include <machine/types.h>*/\r
105 \r
106 #ifdef  _BSD_CLOCK_T_\r
107 typedef _BSD_CLOCK_T_   clock_t;\r
108 #undef  _BSD_CLOCK_T_\r
109 #endif\r
110 \r
111 #ifdef  _BSD_SIZE_T_\r
112 typedef _BSD_SIZE_T_    size_t;\r
113 #undef  _BSD_SIZE_T_\r
114 #endif\r
115 \r
116 #ifdef  _BSD_SSIZE_T_\r
117 typedef _BSD_SSIZE_T_   ssize_t;\r
118 #undef  _BSD_SSIZE_T_\r
119 #endif\r
120 \r
121 #ifdef  _BSD_TIME_T_\r
122 typedef _BSD_TIME_T_    time_t;\r
123 #undef  _BSD_TIME_T_\r
124 #endif\r
125 \r
126 #ifndef _POSIX_SOURCE\r
127 #define NBBY    8               /* number of bits in a byte */\r
128 \r
129 /*\r
130  * Select uses bit masks of file descriptors in longs.  These macros\r
131  * manipulate such bit fields (the filesystem macros use chars).\r
132  * FD_SETSIZE may be defined by the user, but the default here should\r
133  * be enough for most uses.\r
134  */\r
135 #ifndef FD_SETSIZE\r
136 #define FD_SETSIZE      256\r
137 #endif\r
138 \r
139 typedef long    fd_mask;\r
140 #define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */\r
141 \r
142 #ifndef howmany\r
143 #define howmany(x, y)   (((x)+((y)-1))/(y))\r
144 #endif\r
145 \r
146 typedef struct fd_set {\r
147         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];\r
148 } fd_set;\r
149 \r
150 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))\r
151 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))\r
152 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))\r
153 #define FD_COPY(f, t)   bcopy(f, t, sizeof(*(f)))\r
154 #define FD_ZERO(p)      bzero(p, sizeof(*(p)))\r
155 \r
156 #if defined(__STDC__) && defined(_KERNEL)\r
157 /*\r
158  * Forward structure declarations for function prototypes.  We include the\r
159  * common structures that cross subsystem boundaries here; others are mostly\r
160  * used in the same place that the structure is defined.\r
161  */\r
162 struct  proc;\r
163 struct  pgrp;\r
164 struct  ucred;\r
165 struct  rusage;\r
166 struct  file;\r
167 struct  buf;\r
168 struct  tty;\r
169 struct  uio;\r
170 #endif\r
171 \r
172 typedef long time_t;\r
173 \r
174 #endif /* !_POSIX_SOURCE */\r
175 #endif /* !_SYS_TYPES_H_ */\r