1*5857Swnj /* param.h 4.15 82/02/15 */ 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 3563Sbill #define PSLEP 40 3663Sbill #define PUSER 50 3763Sbill 3863Sbill #define NZERO 20 3963Sbill 4063Sbill /* 4163Sbill * signals 4263Sbill * dont change 4363Sbill */ 4463Sbill 45176Sbill #ifndef NSIG 46176Sbill #include <signal.h> 47176Sbill #endif 4863Sbill 4963Sbill /* 5097Sbill * Return values from tsleep(). 5197Sbill */ 5297Sbill #define TS_OK 0 /* normal wakeup */ 5397Sbill #define TS_TIME 1 /* timed-out wakeup */ 5497Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 5597Sbill 5697Sbill /* 5763Sbill * fundamental constants of the implementation-- 5863Sbill * cannot be changed easily. 5963Sbill */ 6063Sbill 612637Swnj #define NBBY 8 /* number of bits in a byte */ 622637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 632637Swnj #define NBPG 512 642637Swnj #define PGOFSET (NBPG-1) /* byte offset into page */ 652637Swnj #define PGSHIFT 9 /* LOG2(NBPG) */ 6663Sbill 672637Swnj #define UPAGES 8 /* pages of u-area */ 6863Sbill #define NULL 0 6963Sbill #define CMASK 0 /* default mask for file creation */ 7063Sbill #define NODEV (dev_t)(-1) 7163Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 7263Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 7363Sbill #define DIRSIZ 14 /* max characters per directory */ 74*5857Swnj #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 #if CLSIZE==1 9963Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 10063Sbill #define INOPB 8 /* 8 inodes per block */ 10163Sbill #define BMASK 0777 /* BSIZE-1 */ 10263Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 10363Sbill #define NMASK 0177 /* NINDIR-1 */ 10463Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 10563Sbill #define NICINOD 100 /* number of superblock inodes */ 10663Sbill #define NICFREE 50 /* number of superblock free blocks */ 10763Sbill 10863Sbill #endif 10963Sbill 11063Sbill #if CLSIZE==2 11163Sbill #define BSIZE 1024 11263Sbill #define INOPB 16 11363Sbill #define BMASK 01777 11463Sbill #define BSHIFT 10 11563Sbill #define NMASK 0377 11663Sbill #define NSHIFT 8 11763Sbill #define NICINOD 100 11863Sbill #define NICFREE 178 11963Sbill #endif 12063Sbill 12163Sbill #if CLSIZE==4 12263Sbill #define BSIZE 2048 12363Sbill #define INOPB 32 12463Sbill #define BMASK 03777 12563Sbill #define BSHIFT 11 12663Sbill #define NMASK 0777 12763Sbill #define NSHIFT 9 12863Sbill #define NICINOD 100 12963Sbill #define NICFREE 434 13063Sbill #endif 13163Sbill 13263Sbill #ifndef INTRLVE 13363Sbill /* macros replacing interleaving functions */ 13463Sbill #define dkblock(bp) ((bp)->b_blkno) 13563Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 13663Sbill #endif 13763Sbill 13863Sbill /* inumber to disk address and inumber to disk offset */ 13963Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 14063Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 14163Sbill 14263Sbill /* file system blocks to disk blocks and back */ 14363Sbill #define fsbtodb(b) ((b)*CLSIZE) 14463Sbill #define dbtofsb(b) ((b)/CLSIZE) 14563Sbill 14663Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 14763Sbill 14863Sbill #define CBSIZE 28 /* number of chars in a clist block */ 14963Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 15063Sbill 15163Sbill /* 15263Sbill * Macros for fast min/max 15363Sbill */ 15463Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 15563Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 15663Sbill 15763Sbill /* 15863Sbill * Some macros for units conversion 15963Sbill */ 16063Sbill /* Core clicks (512 bytes) to segments and vice versa */ 16163Sbill #define ctos(x) (x) 16263Sbill #define stoc(x) (x) 16363Sbill 16463Sbill /* Core clicks (512 bytes) to disk blocks */ 16563Sbill #define ctod(x) (x) 16663Sbill 16763Sbill /* clicks to bytes */ 16863Sbill #define ctob(x) ((x)<<9) 16963Sbill 17063Sbill /* bytes to clicks */ 17163Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 17263Sbill 1733069Swnj #ifndef KERNEL 1743069Swnj #include <sys/types.h> 1753069Swnj #else 1763069Swnj #include "../h/types.h" 1773069Swnj #endif 17863Sbill 17963Sbill /* 18063Sbill * Machine-dependent bits and macros 18163Sbill */ 18263Sbill #define UMODE PSL_CURMOD /* usermode bits */ 18363Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 18463Sbill 18563Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 1863069Swnj 1873069Swnj /* 1883069Swnj * Provide about n microseconds of delay 1893069Swnj */ 1903069Swnj #define DELAY(n) { register int N = (n); while (--N > 0); } 191