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