123430Smckusick /* 223430Smckusick * Copyright (c) 1982 Regents of the University of California. 323430Smckusick * All rights reserved. The Berkeley software License Agreement 423430Smckusick * specifies the terms and conditions for redistribution. 523430Smckusick * 6*25297Skarels * @(#)param.h 6.15 (Berkeley) 10/25/85 723430Smckusick */ 863Sbill 9*25297Skarels #define BSD 43 /* 4.3 * 10, as cpp doesn't do floats */ 10*25297Skarels #define BSD4_3 1 1124654Sbloom 1263Sbill /* 1312508Ssam * Machine type dependent parameters. 1463Sbill */ 159791Ssam #ifdef KERNEL 1617050Skarels #include "../machine/machparam.h" 179791Ssam #else 1817050Skarels #include <machine/machparam.h> 198993Sroot #endif 2063Sbill 218993Sroot #define NPTEPG (NBPG/(sizeof (struct pte))) 228993Sroot 238993Sroot /* 248993Sroot * Machine-independent constants 258993Sroot */ 2617556Skarels #define NMOUNT 20 /* number of mountable file systems */ 2716796Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 2815070Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 29*25297Skarels #define MAXUPRC 40 /* max processes per user */ 3019955Skarels #define NOFILE 64 /* max open files per process */ 3163Sbill #define CANBSIZ 256 /* max size of typewriter line */ 3217556Skarels #define NCARGS 20480 /* # characters in exec arglist */ 3317996Skarels #define NGROUPS 16 /* max number groups */ 342751Swnj 3511808Ssam #define NOGROUP -1 /* marker for empty group set member */ 3611808Ssam 3763Sbill /* 388993Sroot * Priorities 3963Sbill */ 4063Sbill #define PSWP 0 4163Sbill #define PINOD 10 4263Sbill #define PRIBIO 20 4363Sbill #define PRIUBA 24 4463Sbill #define PZERO 25 4563Sbill #define PPIPE 26 4663Sbill #define PWAIT 30 477688Ssam #define PLOCK 35 4863Sbill #define PSLEP 40 4963Sbill #define PUSER 50 5063Sbill 5117556Skarels #define NZERO 0 5263Sbill 5363Sbill /* 548993Sroot * Signals 5563Sbill */ 5612880Ssam #ifdef KERNEL 5717033Sbloom #include "signal.h" 5812880Ssam #else 59176Sbill #include <signal.h> 60176Sbill #endif 6163Sbill 6212880Ssam #define ISSIG(p) \ 6312880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 6412965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 658467Sroot 6612880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 6763Sbill 6863Sbill #define NULL 0 6916796Skarels #define CMASK 022 /* default mask for file creation */ 7063Sbill #define NODEV (dev_t)(-1) 7163Sbill 7263Sbill /* 7363Sbill * Clustering of hardware pages on machines with ridiculously small 7463Sbill * page sizes is done here. The paging subsystem deals with units of 7516796Skarels * CLSIZE pte's describing NBPG (from vm.h) pages each. 7663Sbill * 7763Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7863Sbill */ 795080Swnj #define CLBYTES (CLSIZE*NBPG) 802637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 815080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 825080Swnj #define CLOFF CLOFSET 838993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 8463Sbill 858993Sroot #if CLSIZE==1 868993Sroot #define clbase(i) (i) 878993Sroot #define clrnd(i) (i) 888993Sroot #else 8963Sbill /* give the base virtual address (first of CLSIZE) */ 9063Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 9163Sbill /* round a number of clicks up to a whole cluster */ 9263Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 938993Sroot #endif 9463Sbill 9524930Skarels /* CBLOCK is the size of a clist block, must be power of 2 */ 9624930Skarels #define CBLOCK 64 9724930Skarels #define CBSIZE (CBLOCK - sizeof(struct cblock *)) /* data chars/clist */ 9824930Skarels #define CROUND (CBLOCK - 1) /* clist rounding */ 9963Sbill 10023756Skarels #ifndef KERNEL 10123756Skarels #include <sys/types.h> 10223756Skarels #else 10323756Skarels #ifndef LOCORE 10423756Skarels #include "types.h" 10523756Skarels #endif 10623756Skarels #endif 10723756Skarels 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 */ 17723756Skarels #ifndef howmany 1786564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 17923756Skarels #endif 1806564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 18122721Sbloom 18222721Sbloom /* 18323521Skarels * Maximum size of hostname recognized and stored in the kernel. 18422721Sbloom */ 18523521Skarels #define MAXHOSTNAMELEN 64 186