1*8993Sroot /* param.h 4.23 82/10/31 */ 263Sbill 363Sbill /* 4*8993Sroot * Macine type dependent parameters. 563Sbill */ 6*8993Sroot #if vax 7*8993Sroot #include "../vax/param.h" 8*8993Sroot #endif 9*8993Sroot #if sun 10*8993Sroot #include "../sun/param.h" 11*8993Sroot #endif 1263Sbill 13*8993Sroot #define NPTEPG (NBPG/(sizeof (struct pte))) 14*8993Sroot 15*8993Sroot /* 16*8993Sroot * Machine-independent constants 17*8993Sroot */ 18356Sbill #define NMOUNT 15 /* number of mountable file systems */ 19356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 2063Sbill #define MAXUPRC 25 /* max processes per user */ 2163Sbill #define NOFILE 20 /* max open files per process */ 222751Swnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 2363Sbill #define CANBSIZ 256 /* max size of typewriter line */ 24874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 25*8993Sroot #define NGROUPS 8 /* max number groups */ 262751Swnj 2763Sbill /* 28*8993Sroot * Priorities 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 377688Ssam #define PLOCK 35 3863Sbill #define PSLEP 40 3963Sbill #define PUSER 50 4063Sbill 4163Sbill #define NZERO 20 4263Sbill 4363Sbill /* 44*8993Sroot * Signals 4563Sbill */ 46176Sbill #ifndef NSIG 47176Sbill #include <signal.h> 48176Sbill #endif 4963Sbill 508467Sroot #define ISSIG(p) ((p)->p_sig && \ 518467Sroot ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig()) 528467Sroot 5363Sbill /* 54*8993Sroot * Fundamental constants of the implementation. 5597Sbill */ 562637Swnj #define NBBY 8 /* number of bits in a byte */ 572637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 5863Sbill 5963Sbill #define NULL 0 6063Sbill #define CMASK 0 /* default mask for file creation */ 6163Sbill #define NODEV (dev_t)(-1) 6263Sbill 6363Sbill /* 6463Sbill * Clustering of hardware pages on machines with ridiculously small 6563Sbill * page sizes is done here. The paging subsystem deals with units of 6663Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 6763Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 6863Sbill * deals with the same size blocks that the file system uses. 6963Sbill * 7063Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7163Sbill */ 725080Swnj #define CLBYTES (CLSIZE*NBPG) 732637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 745080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 755080Swnj #define CLOFF CLOFSET 76*8993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 7763Sbill 78*8993Sroot #if CLSIZE==1 79*8993Sroot #define clbase(i) (i) 80*8993Sroot #define clrnd(i) (i) 81*8993Sroot #else 8263Sbill /* give the base virtual address (first of CLSIZE) */ 8363Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8463Sbill /* round a number of clicks up to a whole cluster */ 8563Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 86*8993Sroot #endif 8763Sbill 8863Sbill #ifndef INTRLVE 8963Sbill /* macros replacing interleaving functions */ 9063Sbill #define dkblock(bp) ((bp)->b_blkno) 9163Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9263Sbill #endif 9363Sbill 9463Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9563Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 9663Sbill 973069Swnj #ifndef KERNEL 983069Swnj #include <sys/types.h> 993069Swnj #else 1003069Swnj #include "../h/types.h" 1013069Swnj #endif 10263Sbill 10363Sbill /* 1046564Smckusic * File system parameters and macros. 1056564Smckusic * 1066564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1076564Smckusic * with smaller units (fragments) only in the last direct block. 1086564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1096564Smckusic * pool. It may be made larger without any effect on existing 1106564Smckusic * file systems; however making it smaller make make some file 1116564Smckusic * systems unmountable. 1126564Smckusic * 1136564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1146564Smckusic * "sectors" and that fragments must be some multiple of this size. 1157147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1167147Smckusick * be a power of two and in the range of 1177147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1187147Smckusick * This size has no effect upon the file system, but is usually set 1197147Smckusick * to the block size of the root file system, so as to maximize the 1207147Smckusick * speed of ``fsck''. 1213069Swnj */ 1226564Smckusic #define MAXBSIZE 8192 1236564Smckusic #define DEV_BSIZE 512 1247147Smckusick #define BLKDEV_IOSIZE 4096 1256564Smckusic #define MAXFRAG 8 1266564Smckusic 1276564Smckusic /* 1287442Skre * Map a ``block device block'' to a file system block. 1297442Skre * This should be device dependent, and will be after we 1307442Skre * add an entry to cdevsw for that purpose. For now though 1317442Skre * just use DEV_BSIZE. 1327442Skre */ 133*8993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1347442Skre 1357442Skre /* 1366564Smckusic * MAXPATHLEN defines the longest permissable path length 1376564Smckusic * after expanding symbolic links. It is used to allocate 1386564Smckusic * a temporary buffer from the buffer pool in which to do the 1396564Smckusic * name expansion, hence should be a power of two, and must 1406564Smckusic * be less than or equal to MAXBSIZE. 1416564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1426564Smckusic * that may be expanded in a path name. It should be set high 1436564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1446564Smckusic * reasonably quickly. 1456564Smckusic */ 1466564Smckusic #define MAXPATHLEN 1024 1476564Smckusic #define MAXSYMLINKS 8 1486564Smckusic 1496564Smckusic /* 1506564Smckusic * bit map related macros 1516564Smckusic */ 1526564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1536564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1546564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1556564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1566564Smckusic 1576564Smckusic /* 1586564Smckusic * Macros for fast min/max. 1596564Smckusic */ 1606564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1616564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1626564Smckusic 1636564Smckusic /* 1646564Smckusic * Macros for counting and rounding. 1656564Smckusic */ 1666564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1676564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 1686564Smckusic 1696564Smckusic /* 1706564Smckusic * Provide about n microseconds of delay. 1716564Smckusic */ 1723069Swnj #define DELAY(n) { register int N = (n); while (--N > 0); } 173