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*24654Sbloom * @(#)param.h 6.13 (Berkeley) 09/09/85 723430Smckusick */ 863Sbill 9*24654Sbloom #define BSD 4.3 10*24654Sbloom #define BSD4_3 11*24654Sbloom 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 */ 2963Sbill #define MAXUPRC 25 /* 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 9563Sbill #define CBSIZE 28 /* number of chars in a clist block */ 9663Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 9763Sbill 9823756Skarels #ifndef KERNEL 9923756Skarels #include <sys/types.h> 10023756Skarels #else 10123756Skarels #ifndef LOCORE 10223756Skarels #include "types.h" 10323756Skarels #endif 10423756Skarels #endif 10523756Skarels 10663Sbill /* 1076564Smckusic * File system parameters and macros. 1086564Smckusic * 1096564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1106564Smckusic * with smaller units (fragments) only in the last direct block. 1116564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1126564Smckusic * pool. It may be made larger without any effect on existing 1136564Smckusic * file systems; however making it smaller make make some file 1146564Smckusic * systems unmountable. 1156564Smckusic * 1166564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1176564Smckusic * "sectors" and that fragments must be some multiple of this size. 1187147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1197147Smckusick * be a power of two and in the range of 1207147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1217147Smckusick * This size has no effect upon the file system, but is usually set 1227147Smckusick * to the block size of the root file system, so as to maximize the 1237147Smckusick * speed of ``fsck''. 1243069Swnj */ 1256564Smckusic #define MAXBSIZE 8192 1266564Smckusic #define DEV_BSIZE 512 12712651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 12811225Ssam #define BLKDEV_IOSIZE 2048 1296564Smckusic #define MAXFRAG 8 1306564Smckusic 13112651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13212651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13312651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13412651Ssam ((unsigned)(db) << DEV_BSHIFT) 13512651Ssam 1366564Smckusic /* 1377442Skre * Map a ``block device block'' to a file system block. 1387442Skre * This should be device dependent, and will be after we 1397442Skre * add an entry to cdevsw for that purpose. For now though 1407442Skre * just use DEV_BSIZE. 1417442Skre */ 1428993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1437442Skre 1447442Skre /* 1456564Smckusic * MAXPATHLEN defines the longest permissable path length 1466564Smckusic * after expanding symbolic links. It is used to allocate 1476564Smckusic * a temporary buffer from the buffer pool in which to do the 1486564Smckusic * name expansion, hence should be a power of two, and must 1496564Smckusic * be less than or equal to MAXBSIZE. 1506564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1516564Smckusic * that may be expanded in a path name. It should be set high 1526564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1536564Smckusic * reasonably quickly. 1546564Smckusic */ 1556564Smckusic #define MAXPATHLEN 1024 1566564Smckusic #define MAXSYMLINKS 8 1576564Smckusic 1586564Smckusic /* 1596564Smckusic * bit map related macros 1606564Smckusic */ 1616564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1626564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1636564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1646564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1656564Smckusic 1666564Smckusic /* 1676564Smckusic * Macros for fast min/max. 1686564Smckusic */ 1696564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1706564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1716564Smckusic 1726564Smckusic /* 1736564Smckusic * Macros for counting and rounding. 1746564Smckusic */ 17523756Skarels #ifndef howmany 1766564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 17723756Skarels #endif 1786564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 17922721Sbloom 18022721Sbloom /* 18123521Skarels * Maximum size of hostname recognized and stored in the kernel. 18222721Sbloom */ 18323521Skarels #define MAXHOSTNAMELEN 64 184