1*10860Ssam /* param.h 4.29 83/02/10 */ 263Sbill 363Sbill /* 48993Sroot * Macine 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 */ 24*10860Ssam #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 9910384Ssam #ifndef LOCORE 1003069Swnj #include "../h/types.h" 1013069Swnj #endif 10210384Ssam #endif 10363Sbill 10463Sbill /* 1056564Smckusic * File system parameters and macros. 1066564Smckusic * 1076564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1086564Smckusic * with smaller units (fragments) only in the last direct block. 1096564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1106564Smckusic * pool. It may be made larger without any effect on existing 1116564Smckusic * file systems; however making it smaller make make some file 1126564Smckusic * systems unmountable. 1136564Smckusic * 1146564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1156564Smckusic * "sectors" and that fragments must be some multiple of this size. 1167147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1177147Smckusick * be a power of two and in the range of 1187147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1197147Smckusick * This size has no effect upon the file system, but is usually set 1207147Smckusick * to the block size of the root file system, so as to maximize the 1217147Smckusick * speed of ``fsck''. 1223069Swnj */ 1236564Smckusic #define MAXBSIZE 8192 1246564Smckusic #define DEV_BSIZE 512 1257147Smckusick #define BLKDEV_IOSIZE 4096 1266564Smckusic #define MAXFRAG 8 1276564Smckusic 1286564Smckusic /* 1297442Skre * Map a ``block device block'' to a file system block. 1307442Skre * This should be device dependent, and will be after we 1317442Skre * add an entry to cdevsw for that purpose. For now though 1327442Skre * just use DEV_BSIZE. 1337442Skre */ 1348993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1357442Skre 1367442Skre /* 1376564Smckusic * MAXPATHLEN defines the longest permissable path length 1386564Smckusic * after expanding symbolic links. It is used to allocate 1396564Smckusic * a temporary buffer from the buffer pool in which to do the 1406564Smckusic * name expansion, hence should be a power of two, and must 1416564Smckusic * be less than or equal to MAXBSIZE. 1426564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1436564Smckusic * that may be expanded in a path name. It should be set high 1446564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1456564Smckusic * reasonably quickly. 1466564Smckusic */ 1476564Smckusic #define MAXPATHLEN 1024 1486564Smckusic #define MAXSYMLINKS 8 1496564Smckusic 1506564Smckusic /* 1516564Smckusic * bit map related macros 1526564Smckusic */ 1536564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1546564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1556564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1566564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1576564Smckusic 1586564Smckusic /* 1596564Smckusic * Macros for fast min/max. 1606564Smckusic */ 1616564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1626564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1636564Smckusic 1646564Smckusic /* 1656564Smckusic * Macros for counting and rounding. 1666564Smckusic */ 1676564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1686564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 169