super.h

Go to the documentation of this file.
00001 /* Super block table.  The root file system and every mounted file system
00002  * has an entry here.  The entry holds information about the sizes of the bit
00003  * maps and inodes.  The s_ninodes field gives the number of inodes available
00004  * for files and directories, including the root directory.  Inode 0 is 
00005  * on the disk, but not used.  Thus s_ninodes = 4 means that 5 bits will be
00006  * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
00007  * for files and directories.  The disk layout is:
00008  *
00009  *    Item        # blocks
00010  *    boot block      1
00011  *    super block     1    (offset 1kB)
00012  *    inode map     s_imap_blocks
00013  *    zone map      s_zmap_blocks
00014  *    inodes        (s_ninodes + 'inodes per block' - 1)/'inodes per block'
00015  *    unused        whatever is needed to fill out the current zone
00016  *    data zones    (s_zones - s_firstdatazone) << s_log_zone_size
00017  *
00018  * A super_block slot is free if s_dev == NO_DEV. 
00019  */
00020 
00021 EXTERN struct super_block {
00022   ino_t s_ninodes;              /* # usable inodes on the minor device */
00023   zone1_t  s_nzones;            /* total device size, including bit maps etc */
00024   short s_imap_blocks;          /* # of blocks used by inode bit map */
00025   short s_zmap_blocks;          /* # of blocks used by zone bit map */
00026   zone1_t s_firstdatazone;      /* number of first data zone */
00027   short s_log_zone_size;        /* log2 of blocks/zone */
00028   short s_pad;                  /* try to avoid compiler-dependent padding */
00029   off_t s_max_size;             /* maximum file size on this device */
00030   zone_t s_zones;               /* number of zones (replaces s_nzones in V2) */
00031   short s_magic;                /* magic number to recognize super-blocks */
00032 
00033   /* The following items are valid on disk only for V3 and above */
00034 
00035   /* The block size in bytes. Minimum MIN_BLOCK SIZE. SECTOR_SIZE
00036    * multiple. If V1 or V2 filesystem, this should be
00037    * initialised to STATIC_BLOCK_SIZE. Maximum MAX_BLOCK_SIZE.
00038    */
00039   short s_pad2;                 /* try to avoid compiler-dependent padding */
00040   unsigned short s_block_size;  /* block size in bytes. */
00041   char s_disk_version;          /* filesystem format sub-version */
00042 
00043   /* The following items are only used when the super_block is in memory. */
00044   struct inode *s_isup;         /* inode for root dir of mounted file sys */
00045   struct inode *s_imount;       /* inode mounted on */
00046   unsigned s_inodes_per_block;  /* precalculated from magic number */
00047   dev_t s_dev;                  /* whose super block is this? */
00048   int s_rd_only;                /* set to 1 iff file sys mounted read only */
00049   int s_native;                 /* set to 1 iff not byte swapped file system */
00050   int s_version;                /* file system version, zero means bad magic */
00051   int s_ndzones;                /* # direct zones in an inode */
00052   int s_nindirs;                /* # indirect zones per indirect block */
00053   bit_t s_isearch;              /* inodes below this bit number are in use */
00054   bit_t s_zsearch;              /* all zones below this bit number are in use*/
00055 } super_block[NR_SUPERS];
00056 
00057 #define NIL_SUPER (struct super_block *) 0
00058 #define IMAP            0       /* operating on the inode bit map */
00059 #define ZMAP            1       /* operating on the zone bit map */

Generated on Fri Apr 14 22:57:30 2006 for minix by  doxygen 1.4.6