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