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