1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)param.h	7.1 (Berkeley) 6/4/86
   7:  */
   8: 
   9: #define BSD 43      /* 4.3 * 10, as cpp doesn't do floats */
  10: #define BSD4_3  1
  11: 
  12: /*
  13:  * Machine type dependent parameters.
  14:  */
  15: #ifdef KERNEL
  16: #include "../machine/machparam.h"
  17: #else
  18: #include <machine/machparam.h>
  19: #endif
  20: 
  21: #define NPTEPG      (NBPG/(sizeof (struct pte)))
  22: 
  23: /*
  24:  * Machine-independent constants
  25:  */
  26: #define NMOUNT  20      /* number of mountable file systems */
  27: /* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */
  28: #define MSWAPX  NMOUNT      /* pseudo mount table index for swapdev */
  29: #define MAXUPRC 40      /* max processes per user */
  30: #define NOFILE  64      /* max open files per process */
  31: #define CANBSIZ 256     /* max size of typewriter line */
  32: #define NCARGS  20480       /* # characters in exec arglist */
  33: #define NGROUPS 16      /* max number groups */
  34: 
  35: #define NOGROUP 65535       /* marker for empty group set member */
  36: 
  37: /*
  38:  * Priorities
  39:  */
  40: #define PSWP    0
  41: #define PINOD   10
  42: #define PRIBIO  20
  43: #define PRIUBA  24
  44: #define PZERO   25
  45: #define PPIPE   26
  46: #define PWAIT   30
  47: #define PLOCK   35
  48: #define PSLEP   40
  49: #define PUSER   50
  50: 
  51: #define NZERO   0
  52: 
  53: /*
  54:  * Signals
  55:  */
  56: #ifdef KERNEL
  57: #include "signal.h"
  58: #else
  59: #include <signal.h>
  60: #endif
  61: 
  62: #define ISSIG(p) \
  63:     ((p)->p_sig && ((p)->p_flag&STRC || \
  64:      ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
  65: 
  66: #define NBPW    sizeof(int) /* number of bytes in an integer */
  67: 
  68: #define NULL    0
  69: #define CMASK   022     /* default mask for file creation */
  70: #define NODEV   (dev_t)(-1)
  71: 
  72: /*
  73:  * Clustering of hardware pages on machines with ridiculously small
  74:  * page sizes is done here.  The paging subsystem deals with units of
  75:  * CLSIZE pte's describing NBPG (from vm.h) pages each.
  76:  *
  77:  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
  78:  */
  79: #define CLBYTES     (CLSIZE*NBPG)
  80: #define CLOFSET     (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
  81: #define claligned(x)    ((((int)(x))&CLOFSET)==0)
  82: #define CLOFF       CLOFSET
  83: #define CLSHIFT     (PGSHIFT+CLSIZELOG2)
  84: 
  85: #if CLSIZE==1
  86: #define clbase(i)   (i)
  87: #define clrnd(i)    (i)
  88: #else
  89: /* give the base virtual address (first of CLSIZE) */
  90: #define clbase(i)   ((i) &~ (CLSIZE-1))
  91: /* round a number of clicks up to a whole cluster */
  92: #define clrnd(i)    (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
  93: #endif
  94: 
  95: /* CBLOCK is the size of a clist block, must be power of 2 */
  96: #define CBLOCK  64
  97: #define CBSIZE  (CBLOCK - sizeof(struct cblock *))  /* data chars/clist */
  98: #define CROUND  (CBLOCK - 1)                /* clist rounding */
  99: 
 100: #ifndef KERNEL
 101: #include    <sys/types.h>
 102: #else
 103: #ifndef LOCORE
 104: #include    "types.h"
 105: #endif
 106: #endif
 107: 
 108: /*
 109:  * File system parameters and macros.
 110:  *
 111:  * The file system is made out of blocks of at most MAXBSIZE units,
 112:  * with smaller units (fragments) only in the last direct block.
 113:  * MAXBSIZE primarily determines the size of buffers in the buffer
 114:  * pool. It may be made larger without any effect on existing
 115:  * file systems; however making it smaller make make some file
 116:  * systems unmountable.
 117:  *
 118:  * Note that the blocked devices are assumed to have DEV_BSIZE
 119:  * "sectors" and that fragments must be some multiple of this size.
 120:  * Block devices are read in BLKDEV_IOSIZE units. This number must
 121:  * be a power of two and in the range of
 122:  *	DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
 123:  * This size has no effect upon the file system, but is usually set
 124:  * to the block size of the root file system, so as to maximize the
 125:  * speed of ``fsck''.
 126:  */
 127: #define MAXBSIZE    8192
 128: #define DEV_BSIZE   512
 129: #define DEV_BSHIFT  9       /* log2(DEV_BSIZE) */
 130: #define BLKDEV_IOSIZE   2048
 131: #define MAXFRAG     8
 132: 
 133: #define btodb(bytes)            /* calculates (bytes / DEV_BSIZE) */ \
 134:     ((unsigned)(bytes) >> DEV_BSHIFT)
 135: #define dbtob(db)           /* calculates (db * DEV_BSIZE) */ \
 136:     ((unsigned)(db) << DEV_BSHIFT)
 137: 
 138: /*
 139:  * Map a ``block device block'' to a file system block.
 140:  * This should be device dependent, and will be after we
 141:  * add an entry to cdevsw for that purpose.  For now though
 142:  * just use DEV_BSIZE.
 143:  */
 144: #define bdbtofsb(bn)    ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
 145: 
 146: /*
 147:  * MAXPATHLEN defines the longest permissable path length
 148:  * after expanding symbolic links. It is used to allocate
 149:  * a temporary buffer from the buffer pool in which to do the
 150:  * name expansion, hence should be a power of two, and must
 151:  * be less than or equal to MAXBSIZE.
 152:  * MAXSYMLINKS defines the maximum number of symbolic links
 153:  * that may be expanded in a path name. It should be set high
 154:  * enough to allow all legitimate uses, but halt infinite loops
 155:  * reasonably quickly.
 156:  */
 157: #define MAXPATHLEN  1024
 158: #define MAXSYMLINKS 8
 159: 
 160: /*
 161:  * bit map related macros
 162:  */
 163: #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
 164: #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
 165: #define isset(a,i)  ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
 166: #define isclr(a,i)  (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
 167: 
 168: /*
 169:  * Macros for fast min/max.
 170:  */
 171: #define MIN(a,b) (((a)<(b))?(a):(b))
 172: #define MAX(a,b) (((a)>(b))?(a):(b))
 173: 
 174: /*
 175:  * Macros for counting and rounding.
 176:  */
 177: #ifndef howmany
 178: #define howmany(x, y)   (((x)+((y)-1))/(y))
 179: #endif
 180: #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
 181: 
 182: /*
 183:  * Maximum size of hostname recognized and stored in the kernel.
 184:  */
 185: #define MAXHOSTNAMELEN  64

Defined macros

BLKDEV_IOSIZE defined in line 130; used 5 times
BSD defined in line 9; never used
BSD4_3 defined in line 10; never used
CANBSIZ defined in line 31; never used
CBLOCK defined in line 96; used 2 times
CBSIZE defined in line 97; used 19 times
CLOFF defined in line 82; never used
CLSHIFT defined in line 83; used 2 times
CMASK defined in line 69; used 1 times
CROUND defined in line 98; used 21 times
DEV_BSHIFT defined in line 129; used 4 times
DEV_BSIZE defined in line 128; used 6 times
ISSIG defined in line 62; used 4 times
MAXFRAG defined in line 131; used 1 times
MAXHOSTNAMELEN defined in line 185; never used
MAXPATHLEN defined in line 157; used 4 times
MAXSYMLINKS defined in line 158; used 1 times
MAXUPRC defined in line 29; used 1 times
NBPW defined in line 66; used 10 times
NCARGS defined in line 32; used 3 times
NGROUPS defined in line 33; used 10 times
PLOCK defined in line 47; used 2 times
PPIPE defined in line 45; never used
PRIUBA defined in line 43; never used
PSLEP defined in line 48; used 2 times
PWAIT defined in line 46; used 1 times
bdbtofsb defined in line 144; used 65 times
claligned defined in line 81; used 3 times
clbase defined in line 90; used 2 times
clrbit defined in line 164; used 3 times
howmany defined in line 178; used 1 times
isclr defined in line 166; used 4 times
isset defined in line 165; used 1 times
setbit defined in line 163; used 3 times

Usage of this include

param.h used 216 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1700
Valid CSS Valid XHTML 1.0 Strict