1*17996Skarels /* param.h 6.7 85/02/15 */ 263Sbill 363Sbill /* 412508Ssam * Machine type dependent parameters. 563Sbill */ 69791Ssam #ifdef KERNEL 717050Skarels #include "../machine/machparam.h" 89791Ssam #else 917050Skarels #include <machine/machparam.h> 108993Sroot #endif 1163Sbill 128993Sroot #define NPTEPG (NBPG/(sizeof (struct pte))) 138993Sroot 148993Sroot /* 158993Sroot * Machine-independent constants 168993Sroot */ 1717556Skarels #define NMOUNT 20 /* number of mountable file systems */ 1816796Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 1915070Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 2063Sbill #define MAXUPRC 25 /* max processes per user */ 2117556Skarels #define NOFILE 48 /* max open files per process */ 2263Sbill #define CANBSIZ 256 /* max size of typewriter line */ 2317556Skarels #define NCARGS 20480 /* # characters in exec arglist */ 24*17996Skarels #define NGROUPS 16 /* max number groups */ 252751Swnj 2611808Ssam #define NOGROUP -1 /* marker for empty group set member */ 2711808Ssam 2863Sbill /* 298993Sroot * Priorities 3063Sbill */ 3163Sbill #define PSWP 0 3263Sbill #define PINOD 10 3363Sbill #define PRIBIO 20 3463Sbill #define PRIUBA 24 3563Sbill #define PZERO 25 3663Sbill #define PPIPE 26 3763Sbill #define PWAIT 30 387688Ssam #define PLOCK 35 3963Sbill #define PSLEP 40 4063Sbill #define PUSER 50 4163Sbill 4217556Skarels #define NZERO 0 4363Sbill 4463Sbill /* 458993Sroot * Signals 4663Sbill */ 4712880Ssam #ifdef KERNEL 4817033Sbloom #include "signal.h" 4912880Ssam #else 50176Sbill #include <signal.h> 51176Sbill #endif 5263Sbill 5312880Ssam #define ISSIG(p) \ 5412880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 5512965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 568467Sroot 5763Sbill /* 588993Sroot * Fundamental constants of the implementation. 5997Sbill */ 6012880Ssam #define NBBY 8 /* number of bits in a byte */ 6112880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 6263Sbill 6363Sbill #define NULL 0 6416796Skarels #define CMASK 022 /* default mask for file creation */ 6563Sbill #define NODEV (dev_t)(-1) 6663Sbill 6763Sbill /* 6863Sbill * Clustering of hardware pages on machines with ridiculously small 6963Sbill * page sizes is done here. The paging subsystem deals with units of 7016796Skarels * CLSIZE pte's describing NBPG (from vm.h) pages each. 7163Sbill * 7263Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7363Sbill */ 745080Swnj #define CLBYTES (CLSIZE*NBPG) 752637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 765080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 775080Swnj #define CLOFF CLOFSET 788993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 7963Sbill 808993Sroot #if CLSIZE==1 818993Sroot #define clbase(i) (i) 828993Sroot #define clrnd(i) (i) 838993Sroot #else 8463Sbill /* give the base virtual address (first of CLSIZE) */ 8563Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8663Sbill /* round a number of clicks up to a whole cluster */ 8763Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 888993Sroot #endif 8963Sbill 9063Sbill #ifndef INTRLVE 9163Sbill /* macros replacing interleaving functions */ 9263Sbill #define dkblock(bp) ((bp)->b_blkno) 9363Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9463Sbill #endif 9563Sbill 9663Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9763Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 9863Sbill 993069Swnj #ifndef KERNEL 1003069Swnj #include <sys/types.h> 1013069Swnj #else 10210384Ssam #ifndef LOCORE 10317033Sbloom #include "types.h" 1043069Swnj #endif 10510384Ssam #endif 10663Sbill 10763Sbill /* 1086564Smckusic * File system parameters and macros. 1096564Smckusic * 1106564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1116564Smckusic * with smaller units (fragments) only in the last direct block. 1126564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1136564Smckusic * pool. It may be made larger without any effect on existing 1146564Smckusic * file systems; however making it smaller make make some file 1156564Smckusic * systems unmountable. 1166564Smckusic * 1176564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1186564Smckusic * "sectors" and that fragments must be some multiple of this size. 1197147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1207147Smckusick * be a power of two and in the range of 1217147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1227147Smckusick * This size has no effect upon the file system, but is usually set 1237147Smckusick * to the block size of the root file system, so as to maximize the 1247147Smckusick * speed of ``fsck''. 1253069Swnj */ 1266564Smckusic #define MAXBSIZE 8192 1276564Smckusic #define DEV_BSIZE 512 12812651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 12911225Ssam #define BLKDEV_IOSIZE 2048 1306564Smckusic #define MAXFRAG 8 1316564Smckusic 13212651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13312651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13412651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13512651Ssam ((unsigned)(db) << DEV_BSHIFT) 13612651Ssam 1376564Smckusic /* 1387442Skre * Map a ``block device block'' to a file system block. 1397442Skre * This should be device dependent, and will be after we 1407442Skre * add an entry to cdevsw for that purpose. For now though 1417442Skre * just use DEV_BSIZE. 1427442Skre */ 1438993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1447442Skre 1457442Skre /* 1466564Smckusic * MAXPATHLEN defines the longest permissable path length 1476564Smckusic * after expanding symbolic links. It is used to allocate 1486564Smckusic * a temporary buffer from the buffer pool in which to do the 1496564Smckusic * name expansion, hence should be a power of two, and must 1506564Smckusic * be less than or equal to MAXBSIZE. 1516564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1526564Smckusic * that may be expanded in a path name. It should be set high 1536564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1546564Smckusic * reasonably quickly. 1556564Smckusic */ 1566564Smckusic #define MAXPATHLEN 1024 1576564Smckusic #define MAXSYMLINKS 8 1586564Smckusic 1596564Smckusic /* 1606564Smckusic * bit map related macros 1616564Smckusic */ 1626564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1636564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1646564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1656564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1666564Smckusic 1676564Smckusic /* 1686564Smckusic * Macros for fast min/max. 1696564Smckusic */ 1706564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1716564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1726564Smckusic 1736564Smckusic /* 1746564Smckusic * Macros for counting and rounding. 1756564Smckusic */ 1766564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1776564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 178