1*9791Ssam /* param.h 4.26 82/12/17 */ 263Sbill 363Sbill /* 48993Sroot * Macine type dependent parameters. 563Sbill */ 6*9791Ssam #ifdef KERNEL 7*9791Ssam #include "../machine/param.h" 8*9791Ssam #else 9*9791Ssam #include <machine/param.h> 108993Sroot #endif 1163Sbill 128993Sroot #define NPTEPG (NBPG/(sizeof (struct pte))) 138993Sroot 148993Sroot /* 158993Sroot * Machine-independent constants 168993Sroot */ 17356Sbill #define NMOUNT 15 /* number of mountable file systems */ 18356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 1963Sbill #define MAXUPRC 25 /* max processes per user */ 2063Sbill #define NOFILE 20 /* max open files per process */ 212751Swnj /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 2263Sbill #define CANBSIZ 256 /* max size of typewriter line */ 23874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 248993Sroot #define NGROUPS 8 /* max number groups */ 252751Swnj 2663Sbill /* 278993Sroot * Priorities 2863Sbill */ 2963Sbill #define PSWP 0 3063Sbill #define PINOD 10 3163Sbill #define PRIBIO 20 3263Sbill #define PRIUBA 24 3363Sbill #define PZERO 25 3463Sbill #define PPIPE 26 3563Sbill #define PWAIT 30 367688Ssam #define PLOCK 35 3763Sbill #define PSLEP 40 3863Sbill #define PUSER 50 3963Sbill 4063Sbill #define NZERO 20 4163Sbill 4263Sbill /* 438993Sroot * Signals 4463Sbill */ 45176Sbill #ifndef NSIG 46176Sbill #include <signal.h> 47176Sbill #endif 4863Sbill 498467Sroot #define ISSIG(p) ((p)->p_sig && \ 508467Sroot ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig()) 518467Sroot 5263Sbill /* 538993Sroot * Fundamental constants of the implementation. 5497Sbill */ 552637Swnj #define NBBY 8 /* number of bits in a byte */ 562637Swnj #define NBPW sizeof(int) /* number of bytes in an integer */ 5763Sbill 5863Sbill #define NULL 0 5963Sbill #define CMASK 0 /* default mask for file creation */ 6063Sbill #define NODEV (dev_t)(-1) 6163Sbill 6263Sbill /* 6363Sbill * Clustering of hardware pages on machines with ridiculously small 6463Sbill * page sizes is done here. The paging subsystem deals with units of 6563Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 6663Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 6763Sbill * deals with the same size blocks that the file system uses. 6863Sbill * 6963Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7063Sbill */ 715080Swnj #define CLBYTES (CLSIZE*NBPG) 722637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 735080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 745080Swnj #define CLOFF CLOFSET 758993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 7663Sbill 778993Sroot #if CLSIZE==1 788993Sroot #define clbase(i) (i) 798993Sroot #define clrnd(i) (i) 808993Sroot #else 8163Sbill /* give the base virtual address (first of CLSIZE) */ 8263Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8363Sbill /* round a number of clicks up to a whole cluster */ 8463Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 858993Sroot #endif 8663Sbill 8763Sbill #ifndef INTRLVE 8863Sbill /* macros replacing interleaving functions */ 8963Sbill #define dkblock(bp) ((bp)->b_blkno) 9063Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9163Sbill #endif 9263Sbill 9363Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9463Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 9563Sbill 963069Swnj #ifndef KERNEL 973069Swnj #include <sys/types.h> 983069Swnj #else 993069Swnj #include "../h/types.h" 1003069Swnj #endif 10163Sbill 10263Sbill /* 1036564Smckusic * File system parameters and macros. 1046564Smckusic * 1056564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1066564Smckusic * with smaller units (fragments) only in the last direct block. 1076564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1086564Smckusic * pool. It may be made larger without any effect on existing 1096564Smckusic * file systems; however making it smaller make make some file 1106564Smckusic * systems unmountable. 1116564Smckusic * 1126564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1136564Smckusic * "sectors" and that fragments must be some multiple of this size. 1147147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1157147Smckusick * be a power of two and in the range of 1167147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1177147Smckusick * This size has no effect upon the file system, but is usually set 1187147Smckusick * to the block size of the root file system, so as to maximize the 1197147Smckusick * speed of ``fsck''. 1203069Swnj */ 1216564Smckusic #define MAXBSIZE 8192 1226564Smckusic #define DEV_BSIZE 512 1237147Smckusick #define BLKDEV_IOSIZE 4096 1246564Smckusic #define MAXFRAG 8 1256564Smckusic 1266564Smckusic /* 1277442Skre * Map a ``block device block'' to a file system block. 1287442Skre * This should be device dependent, and will be after we 1297442Skre * add an entry to cdevsw for that purpose. For now though 1307442Skre * just use DEV_BSIZE. 1317442Skre */ 1328993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1337442Skre 1347442Skre /* 1356564Smckusic * MAXPATHLEN defines the longest permissable path length 1366564Smckusic * after expanding symbolic links. It is used to allocate 1376564Smckusic * a temporary buffer from the buffer pool in which to do the 1386564Smckusic * name expansion, hence should be a power of two, and must 1396564Smckusic * be less than or equal to MAXBSIZE. 1406564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1416564Smckusic * that may be expanded in a path name. It should be set high 1426564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1436564Smckusic * reasonably quickly. 1446564Smckusic */ 1456564Smckusic #define MAXPATHLEN 1024 1466564Smckusic #define MAXSYMLINKS 8 1476564Smckusic 1486564Smckusic /* 1496564Smckusic * bit map related macros 1506564Smckusic */ 1516564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1526564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1536564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1546564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1556564Smckusic 1566564Smckusic /* 1576564Smckusic * Macros for fast min/max. 1586564Smckusic */ 1596564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1606564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1616564Smckusic 1626564Smckusic /* 1636564Smckusic * Macros for counting and rounding. 1646564Smckusic */ 1656564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1666564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 167