1*12880Ssam /* param.h 4.34 83/06/02 */ 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 */ 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 */ 2410860Ssam #define NGROUPS 8 /* 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 4263Sbill #define NZERO 20 4363Sbill 4463Sbill /* 458993Sroot * Signals 4663Sbill */ 47*12880Ssam #ifdef KERNEL 48*12880Ssam #include "../h/signal.h" 49*12880Ssam #else 50176Sbill #include <signal.h> 51176Sbill #endif 5263Sbill 53*12880Ssam #define ISSIG(p) \ 54*12880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 55*12880Ssam ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask)) && issig())) 568467Sroot 5763Sbill /* 588993Sroot * Fundamental constants of the implementation. 5997Sbill */ 60*12880Ssam #define NBBY 8 /* number of bits in a byte */ 61*12880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 6263Sbill 6363Sbill #define NULL 0 6463Sbill #define CMASK 0 /* 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 7063Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 7163Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 7263Sbill * deals with the same size blocks that the file system uses. 7363Sbill * 7463Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7563Sbill */ 765080Swnj #define CLBYTES (CLSIZE*NBPG) 772637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 785080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 795080Swnj #define CLOFF CLOFSET 808993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 8163Sbill 828993Sroot #if CLSIZE==1 838993Sroot #define clbase(i) (i) 848993Sroot #define clrnd(i) (i) 858993Sroot #else 8663Sbill /* give the base virtual address (first of CLSIZE) */ 8763Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8863Sbill /* round a number of clicks up to a whole cluster */ 8963Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 908993Sroot #endif 9163Sbill 9263Sbill #ifndef INTRLVE 9363Sbill /* macros replacing interleaving functions */ 9463Sbill #define dkblock(bp) ((bp)->b_blkno) 9563Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9663Sbill #endif 9763Sbill 9863Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9963Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 10063Sbill 1013069Swnj #ifndef KERNEL 1023069Swnj #include <sys/types.h> 1033069Swnj #else 10410384Ssam #ifndef LOCORE 1053069Swnj #include "../h/types.h" 1063069Swnj #endif 10710384Ssam #endif 10863Sbill 10963Sbill /* 1106564Smckusic * File system parameters and macros. 1116564Smckusic * 1126564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1136564Smckusic * with smaller units (fragments) only in the last direct block. 1146564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1156564Smckusic * pool. It may be made larger without any effect on existing 1166564Smckusic * file systems; however making it smaller make make some file 1176564Smckusic * systems unmountable. 1186564Smckusic * 1196564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1206564Smckusic * "sectors" and that fragments must be some multiple of this size. 1217147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1227147Smckusick * be a power of two and in the range of 1237147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1247147Smckusick * This size has no effect upon the file system, but is usually set 1257147Smckusick * to the block size of the root file system, so as to maximize the 1267147Smckusick * speed of ``fsck''. 1273069Swnj */ 1286564Smckusic #define MAXBSIZE 8192 1296564Smckusic #define DEV_BSIZE 512 13012651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 13111225Ssam #define BLKDEV_IOSIZE 2048 1326564Smckusic #define MAXFRAG 8 1336564Smckusic 13412651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13512651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13612651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13712651Ssam ((unsigned)(db) << DEV_BSHIFT) 13812651Ssam 1396564Smckusic /* 1407442Skre * Map a ``block device block'' to a file system block. 1417442Skre * This should be device dependent, and will be after we 1427442Skre * add an entry to cdevsw for that purpose. For now though 1437442Skre * just use DEV_BSIZE. 1447442Skre */ 1458993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1467442Skre 1477442Skre /* 1486564Smckusic * MAXPATHLEN defines the longest permissable path length 1496564Smckusic * after expanding symbolic links. It is used to allocate 1506564Smckusic * a temporary buffer from the buffer pool in which to do the 1516564Smckusic * name expansion, hence should be a power of two, and must 1526564Smckusic * be less than or equal to MAXBSIZE. 1536564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1546564Smckusic * that may be expanded in a path name. It should be set high 1556564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1566564Smckusic * reasonably quickly. 1576564Smckusic */ 1586564Smckusic #define MAXPATHLEN 1024 1596564Smckusic #define MAXSYMLINKS 8 1606564Smckusic 1616564Smckusic /* 1626564Smckusic * bit map related macros 1636564Smckusic */ 1646564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1656564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1666564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1676564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1686564Smckusic 1696564Smckusic /* 1706564Smckusic * Macros for fast min/max. 1716564Smckusic */ 1726564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1736564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1746564Smckusic 1756564Smckusic /* 1766564Smckusic * Macros for counting and rounding. 1776564Smckusic */ 1786564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1796564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 180