1*1907Swnj /* param.h 4.1 11/9/80 */ 263Sbill 363Sbill /* 463Sbill * tunable variables 563Sbill * 61558Sbill * NB: NBUF must be less than MAXNBUF in locore.s. 763Sbill */ 863Sbill 9*1907Swnj #ifdef notdef 10*1907Swnj #define NBUF 64 /* size of buffer cache */ 11*1907Swnj #define NINODE 200 /* number of in core inodes */ 12*1907Swnj #define NFILE 175 /* number of in core file structures */ 13*1907Swnj #define NMOUNT 7 /* number of mountable file systems */ 14*1907Swnj #define MSWAPX 7 /* pseudo mount table index for swapdev */ 15*1907Swnj #define NPROC 125 /* max number of processes */ 16*1907Swnj #define NTEXT 40 /* max number of pure texts */ 17*1907Swnj #define NCLIST 250 /* max total clist size */ 18*1907Swnj #endif 191558Sbill #define NBUF 128 /* size of buffer cache */ 20379Sbill #define NINODE 400 /* number of in core inodes */ 21379Sbill #define NFILE 350 /* number of in core file structures */ 22356Sbill #define NMOUNT 15 /* number of mountable file systems */ 23356Sbill #define MSWAPX 15 /* pseudo mount table index for swapdev */ 24*1907Swnj #define NPROC 250 /* max number of processes */ 25*1907Swnj #define NTEXT 60 /* max number of pure texts */ 26*1907Swnj #define NCLIST 500 /* max total clist size */ 2763Sbill #define MAXUPRC 25 /* max processes per user */ 2863Sbill #define SSIZE 4 /* initial stack size (*512 bytes) */ 2963Sbill #define SINCR 4 /* increment of stack (*512 bytes) */ 3063Sbill #define NOFILE 20 /* max open files per process */ 3163Sbill #define CANBSIZ 256 /* max size of typewriter line */ 3263Sbill #define SMAPSIZ (4*NPROC) /* size of swap allocation area */ 3363Sbill #define NCALL 40 /* max simultaneous time callouts */ 3463Sbill #define HZ 60 /* Ticks/second of the clock */ 3563Sbill #define TIMEZONE (8*60) /* Minutes westward from Greenwich */ 3663Sbill #define DSTFLAG 1 /* Daylight Saving Time applies in this locality */ 3763Sbill #define MSGBUFS 128 /* Characters saved from error messages */ 38874Sbill #define NCARGS 10240 /* # characters in exec arglist */ 3963Sbill /* 4063Sbill * priorities 4163Sbill * probably should not be 4263Sbill * altered too much 4363Sbill */ 4463Sbill 4563Sbill #define PSWP 0 4663Sbill #define PINOD 10 4763Sbill #define PRIBIO 20 4863Sbill #define PRIUBA 24 4963Sbill #define PZERO 25 5063Sbill #define PPIPE 26 5163Sbill #define PWAIT 30 5263Sbill #define PSLEP 40 5363Sbill #define PUSER 50 5463Sbill 5563Sbill #define NZERO 20 5663Sbill 5763Sbill /* 5863Sbill * signals 5963Sbill * dont change 6063Sbill */ 6163Sbill 62176Sbill #ifndef NSIG 63176Sbill #include <signal.h> 64176Sbill #endif 6563Sbill 6663Sbill /* 6797Sbill * Return values from tsleep(). 6897Sbill */ 6997Sbill #define TS_OK 0 /* normal wakeup */ 7097Sbill #define TS_TIME 1 /* timed-out wakeup */ 7197Sbill #define TS_SIG 2 /* asynchronous signal wakeup */ 7297Sbill 7397Sbill /* 7463Sbill * fundamental constants of the implementation-- 7563Sbill * cannot be changed easily. 7663Sbill * note: UPAGES is well known in locore.s 7763Sbill */ 7863Sbill 7963Sbill #define NBPW sizeof(int) /* number of bytes in an integer */ 8063Sbill 8163Sbill #define UPAGES 6 /* pages of u-area */ 8263Sbill #define NULL 0 8363Sbill #define CMASK 0 /* default mask for file creation */ 8463Sbill #define NODEV (dev_t)(-1) 8563Sbill #define ROOTINO ((ino_t)2) /* i number of all roots */ 8663Sbill #define SUPERB ((daddr_t)1) /* block number of the super block */ 8763Sbill #define DIRSIZ 14 /* max characters per directory */ 8863Sbill 8963Sbill /* 9063Sbill * Clustering of hardware pages on machines with ridiculously small 9163Sbill * page sizes is done here. The paging subsystem deals with units of 9263Sbill * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 9363Sbill * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 9463Sbill * deals with the same size blocks that the file system uses. 9563Sbill * 9663Sbill * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 9763Sbill * 9863Sbill * NB: CLSIZE is well known in locore.s. 9963Sbill */ 10063Sbill #define CLSIZE 2 10163Sbill 10263Sbill /* give the base virtual address (first of CLSIZE) */ 10363Sbill #define clbase(i) ((i) &~ (CLSIZE-1)) 10463Sbill 10563Sbill /* round a number of clicks up to a whole cluster */ 10663Sbill #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 10763Sbill 10863Sbill #if CLSIZE==1 10963Sbill #define BSIZE 512 /* size of secondary block (bytes) */ 11063Sbill #define INOPB 8 /* 8 inodes per block */ 11163Sbill #define BMASK 0777 /* BSIZE-1 */ 11263Sbill #define BSHIFT 9 /* LOG2(BSIZE) */ 11363Sbill #define NMASK 0177 /* NINDIR-1 */ 11463Sbill #define NSHIFT 7 /* LOG2(NINDIR) */ 11563Sbill #define NICINOD 100 /* number of superblock inodes */ 11663Sbill #define NICFREE 50 /* number of superblock free blocks */ 11763Sbill 11863Sbill #endif 11963Sbill 12063Sbill #if CLSIZE==2 12163Sbill #define BSIZE 1024 12263Sbill #define INOPB 16 12363Sbill #define BMASK 01777 12463Sbill #define BSHIFT 10 12563Sbill #define NMASK 0377 12663Sbill #define NSHIFT 8 12763Sbill #define NICINOD 100 12863Sbill #define NICFREE 178 12963Sbill #endif 13063Sbill 13163Sbill #if CLSIZE==4 13263Sbill #define BSIZE 2048 13363Sbill #define INOPB 32 13463Sbill #define BMASK 03777 13563Sbill #define BSHIFT 11 13663Sbill #define NMASK 0777 13763Sbill #define NSHIFT 9 13863Sbill #define NICINOD 100 13963Sbill #define NICFREE 434 14063Sbill #endif 14163Sbill 14263Sbill #ifndef INTRLVE 14363Sbill /* macros replacing interleaving functions */ 14463Sbill #define dkblock(bp) ((bp)->b_blkno) 14563Sbill #define dkunit(bp) (minor((bp)->b_dev) >> 3) 14663Sbill #endif 14763Sbill 14863Sbill /* inumber to disk address and inumber to disk offset */ 14963Sbill #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 15063Sbill #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 15163Sbill 15263Sbill /* file system blocks to disk blocks and back */ 15363Sbill #define fsbtodb(b) ((b)*CLSIZE) 15463Sbill #define dbtofsb(b) ((b)/CLSIZE) 15563Sbill 15663Sbill #define NINDIR (BSIZE/sizeof(daddr_t)) 15763Sbill 15863Sbill #define CBSIZE 28 /* number of chars in a clist block */ 15963Sbill #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 16063Sbill #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 16163Sbill 16263Sbill /* 16363Sbill * Macros for fast min/max 16463Sbill */ 16563Sbill #define MIN(a,b) (((a)<(b))?(a):(b)) 16663Sbill #define MAX(a,b) (((a)>(b))?(a):(b)) 16763Sbill 16863Sbill /* 16963Sbill * Some macros for units conversion 17063Sbill */ 17163Sbill /* Core clicks (512 bytes) to segments and vice versa */ 17263Sbill #define ctos(x) (x) 17363Sbill #define stoc(x) (x) 17463Sbill 17563Sbill /* Core clicks (512 bytes) to disk blocks */ 17663Sbill #define ctod(x) (x) 17763Sbill 17863Sbill /* clicks to bytes */ 17963Sbill #define ctob(x) ((x)<<9) 18063Sbill 18163Sbill /* bytes to clicks */ 18263Sbill #define btoc(x) ((((unsigned)(x)+511)>>9)) 18363Sbill 18463Sbill /* major part of a device */ 18563Sbill #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 18663Sbill 18763Sbill /* minor part of a device */ 18863Sbill #define minor(x) ((int)((x)&0377)) 18963Sbill 19063Sbill /* make a device number */ 19163Sbill #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) 19263Sbill 19363Sbill typedef struct { int r[1]; } * physadr; 19463Sbill typedef int daddr_t; 19563Sbill typedef char * caddr_t; 19663Sbill typedef unsigned short ino_t; 19763Sbill typedef int swblk_t; 19863Sbill typedef int size_t; 19963Sbill typedef int time_t; 20063Sbill typedef int label_t[14]; 20163Sbill typedef short dev_t; 20263Sbill typedef int off_t; 20363Sbill 204582Sbill typedef unsigned char u_char; 205582Sbill typedef unsigned short u_short; 206582Sbill typedef unsigned int u_int; 207582Sbill typedef unsigned long u_long; 208582Sbill 20963Sbill /* 21063Sbill * Machine-dependent bits and macros 21163Sbill */ 21263Sbill #define UMODE PSL_CURMOD /* usermode bits */ 21363Sbill #define USERMODE(ps) (((ps) & UMODE) == UMODE) 21463Sbill 21563Sbill #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 216