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*23521Skarels * @(#)param.h 6.11 (Berkeley) 06/17/85 723430Smckusick */ 863Sbill 963Sbill /* 1012508Ssam * Machine type dependent parameters. 1163Sbill */ 129791Ssam #ifdef KERNEL 1317050Skarels #include "../machine/machparam.h" 149791Ssam #else 1517050Skarels #include <machine/machparam.h> 168993Sroot #endif 1763Sbill 188993Sroot #define NPTEPG (NBPG/(sizeof (struct pte))) 198993Sroot 208993Sroot /* 218993Sroot * Machine-independent constants 228993Sroot */ 2317556Skarels #define NMOUNT 20 /* number of mountable file systems */ 2416796Skarels /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ 2515070Skarels #define MSWAPX NMOUNT /* pseudo mount table index for swapdev */ 2663Sbill #define MAXUPRC 25 /* max processes per user */ 2719955Skarels #define NOFILE 64 /* max open files per process */ 2863Sbill #define CANBSIZ 256 /* max size of typewriter line */ 2917556Skarels #define NCARGS 20480 /* # characters in exec arglist */ 3017996Skarels #define NGROUPS 16 /* max number groups */ 312751Swnj 3211808Ssam #define NOGROUP -1 /* marker for empty group set member */ 3311808Ssam 3463Sbill /* 358993Sroot * Priorities 3663Sbill */ 3763Sbill #define PSWP 0 3863Sbill #define PINOD 10 3963Sbill #define PRIBIO 20 4063Sbill #define PRIUBA 24 4163Sbill #define PZERO 25 4263Sbill #define PPIPE 26 4363Sbill #define PWAIT 30 447688Ssam #define PLOCK 35 4563Sbill #define PSLEP 40 4663Sbill #define PUSER 50 4763Sbill 4817556Skarels #define NZERO 0 4963Sbill 5063Sbill /* 518993Sroot * Signals 5263Sbill */ 5312880Ssam #ifdef KERNEL 5417033Sbloom #include "signal.h" 5512880Ssam #else 56176Sbill #include <signal.h> 57176Sbill #endif 5863Sbill 5912880Ssam #define ISSIG(p) \ 6012880Ssam ((p)->p_sig && ((p)->p_flag&STRC || \ 6112965Sroot ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) 628467Sroot 6363Sbill /* 648993Sroot * Fundamental constants of the implementation. 6597Sbill */ 6612880Ssam #define NBBY 8 /* number of bits in a byte */ 6712880Ssam #define NBPW sizeof(int) /* number of bytes in an integer */ 6863Sbill 6963Sbill #define NULL 0 7016796Skarels #define CMASK 022 /* default mask for file creation */ 7163Sbill #define NODEV (dev_t)(-1) 7263Sbill 7363Sbill /* 7463Sbill * Clustering of hardware pages on machines with ridiculously small 7563Sbill * page sizes is done here. The paging subsystem deals with units of 7616796Skarels * CLSIZE pte's describing NBPG (from vm.h) pages each. 7763Sbill * 7863Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 7963Sbill */ 805080Swnj #define CLBYTES (CLSIZE*NBPG) 812637Swnj #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 825080Swnj #define claligned(x) ((((int)(x))&CLOFSET)==0) 835080Swnj #define CLOFF CLOFSET 848993Sroot #define CLSHIFT (PGSHIFT+CLSIZELOG2) 8563Sbill 868993Sroot #if CLSIZE==1 878993Sroot #define clbase(i) (i) 888993Sroot #define clrnd(i) (i) 898993Sroot #else 9063Sbill /* give the base virtual address (first of CLSIZE) */ 9163Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 9263Sbill /* round a number of clicks up to a whole cluster */ 9363Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 948993Sroot #endif 9563Sbill 9663Sbill #ifndef INTRLVE 9763Sbill /* macros replacing interleaving functions */ 9863Sbill #define dkblock(bp) ((bp)->b_blkno) 9963Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 10063Sbill #endif 10163Sbill 10263Sbill #define CBSIZE 28 /* number of chars in a clist block */ 10363Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 10463Sbill 10563Sbill /* 1066564Smckusic * File system parameters and macros. 1076564Smckusic * 1086564Smckusic * The file system is made out of blocks of at most MAXBSIZE units, 1096564Smckusic * with smaller units (fragments) only in the last direct block. 1106564Smckusic * MAXBSIZE primarily determines the size of buffers in the buffer 1116564Smckusic * pool. It may be made larger without any effect on existing 1126564Smckusic * file systems; however making it smaller make make some file 1136564Smckusic * systems unmountable. 1146564Smckusic * 1156564Smckusic * Note that the blocked devices are assumed to have DEV_BSIZE 1166564Smckusic * "sectors" and that fragments must be some multiple of this size. 1177147Smckusick * Block devices are read in BLKDEV_IOSIZE units. This number must 1187147Smckusick * be a power of two and in the range of 1197147Smckusick * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE 1207147Smckusick * This size has no effect upon the file system, but is usually set 1217147Smckusick * to the block size of the root file system, so as to maximize the 1227147Smckusick * speed of ``fsck''. 1233069Swnj */ 1246564Smckusic #define MAXBSIZE 8192 1256564Smckusic #define DEV_BSIZE 512 12612651Ssam #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 12711225Ssam #define BLKDEV_IOSIZE 2048 1286564Smckusic #define MAXFRAG 8 1296564Smckusic 13012651Ssam #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 13112651Ssam ((unsigned)(bytes) >> DEV_BSHIFT) 13212651Ssam #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 13312651Ssam ((unsigned)(db) << DEV_BSHIFT) 13412651Ssam 1356564Smckusic /* 1367442Skre * Map a ``block device block'' to a file system block. 1377442Skre * This should be device dependent, and will be after we 1387442Skre * add an entry to cdevsw for that purpose. For now though 1397442Skre * just use DEV_BSIZE. 1407442Skre */ 1418993Sroot #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 1427442Skre 1437442Skre /* 1446564Smckusic * MAXPATHLEN defines the longest permissable path length 1456564Smckusic * after expanding symbolic links. It is used to allocate 1466564Smckusic * a temporary buffer from the buffer pool in which to do the 1476564Smckusic * name expansion, hence should be a power of two, and must 1486564Smckusic * be less than or equal to MAXBSIZE. 1496564Smckusic * MAXSYMLINKS defines the maximum number of symbolic links 1506564Smckusic * that may be expanded in a path name. It should be set high 1516564Smckusic * enough to allow all legitimate uses, but halt infinite loops 1526564Smckusic * reasonably quickly. 1536564Smckusic */ 1546564Smckusic #define MAXPATHLEN 1024 1556564Smckusic #define MAXSYMLINKS 8 1566564Smckusic 1576564Smckusic /* 1586564Smckusic * bit map related macros 1596564Smckusic */ 1606564Smckusic #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 1616564Smckusic #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 1626564Smckusic #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 1636564Smckusic #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 1646564Smckusic 1656564Smckusic /* 1666564Smckusic * Macros for fast min/max. 1676564Smckusic */ 1686564Smckusic #define MIN(a,b) (((a)<(b))?(a):(b)) 1696564Smckusic #define MAX(a,b) (((a)>(b))?(a):(b)) 1706564Smckusic 1716564Smckusic /* 1726564Smckusic * Macros for counting and rounding. 1736564Smckusic */ 1746564Smckusic #define howmany(x, y) (((x)+((y)-1))/(y)) 1756564Smckusic #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 17622721Sbloom 17722721Sbloom /* 178*23521Skarels * Maximum size of hostname recognized and stored in the kernel. 17922721Sbloom */ 180*23521Skarels #define MAXHOSTNAMELEN 64 181*23521Skarels 182*23521Skarels #ifndef KERNEL 183*23521Skarels #include <sys/types.h> 184*23521Skarels #else 185*23521Skarels #ifndef LOCORE 186*23521Skarels #include "types.h" 187*23521Skarels #endif 188*23521Skarels #endif 189