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