1*16796Skarels /* param.h 6.3 84/07/31 */ 263Sbill 363Sbill /* 412508Ssam * Machine type dependent parameters. 563Sbill */ 69791Ssam #ifdef KERNEL 79791Ssam #include "../machine/param.h" 89791Ssam #else 99791Ssam #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 */ 18*16796Skarels /* 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 */ 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 */ 2510860Ssam #define NGROUPS 8 /* max number groups */ 262751Swnj 2711808Ssam #define NOGROUP -1 /* marker for empty group set member */ 2811808Ssam 2963Sbill /* 308993Sroot * Priorities 3163Sbill */ 3263Sbill #define PSWP 0 3363Sbill #define PINOD 10 3463Sbill #define PRIBIO 20 3563Sbill #define PRIUBA 24 3663Sbill #define PZERO 25 3763Sbill #define PPIPE 26 3863Sbill #define PWAIT 30 397688Ssam #define PLOCK 35 4063Sbill #define PSLEP 40 4163Sbill #define PUSER 50 4263Sbill 4363Sbill #define NZERO 20 4463Sbill 4563Sbill /* 468993Sroot * Signals 4763Sbill */ 4812880Ssam #ifdef KERNEL 4912880Ssam #include "../h/signal.h" 5012880Ssam #else 51176Sbill #include <signal.h> 52176Sbill #endif 5363Sbill 5412880Ssam #define ISSIG(p) \ 5512880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 5612965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 578467Sroot 5863Sbill /* 598993Sroot * Fundamental constants of the implementation. 6097Sbill */ 6112880Ssam #define NBBY 8 /* number of bits in a byte */ 6212880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 6363Sbill 6463Sbill #define NULL 0 65*16796Skarels #define CMASK 022 /* default mask for file creation */ 6663Sbill #define NODEV (dev_t)(-1) 6763Sbill 6863Sbill /* 6963Sbill * Clustering of hardware pages on machines with ridiculously small 7063Sbill * page sizes is done here. The paging subsystem deals with units of 71*16796Skarels * CLSIZE pte's describing NBPG (from vm.h) pages each. 7263Sbill * 7363Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7463Sbill */ 755080Swnj #define CLBYTES (CLSIZE*NBPG) 762637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 775080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 785080Swnj #define CLOFF CLOFSET 798993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 8063Sbill 818993Sroot #if CLSIZE==1 828993Sroot #define clbase(i) (i) 838993Sroot #define clrnd(i) (i) 848993Sroot #else 8563Sbill /* give the base virtual address (first of CLSIZE) */ 8663Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8763Sbill /* round a number of clicks up to a whole cluster */ 8863Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 898993Sroot #endif 9063Sbill 9163Sbill #ifndef INTRLVE 9263Sbill /* macros replacing interleaving functions */ 9363Sbill #define dkblock(bp) ((bp)->b_blkno) 9463Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9563Sbill #endif 9663Sbill 9763Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9863Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 9963Sbill 1003069Swnj #ifndef KERNEL 1013069Swnj #include <sys/types.h> 1023069Swnj #else 10310384Ssam #ifndef LOCORE 1043069Swnj #include "../h/types.h" 1053069Swnj #endif 10610384Ssam #endif 10763Sbill 10863Sbill /* 1096564Smckusic * File system parameters and macros. 1106564Smckusic * 1116564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1126564Smckusic * with smaller units (fragments) only in the last direct block. 1136564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1146564Smckusic * pool. It may be made larger without any effect on existing 1156564Smckusic * file systems; however making it smaller make make some file 1166564Smckusic * systems unmountable. 1176564Smckusic * 1186564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1196564Smckusic * "sectors" and that fragments must be some multiple of this size. 1207147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1217147Smckusick * be a power of two and in the range of 1227147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1237147Smckusick * This size has no effect upon the file system, but is usually set 1247147Smckusick * to the block size of the root file system, so as to maximize the 1257147Smckusick * speed of ``fsck''. 1263069Swnj */ 1276564Smckusic #define MAXBSIZE 8192 1286564Smckusic #define DEV_BSIZE 512 12912651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 13011225Ssam #define BLKDEV_IOSIZE 2048 1316564Smckusic #define MAXFRAG 8 1326564Smckusic 13312651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13412651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13512651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13612651Ssam ((unsigned)(db) << DEV_BSHIFT) 13712651Ssam 1386564Smckusic /* 1397442Skre * Map a ``block device block'' to a file system block. 1407442Skre * This should be device dependent, and will be after we 1417442Skre * add an entry to cdevsw for that purpose. For now though 1427442Skre * just use DEV_BSIZE. 1437442Skre */ 1448993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1457442Skre 1467442Skre /* 1476564Smckusic * MAXPATHLEN defines the longest permissable path length 1486564Smckusic * after expanding symbolic links. It is used to allocate 1496564Smckusic * a temporary buffer from the buffer pool in which to do the 1506564Smckusic * name expansion, hence should be a power of two, and must 1516564Smckusic * be less than or equal to MAXBSIZE. 1526564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1536564Smckusic * that may be expanded in a path name. It should be set high 1546564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1556564Smckusic * reasonably quickly. 1566564Smckusic */ 1576564Smckusic #define MAXPATHLEN 1024 1586564Smckusic #define MAXSYMLINKS 8 1596564Smckusic 1606564Smckusic /* 1616564Smckusic * bit map related macros 1626564Smckusic */ 1636564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1646564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1656564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1666564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1676564Smckusic 1686564Smckusic /* 1696564Smckusic * Macros for fast min/max. 1706564Smckusic */ 1716564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1726564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1736564Smckusic 1746564Smckusic /* 1756564Smckusic * Macros for counting and rounding. 1766564Smckusic */ 1776564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1786564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 179