1*b481cdefSroot /* param.h 4.23 82/10/31 */ 25db792e4Sbill 35db792e4Sbill /* 4*b481cdefSroot * Macine type dependent parameters. 55db792e4Sbill */ 6*b481cdefSroot #if vax 7*b481cdefSroot #include "../vax/param.h" 8*b481cdefSroot #endif 9*b481cdefSroot #if sun 10*b481cdefSroot #include "../sun/param.h" 11*b481cdefSroot #endif 125db792e4Sbill 13*b481cdefSroot #define NPTEPG (NBPG/(sizeof (struct pte))) 14*b481cdefSroot 15*b481cdefSroot /* 16*b481cdefSroot * Machine-independent constants 17*b481cdefSroot */ 1816850871Sbill #define NMOUNT 15 /* number of mountable file systems */ 1916850871Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 205db792e4Sbill #define MAXUPRC 25 /* max processes per user */ 215db792e4Sbill #define NOFILE 20 /* max open files per process */ 2245ac661dSwnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 235db792e4Sbill #define CANBSIZ 256 /* max size of typewriter line */ 245eb5d423Sbill #define NCARGS 10240 /* # characters in exec arglist */ 25*b481cdefSroot #define NGROUPS 8 /* max number groups */ 2645ac661dSwnj 275db792e4Sbill /* 28*b481cdefSroot * Priorities 295db792e4Sbill */ 305db792e4Sbill #define PSWP 0 315db792e4Sbill #define PINOD 10 325db792e4Sbill #define PRIBIO 20 335db792e4Sbill #define PRIUBA 24 345db792e4Sbill #define PZERO 25 355db792e4Sbill #define PPIPE 26 365db792e4Sbill #define PWAIT 30 37bea46c20Ssam #define PLOCK 35 385db792e4Sbill #define PSLEP 40 395db792e4Sbill #define PUSER 50 405db792e4Sbill 415db792e4Sbill #define NZERO 20 425db792e4Sbill 435db792e4Sbill /* 44*b481cdefSroot * Signals 455db792e4Sbill */ 4646cc71adSbill #ifndef NSIG 4746cc71adSbill #include <signal.h> 4846cc71adSbill #endif 49c6983186Sbill 5003c2128fSroot #define ISSIG(p) ((p)->p_sig && \ 5103c2128fSroot ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig()) 5203c2128fSroot 53c6983186Sbill /* 54*b481cdefSroot * Fundamental constants of the implementation. 55c6983186Sbill */ 56e163c03cSwnj #define NBBY 8 /* number of bits in a byte */ 575db792e4Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 585db792e4Sbill 595db792e4Sbill #define NULL 0 605db792e4Sbill #define CMASK 0 /* default mask for file creation */ 615db792e4Sbill #define NODEV (dev_t)(-1) 625db792e4Sbill 635db792e4Sbill /* 645db792e4Sbill * Clustering of hardware pages on machines with ridiculously small 655db792e4Sbill * page sizes is done here. The paging subsystem deals with units of 665db792e4Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 675db792e4Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 685db792e4Sbill * deals with the same size blocks that the file system uses. 695db792e4Sbill * 705db792e4Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 715db792e4Sbill */ 72248881f8Swnj #define CLBYTES (CLSIZE*NBPG) 73e163c03cSwnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 74248881f8Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 75248881f8Swnj #define CLOFF CLOFSET 76*b481cdefSroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 775db792e4Sbill 78*b481cdefSroot #if CLSIZE==1 79*b481cdefSroot #define clbase(i) (i) 80*b481cdefSroot #define clrnd(i) (i) 81*b481cdefSroot #else 825db792e4Sbill /* give the base virtual address (first of CLSIZE) */ 835db792e4Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 845db792e4Sbill /* round a number of clicks up to a whole cluster */ 855db792e4Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 86*b481cdefSroot #endif 875db792e4Sbill 885db792e4Sbill #ifndef INTRLVE 895db792e4Sbill /* macros replacing interleaving functions */ 905db792e4Sbill #define dkblock(bp) ((bp)->b_blkno) 915db792e4Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 925db792e4Sbill #endif 935db792e4Sbill 945db792e4Sbill #define CBSIZE 28 /* number of chars in a clist block */ 955db792e4Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 965db792e4Sbill 97e0ff83f9Swnj #ifndef KERNEL 98e0ff83f9Swnj #include <sys/types.h> 99e0ff83f9Swnj #else 100e0ff83f9Swnj #include "../h/types.h" 101e0ff83f9Swnj #endif 10276379a38Sbill 1035db792e4Sbill /* 104389af1dfSmckusic * File system parameters and macros. 105389af1dfSmckusic * 106389af1dfSmckusic * The file system is made out of blocks of at most MAXBSIZE units, 107389af1dfSmckusic * with smaller units (fragments) only in the last direct block. 108389af1dfSmckusic * MAXBSIZE primarily determines the size of buffers in the buffer 109389af1dfSmckusic * pool. It may be made larger without any effect on existing 110389af1dfSmckusic * file systems; however making it smaller make make some file 111389af1dfSmckusic * systems unmountable. 112389af1dfSmckusic * 113389af1dfSmckusic * Note that the blocked devices are assumed to have DEV_BSIZE 114389af1dfSmckusic * "sectors" and that fragments must be some multiple of this size. 11591d57239Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 11691d57239Smckusick * be a power of two and in the range of 11791d57239Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 11891d57239Smckusick * This size has no effect upon the file system, but is usually set 11991d57239Smckusick * to the block size of the root file system, so as to maximize the 12091d57239Smckusick * speed of ``fsck''. 121389af1dfSmckusic */ 122389af1dfSmckusic #define MAXBSIZE 8192 123389af1dfSmckusic #define DEV_BSIZE 512 12491d57239Smckusick #define BLKDEV_IOSIZE 4096 125389af1dfSmckusic #define MAXFRAG 8 126389af1dfSmckusic 127389af1dfSmckusic /* 128edc472f6Skre * Map a ``block device block'' to a file system block. 129edc472f6Skre * This should be device dependent, and will be after we 130edc472f6Skre * add an entry to cdevsw for that purpose. For now though 131edc472f6Skre * just use DEV_BSIZE. 132edc472f6Skre */ 133*b481cdefSroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 134edc472f6Skre 135edc472f6Skre /* 136389af1dfSmckusic * MAXPATHLEN defines the longest permissable path length 137389af1dfSmckusic * after expanding symbolic links. It is used to allocate 138389af1dfSmckusic * a temporary buffer from the buffer pool in which to do the 139389af1dfSmckusic * name expansion, hence should be a power of two, and must 140389af1dfSmckusic * be less than or equal to MAXBSIZE. 141389af1dfSmckusic * MAXSYMLINKS defines the maximum number of symbolic links 142389af1dfSmckusic * that may be expanded in a path name. It should be set high 143389af1dfSmckusic * enough to allow all legitimate uses, but halt infinite loops 144389af1dfSmckusic * reasonably quickly. 145389af1dfSmckusic */ 146389af1dfSmckusic #define MAXPATHLEN 1024 147389af1dfSmckusic #define MAXSYMLINKS 8 148389af1dfSmckusic 149389af1dfSmckusic /* 150389af1dfSmckusic * bit map related macros 151389af1dfSmckusic */ 152389af1dfSmckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 153389af1dfSmckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 154389af1dfSmckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 155389af1dfSmckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 156389af1dfSmckusic 157389af1dfSmckusic /* 158389af1dfSmckusic * Macros for fast min/max. 159389af1dfSmckusic */ 160389af1dfSmckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 161389af1dfSmckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 162389af1dfSmckusic 163389af1dfSmckusic /* 164389af1dfSmckusic * Macros for counting and rounding. 165389af1dfSmckusic */ 166389af1dfSmckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 167389af1dfSmckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 168389af1dfSmckusic 169389af1dfSmckusic /* 170389af1dfSmckusic * Provide about n microseconds of delay. 171e0ff83f9Swnj */ 172e0ff83f9Swnj #define DELAY(n) { register int N = (n); while (--N > 0); } 173