1*15070Skarels /* param.h 6.2 83/09/24 */ 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*15070Skarels /* NMOUNT must be <= 15 unless c_mdev (cmap.h) is expanded */ 19*15070Skarels #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 6563Sbill #define CMASK 0 /* 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 7163Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 7263Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 7363Sbill * deals with the same size blocks that the file system uses. 7463Sbill * 7563Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7663Sbill */ 775080Swnj #define CLBYTES (CLSIZE*NBPG) 782637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 795080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 805080Swnj #define CLOFF CLOFSET 818993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 8263Sbill 838993Sroot #if CLSIZE==1 848993Sroot #define clbase(i) (i) 858993Sroot #define clrnd(i) (i) 868993Sroot #else 8763Sbill /* give the base virtual address (first of CLSIZE) */ 8863Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 8963Sbill /* round a number of clicks up to a whole cluster */ 9063Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 918993Sroot #endif 9263Sbill 9363Sbill #ifndef INTRLVE 9463Sbill /* macros replacing interleaving functions */ 9563Sbill #define dkblock(bp) ((bp)->b_blkno) 9663Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 9763Sbill #endif 9863Sbill 9963Sbill #define CBSIZE 28 /* number of chars in a clist block */ 10063Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 10163Sbill 1023069Swnj #ifndef KERNEL 1033069Swnj #include <sys/types.h> 1043069Swnj #else 10510384Ssam #ifndef LOCORE 1063069Swnj #include "../h/types.h" 1073069Swnj #endif 10810384Ssam #endif 10963Sbill 11063Sbill /* 1116564Smckusic * File system parameters and macros. 1126564Smckusic * 1136564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1146564Smckusic * with smaller units (fragments) only in the last direct block. 1156564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1166564Smckusic * pool. It may be made larger without any effect on existing 1176564Smckusic * file systems; however making it smaller make make some file 1186564Smckusic * systems unmountable. 1196564Smckusic * 1206564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1216564Smckusic * "sectors" and that fragments must be some multiple of this size. 1227147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1237147Smckusick * be a power of two and in the range of 1247147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1257147Smckusick * This size has no effect upon the file system, but is usually set 1267147Smckusick * to the block size of the root file system, so as to maximize the 1277147Smckusick * speed of ``fsck''. 1283069Swnj */ 1296564Smckusic #define MAXBSIZE 8192 1306564Smckusic #define DEV_BSIZE 512 13112651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 13211225Ssam #define BLKDEV_IOSIZE 2048 1336564Smckusic #define MAXFRAG 8 1346564Smckusic 13512651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13612651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13712651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13812651Ssam ((unsigned)(db) << DEV_BSHIFT) 13912651Ssam 1406564Smckusic /* 1417442Skre * Map a ``block device block'' to a file system block. 1427442Skre * This should be device dependent, and will be after we 1437442Skre * add an entry to cdevsw for that purpose. For now though 1447442Skre * just use DEV_BSIZE. 1457442Skre */ 1468993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1477442Skre 1487442Skre /* 1496564Smckusic * MAXPATHLEN defines the longest permissable path length 1506564Smckusic * after expanding symbolic links. It is used to allocate 1516564Smckusic * a temporary buffer from the buffer pool in which to do the 1526564Smckusic * name expansion, hence should be a power of two, and must 1536564Smckusic * be less than or equal to MAXBSIZE. 1546564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1556564Smckusic * that may be expanded in a path name. It should be set high 1566564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1576564Smckusic * reasonably quickly. 1586564Smckusic */ 1596564Smckusic #define MAXPATHLEN 1024 1606564Smckusic #define MAXSYMLINKS 8 1616564Smckusic 1626564Smckusic /* 1636564Smckusic * bit map related macros 1646564Smckusic */ 1656564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1666564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1676564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1686564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1696564Smckusic 1706564Smckusic /* 1716564Smckusic * Macros for fast min/max. 1726564Smckusic */ 1736564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1746564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1756564Smckusic 1766564Smckusic /* 1776564Smckusic * Macros for counting and rounding. 1786564Smckusic */ 1796564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1806564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 181