/* filsys512.h -- 28 june 82 by dave * * This file contains the numbers for 512 byte block file system. */ /* fundamental constants of the filesystem */ #define BSIZE 512 /* size of secondary block (bytes) */ #define BMASK (BSIZE-1) /* BSIZE-1 */ #define BSHIFT 9 /* LOG2(BSIZE) */ #define NINDIR (BSIZE/sizeof(daddr_t)) #define NMASK (NINDIR-1) /* NINDIR-1 */ #define NSHIFT 8 /* LOG2(NINDIR) */ #define INOPB 8 /* inodes per block */ #define INOSHFT 3 /* LOG2(INOPB) */ #define INOMOD 07 /* value to and to give offset */ #define ROOTINO ((ino_t)2) /* i number of all roots */ #define SUPERB ((daddr_t)1) /* block number of the super block */ #define DIRSIZ 14 /* max characters per directory */ #define NICINOD 100 /* number of superblock inodes */ #define NICFREE 50 /* number of superblock free blocks */ /* Some macros for units conversion */ /* Core clicks (1024 bytes) to disk blocks */ #define ctod(x) (2*x) /* inumber to disk address */ #define itod(x) (daddr_t)((((unsigned)x+INOPB*2-1)>>INOSHFT)) /* inumber to disk offset */ #define itoo(x) (int)((x+31)&0xf) /* x mod INOPB */ /* Structure of the super-block */ struct filsys { long s_isize; /* size in blocks of i-list */ daddr_t s_fsize; /* size in blocks of entire volume */ long s_nfree; /* number of addresses in s_free */ daddr_t s_free[NICFREE]; /* free block list */ long s_ninode; /* number of i-nodes in s_inode */ ino_t s_inode[NICINOD]; /* free i-node list */ char s_flock; /* lock during free list manipulation */ char s_ilock; /* lock during i-list manipulation */ char s_fmod; /* super block modified flag */ char s_ronly; /* mounted read-only flag */ time_t s_time; /* last super block update */ short s_dinfo[4]; /* device information */ daddr_t s_tfree; /* total free blocks*/ ino_t s_tinode; /* total free inodes */ char s_fname[6]; /* file system name */ char s_fpack[6]; /* file system pack name */ };