|
|
1.1 root 1: /* param.h 6.1 83/07/29 */
2:
3: /*
4: * Machine type dependent parameters.
5: */
6: #ifdef KERNEL
7: #include "../machine/param.h"
8: #else
9: #include <machine/param.h>
10: #endif
11:
12: #define NPTEPG (NBPG/(sizeof (struct pte)))
13:
14: /*
15: * Machine-independent constants
16: */
17: /*
18: * Next 2 constants HAVE to be equal. AND they HAVE to be contained
19: * in the c_mdev field of 'cmap' structure. Don't increase at whim.
20: * Computed from (4 controllers) * (4 drives/controller)
21: * * (4 file-systems/drive) - 1
22: */
23: #define NMOUNT 63 /* number of mountable file systems */
24: #define MSWAPX 63 /* pseudo mount table index for swapdev */
25:
1.1.1.2 ! root 26: #define NOFILE 64 /* max open files per process */
! 27: /* Check pte.h before changing NOFILE (make sure there's room) */
1.1 root 28: #define CANBSIZ 256 /* max size of typewriter line */
29: #define NCARGS 10240 /* # characters in exec arglist */
30: #define NGROUPS 8 /* max number groups */
31:
32: #define NOGROUP -1 /* marker for empty group set member */
33:
34: /*
35: * Priorities
36: */
37: #define PMASK 0x007f
38: #define PCATCH 0x0100
39: #define PSWP 0
40: #define PINOD 10
41: #define PRIBIO 20
42: #define PRIUBA 24
43: #define PZERO 25
44: #define PPIPE 26
45: #define PWAIT 30
46: #define PLOCK 35
47: #define PSLEP 40
48: #define PUSER 50
49:
50: #define NZERO 20
51:
52: /*
53: * Signals
54: */
55: #ifdef KERNEL
56: #include "../h/signal.h"
57: #else
58: #include <signal.h>
59: #endif
60:
61: #define ISSIG(p) \
62: ((p)->p_sig && ((p)->p_flag&STRC || \
63: ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
64:
65: /*
66: * Fundamental constants of the implementation.
67: */
68: #define NBBY 8 /* number of bits in a byte */
69: #define NBPW sizeof(int) /* number of bytes in an integer */
70:
71: #define NULL 0
72: #define CMASK 0 /* default mask for file creation */
73: #define NODEV (dev_t)(-1)
74:
75: /*
1.1.1.2 ! root 76: * Sys5 USTAT define
1.1 root 77: */
78: #define brdev(x) (x&0x1fff)
79:
80: /*
81: * Clustering of hardware pages on machines with ridiculously small
82: * page sizes is done here. The paging subsystem deals with units of
83: * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
84: * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
85: * deals with the same size blocks that the file system uses.
86: *
87: * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
88: */
89: #define CLBYTES (CLSIZE*NBPG)
90: #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
91: #define claligned(x) ((((int)(x))&CLOFSET)==0)
92: #define CLOFF CLOFSET
93: #define CLSHIFT (PGSHIFT+CLSIZELOG2)
94:
95: #if CLSIZE==1
96: #define clbase(i) (i)
97: #define clrnd(i) (i)
98: #else
99: /* give the base virtual address (first of CLSIZE) */
100: #define clbase(i) ((i) &~ (CLSIZE-1))
101: /* round a number of clicks up to a whole cluster */
102: #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
103: #endif
104:
105: #ifndef INTRLVE
106: /* macros replacing interleaving functions */
107: #define dkblock(bp) ((bp)->b_blkno)
108: #define dkunit(bp) (minor((bp)->b_dev) >> 3)
109: #endif
110:
111: #define CBSIZE 60 /* number of chars in a clist block */
112: #define CROUND 0x3F /* clist rounding; sizeof(int *) + CBSIZE -1*/
113:
114: #ifndef KERNEL
115: #include <sys/types.h>
116: #else
117: #ifndef LOCORE
118: #include "../h/types.h"
119: #endif
120: #endif
121:
122: /*
123: * File system parameters and macros.
124: *
125: * The file system is made out of blocks of at most MAXBSIZE units,
126: * with smaller units (fragments) only in the last direct block.
127: * MAXBSIZE primarily determines the size of buffers in the buffer
128: * pool. It may be made larger without any effect on existing
129: * file systems; however making it smaller make make some file
130: * systems unmountable.
131: *
132: * Note that the blocked devices are assumed to have DEV_BSIZE
133: * "sectors" and that fragments must be some multiple of this size.
134: * Block devices are read in BLKDEV_IOSIZE units. This number must
135: * be a power of two and in the range of
136: * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
137: * This size has no effect upon the file system, but is usually set
138: * to the block size of the root file system, so as to maximize the
139: * speed of ``fsck''.
140: */
141: #define MAXBSIZE 8192
142: #define DEV_BSIZE 1024
143: #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */
144: #define BLKDEV_IOSIZE 1024 /* = NBPG for physical controllers */
145: #define MAXFRAG 8
146:
147: #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
148: ((unsigned)(bytes) >> DEV_BSHIFT)
149: #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
150: ((unsigned)(db) << DEV_BSHIFT)
151:
152: /*
153: * Map a ``block device block'' to a file system block.
154: * This should be device dependent, and will be after we
155: * add an entry to cdevsw for that purpose. For now though
156: * just use DEV_BSIZE.
157: */
158: #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
159:
160: /*
161: * MAXPATHLEN defines the longest permissable path length
162: * after expanding symbolic links. It is used to allocate
163: * a temporary buffer from the buffer pool in which to do the
164: * name expansion, hence should be a power of two, and must
165: * be less than or equal to MAXBSIZE.
166: * MAXSYMLINKS defines the maximum number of symbolic links
167: * that may be expanded in a path name. It should be set high
168: * enough to allow all legitimate uses, but halt infinite loops
169: * reasonably quickly.
170: */
171: #define MAXPATHLEN 1024
172: #define MAXSYMLINKS 8
173:
174: /*
175: * bit map related macros
176: */
177: #define setbit(a,i) ((a)[(unsigned)(i)/NBBY] |= 1<<((unsigned)(i)%NBBY))
178: #define clrbit(a,i) ((a)[(unsigned)(i)/NBBY] &= ~(1<<((unsigned)(i)%NBBY)))
179: #define isset(a,i) ((a)[(unsigned)(i)/NBBY] & (1<<((unsigned)(i)%NBBY)))
180: #define isclr(a,i) (((a)[(unsigned)(i)/NBBY] & (1<<((unsigned)(i)%NBBY))) == 0)
181:
182: /*
183: * Macros for fast min/max.
184: */
185: #define MIN(a,b) (((a)<(b))?(a):(b))
186: #define MAX(a,b) (((a)>(b))?(a):(b))
187:
188: /*
189: * Macros for counting and rounding.
190: */
191: #define howmany(x, y) (((x)+((y)-1))/(y))
192: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.