16564Smckusic /* "@(#)param.h 2.1 3/25/82" */ 263Sbill 3*7688Ssam /* param.h 4.20 82/08/08 */ 46564Smckusic 563Sbill /* 62751Swnj * Tunable variables which do not usually vary per system. 763Sbill * 82751Swnj * The sizes of most system tables are configured 92751Swnj * into each system description. The file system buffer 102751Swnj * cache size is assigned based on available memory. 112751Swnj * The tables whose sizes don't vary often are given here. 1263Sbill */ 1363Sbill 14356Sbill #define NMOUNT 15 /* number of mountable file systems */ 15356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 1663Sbill #define MAXUPRC 25 /* max processes per user */ 1763Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 1863Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 1963Sbill #define NOFILE 20 /* max open files per process */ 202751Swnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 2163Sbill #define CANBSIZ 256 /* max size of typewriter line */ 22874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 232751Swnj 2463Sbill /* 2563Sbill * priorities 2663Sbill * probably should not be 2763Sbill * altered too much 2863Sbill */ 2963Sbill 3063Sbill #define PSWP 0 3163Sbill #define PINOD 10 3263Sbill #define PRIBIO 20 3363Sbill #define PRIUBA 24 3463Sbill #define PZERO 25 3563Sbill #define PPIPE 26 3663Sbill #define PWAIT 30 37*7688Ssam #define PLOCK 35 3863Sbill #define PSLEP 40 3963Sbill #define PUSER 50 4063Sbill 4163Sbill #define NZERO 20 4263Sbill 4363Sbill /* 4463Sbill * signals 4563Sbill * dont change 4663Sbill */ 4763Sbill 48176Sbill #ifndef NSIG 49176Sbill #include <signal.h> 50176Sbill #endif 5163Sbill 5263Sbill /* 5397Sbill * Return values from tsleep(). 5497Sbill */ 5597Sbill #define TS_OK 0 /* normal wakeup */ 5697Sbill #define TS_TIME 1 /* timed-out wakeup */ 5797Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 5897Sbill 5997Sbill /* 6063Sbill * fundamental constants of the implementation-- 6163Sbill * cannot be changed easily. 6263Sbill */ 6363Sbill 642637Swnj #define NBBY 8 /* number of bits in a byte */ 652637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 662637Swnj #define NBPG 512 672637Swnj #define PGOFSET (NBPG-1) /* byte offset into page */ 682637Swnj #define PGSHIFT 9 /* LOG2(NBPG) */ 6963Sbill 702637Swnj #define UPAGES 8 /* pages of u-area */ 7163Sbill #define NULL 0 7263Sbill #define CMASK 0 /* default mask for file creation */ 7363Sbill #define NODEV (dev_t)(-1) 745857Swnj #define NGRPS 256 /* max number groups */ 7563Sbill 7663Sbill /* 7763Sbill * Clustering of hardware pages on machines with ridiculously small 7863Sbill * page sizes is done here. The paging subsystem deals with units of 7963Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 8063Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 8163Sbill * deals with the same size blocks that the file system uses. 8263Sbill * 8363Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 8463Sbill */ 855080Swnj #define CLSIZE 2 865080Swnj #define CLBYTES (CLSIZE*NBPG) 872637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 885080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 895080Swnj #define CLOFF CLOFSET 905080Swnj #define CLSHIFT (PGSHIFT+1) 9163Sbill 9263Sbill /* give the base virtual address (first of CLSIZE) */ 9363Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 9463Sbill 9563Sbill /* round a number of clicks up to a whole cluster */ 9663Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 9763Sbill 9863Sbill #ifndef INTRLVE 9963Sbill /* macros replacing interleaving functions */ 10063Sbill #define dkblock(bp) ((bp)->b_blkno) 10163Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 10263Sbill #endif 10363Sbill 10463Sbill #define CBSIZE 28 /* number of chars in a clist block */ 10563Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 10663Sbill 10763Sbill /* 10863Sbill * Some macros for units conversion 10963Sbill */ 11063Sbill /* Core clicks (512 bytes) to segments and vice versa */ 11163Sbill #define ctos(x) (x) 11263Sbill #define stoc(x) (x) 11363Sbill 11463Sbill /* Core clicks (512 bytes) to disk blocks */ 11563Sbill #define ctod(x) (x) 11663Sbill 11763Sbill /* clicks to bytes */ 11863Sbill #define ctob(x) ((x)<<9) 11963Sbill 12063Sbill /* bytes to clicks */ 12163Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 12263Sbill 1233069Swnj #ifndef KERNEL 1243069Swnj #include <sys/types.h> 1253069Swnj #else 1263069Swnj #include "../h/types.h" 1273069Swnj #endif 12863Sbill 12963Sbill /* 13063Sbill * Machine-dependent bits and macros 13163Sbill */ 13263Sbill #define UMODE PSL_CURMOD /* usermode bits */ 13363Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 13463Sbill 13563Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 1363069Swnj 1373069Swnj /* 1386564Smckusic * File system parameters and macros. 1396564Smckusic * 1406564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1416564Smckusic * with smaller units (fragments) only in the last direct block. 1426564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1436564Smckusic * pool. It may be made larger without any effect on existing 1446564Smckusic * file systems; however making it smaller make make some file 1456564Smckusic * systems unmountable. 1466564Smckusic * 1476564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1486564Smckusic * "sectors" and that fragments must be some multiple of this size. 1497147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1507147Smckusick * be a power of two and in the range of 1517147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1527147Smckusick * This size has no effect upon the file system, but is usually set 1537147Smckusick * to the block size of the root file system, so as to maximize the 1547147Smckusick * speed of ``fsck''. 1553069Swnj */ 1566564Smckusic #define MAXBSIZE 8192 1576564Smckusic #define DEV_BSIZE 512 1587147Smckusick #define BLKDEV_IOSIZE 4096 1596564Smckusic #define MAXFRAG 8 1606564Smckusic 1616564Smckusic /* 1627442Skre * Map a ``block device block'' to a file system block. 1637442Skre * This should be device dependent, and will be after we 1647442Skre * add an entry to cdevsw for that purpose. For now though 1657442Skre * just use DEV_BSIZE. 1667442Skre */ 1677442Skre #define bdbtofsb(bn) ((bn) / CLSIZE) 1687442Skre 1697442Skre /* 1706564Smckusic * MAXPATHLEN defines the longest permissable path length 1716564Smckusic * after expanding symbolic links. It is used to allocate 1726564Smckusic * a temporary buffer from the buffer pool in which to do the 1736564Smckusic * name expansion, hence should be a power of two, and must 1746564Smckusic * be less than or equal to MAXBSIZE. 1756564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1766564Smckusic * that may be expanded in a path name. It should be set high 1776564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1786564Smckusic * reasonably quickly. 1796564Smckusic */ 1806564Smckusic #define MAXPATHLEN 1024 1816564Smckusic #define MAXSYMLINKS 8 1826564Smckusic 1836564Smckusic /* 1846564Smckusic * bit map related macros 1856564Smckusic */ 1866564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1876564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1886564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1896564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1906564Smckusic 1916564Smckusic /* 1926564Smckusic * Macros for fast min/max. 1936564Smckusic */ 1946564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1956564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1966564Smckusic 1976564Smckusic /* 1986564Smckusic * Macros for counting and rounding. 1996564Smckusic */ 2006564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 2016564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 2026564Smckusic 2036564Smckusic /* 2046564Smckusic * Provide about n microseconds of delay. 2056564Smckusic */ 2063069Swnj #define DELAY(n) { register int N = (n); while (--N > 0); } 207