1*03c2128fSroot /* param.h 4.22 82/10/10 */ 25db792e4Sbill 35db792e4Sbill /* 445ac661dSwnj * Tunable variables which do not usually vary per system. 55db792e4Sbill * 645ac661dSwnj * The sizes of most system tables are configured 745ac661dSwnj * into each system description. The file system buffer 845ac661dSwnj * cache size is assigned based on available memory. 945ac661dSwnj * The tables whose sizes don't vary often are given here. 105db792e4Sbill */ 115db792e4Sbill 1216850871Sbill #define NMOUNT 15 /* number of mountable file systems */ 1316850871Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 145db792e4Sbill #define MAXUPRC 25 /* max processes per user */ 155db792e4Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 165db792e4Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 175db792e4Sbill #define NOFILE 20 /* max open files per process */ 1845ac661dSwnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 195db792e4Sbill #define CANBSIZ 256 /* max size of typewriter line */ 205eb5d423Sbill #define NCARGS 10240 /* # characters in exec arglist */ 2145ac661dSwnj 225db792e4Sbill /* 235db792e4Sbill * priorities 245db792e4Sbill * probably should not be 255db792e4Sbill * altered too much 265db792e4Sbill */ 275db792e4Sbill 285db792e4Sbill #define PSWP 0 295db792e4Sbill #define PINOD 10 305db792e4Sbill #define PRIBIO 20 315db792e4Sbill #define PRIUBA 24 325db792e4Sbill #define PZERO 25 335db792e4Sbill #define PPIPE 26 345db792e4Sbill #define PWAIT 30 35bea46c20Ssam #define PLOCK 35 365db792e4Sbill #define PSLEP 40 375db792e4Sbill #define PUSER 50 385db792e4Sbill 395db792e4Sbill #define NZERO 20 405db792e4Sbill 415db792e4Sbill /* 425db792e4Sbill * signals 435db792e4Sbill * dont change 445db792e4Sbill */ 455db792e4Sbill 4646cc71adSbill #ifndef NSIG 4746cc71adSbill #include <signal.h> 4846cc71adSbill #endif 49c6983186Sbill 50*03c2128fSroot #define ISSIG(p) ((p)->p_sig && \ 51*03c2128fSroot ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig()) 52*03c2128fSroot 53c6983186Sbill /* 54c6983186Sbill * Return values from tsleep(). 55c6983186Sbill */ 56c6983186Sbill #define TS_OK 0 /* normal wakeup */ 57c6983186Sbill #define TS_TIME 1 /* timed-out wakeup */ 58c6983186Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 595db792e4Sbill 605db792e4Sbill /* 615db792e4Sbill * fundamental constants of the implementation-- 625db792e4Sbill * cannot be changed easily. 635db792e4Sbill */ 645db792e4Sbill 65e163c03cSwnj #define NBBY 8 /* number of bits in a byte */ 665db792e4Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 67e163c03cSwnj #define NBPG 512 68e163c03cSwnj #define PGOFSET (NBPG-1) /* byte offset into page */ 69e163c03cSwnj #define PGSHIFT 9 /* LOG2(NBPG) */ 705db792e4Sbill 71e163c03cSwnj #define UPAGES 8 /* pages of u-area */ 725db792e4Sbill #define NULL 0 735db792e4Sbill #define CMASK 0 /* default mask for file creation */ 745db792e4Sbill #define NODEV (dev_t)(-1) 75dba4bb6aSroot #define NGROUPS 8 /* max number groups */ 765db792e4Sbill 775db792e4Sbill /* 785db792e4Sbill * Clustering of hardware pages on machines with ridiculously small 795db792e4Sbill * page sizes is done here. The paging subsystem deals with units of 805db792e4Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 815db792e4Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 825db792e4Sbill * deals with the same size blocks that the file system uses. 835db792e4Sbill * 845db792e4Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 855db792e4Sbill */ 865db792e4Sbill #define CLSIZE 2 87248881f8Swnj #define CLBYTES (CLSIZE*NBPG) 88e163c03cSwnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 89248881f8Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 90248881f8Swnj #define CLOFF CLOFSET 91248881f8Swnj #define CLSHIFT (PGSHIFT+1) 925db792e4Sbill 935db792e4Sbill /* give the base virtual address (first of CLSIZE) */ 945db792e4Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 955db792e4Sbill 965db792e4Sbill /* round a number of clicks up to a whole cluster */ 975db792e4Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 985db792e4Sbill 995db792e4Sbill #ifndef INTRLVE 1005db792e4Sbill /* macros replacing interleaving functions */ 1015db792e4Sbill #define dkblock(bp) ((bp)->b_blkno) 1025db792e4Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 1035db792e4Sbill #endif 1045db792e4Sbill 1055db792e4Sbill #define CBSIZE 28 /* number of chars in a clist block */ 1065db792e4Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 1075db792e4Sbill 1085db792e4Sbill /* 1095db792e4Sbill * Some macros for units conversion 1105db792e4Sbill */ 1115db792e4Sbill /* Core clicks (512 bytes) to segments and vice versa */ 1125db792e4Sbill #define ctos(x) (x) 1135db792e4Sbill #define stoc(x) (x) 1145db792e4Sbill 1155db792e4Sbill /* Core clicks (512 bytes) to disk blocks */ 1165db792e4Sbill #define ctod(x) (x) 1175db792e4Sbill 1185db792e4Sbill /* clicks to bytes */ 1195db792e4Sbill #define ctob(x) ((x)<<9) 1205db792e4Sbill 1215db792e4Sbill /* bytes to clicks */ 1225db792e4Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 1235db792e4Sbill 124e0ff83f9Swnj #ifndef KERNEL 125e0ff83f9Swnj #include <sys/types.h> 126e0ff83f9Swnj #else 127e0ff83f9Swnj #include "../h/types.h" 128e0ff83f9Swnj #endif 12976379a38Sbill 1305db792e4Sbill /* 1315db792e4Sbill * Machine-dependent bits and macros 1325db792e4Sbill */ 1335db792e4Sbill #define UMODE PSL_CURMOD /* usermode bits */ 1345db792e4Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 1355db792e4Sbill 1365db792e4Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 137e0ff83f9Swnj 138e0ff83f9Swnj /* 139389af1dfSmckusic * File system parameters and macros. 140389af1dfSmckusic * 141389af1dfSmckusic * The file system is made out of blocks of at most MAXBSIZE units, 142389af1dfSmckusic * with smaller units (fragments) only in the last direct block. 143389af1dfSmckusic * MAXBSIZE primarily determines the size of buffers in the buffer 144389af1dfSmckusic * pool. It may be made larger without any effect on existing 145389af1dfSmckusic * file systems; however making it smaller make make some file 146389af1dfSmckusic * systems unmountable. 147389af1dfSmckusic * 148389af1dfSmckusic * Note that the blocked devices are assumed to have DEV_BSIZE 149389af1dfSmckusic * "sectors" and that fragments must be some multiple of this size. 15091d57239Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 15191d57239Smckusick * be a power of two and in the range of 15291d57239Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 15391d57239Smckusick * This size has no effect upon the file system, but is usually set 15491d57239Smckusick * to the block size of the root file system, so as to maximize the 15591d57239Smckusick * speed of ``fsck''. 156389af1dfSmckusic */ 157389af1dfSmckusic #define MAXBSIZE 8192 158389af1dfSmckusic #define DEV_BSIZE 512 15991d57239Smckusick #define BLKDEV_IOSIZE 4096 160389af1dfSmckusic #define MAXFRAG 8 161389af1dfSmckusic 162389af1dfSmckusic /* 163edc472f6Skre * Map a ``block device block'' to a file system block. 164edc472f6Skre * This should be device dependent, and will be after we 165edc472f6Skre * add an entry to cdevsw for that purpose. For now though 166edc472f6Skre * just use DEV_BSIZE. 167edc472f6Skre */ 168edc472f6Skre #define bdbtofsb(bn) ((bn) / CLSIZE) 169edc472f6Skre 170edc472f6Skre /* 171389af1dfSmckusic * MAXPATHLEN defines the longest permissable path length 172389af1dfSmckusic * after expanding symbolic links. It is used to allocate 173389af1dfSmckusic * a temporary buffer from the buffer pool in which to do the 174389af1dfSmckusic * name expansion, hence should be a power of two, and must 175389af1dfSmckusic * be less than or equal to MAXBSIZE. 176389af1dfSmckusic * MAXSYMLINKS defines the maximum number of symbolic links 177389af1dfSmckusic * that may be expanded in a path name. It should be set high 178389af1dfSmckusic * enough to allow all legitimate uses, but halt infinite loops 179389af1dfSmckusic * reasonably quickly. 180389af1dfSmckusic */ 181389af1dfSmckusic #define MAXPATHLEN 1024 182389af1dfSmckusic #define MAXSYMLINKS 8 183389af1dfSmckusic 184389af1dfSmckusic /* 185389af1dfSmckusic * bit map related macros 186389af1dfSmckusic */ 187389af1dfSmckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 188389af1dfSmckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 189389af1dfSmckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 190389af1dfSmckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 191389af1dfSmckusic 192389af1dfSmckusic /* 193389af1dfSmckusic * Macros for fast min/max. 194389af1dfSmckusic */ 195389af1dfSmckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 196389af1dfSmckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 197389af1dfSmckusic 198389af1dfSmckusic /* 199389af1dfSmckusic * Macros for counting and rounding. 200389af1dfSmckusic */ 201389af1dfSmckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 202389af1dfSmckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 203389af1dfSmckusic 204389af1dfSmckusic /* 205389af1dfSmckusic * Provide about n microseconds of delay. 206e0ff83f9Swnj */ 207e0ff83f9Swnj #define DELAY(n) { register int N = (n); while (--N > 0); } 208