Subversion Repositories HelenOS

Rev

Rev 2404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2404 Rev 2435
Line 30... Line 30...
30
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 */
34
 */
35
 
35
 
-
 
36
/** @addtogroup FileSystemImpl
-
 
37
* @{
-
 
38
*/
36
 
39
 
37
/*    
40
/**
-
 
41
 * @file    super.h
38
     * The s_ninodes field gives the number of inodes available
42
 * @brief   The s_ninodes field gives the number of inodes available
39
     * for files and directories, including the root directory.  Inode 0 is
43
     *      for files and directories, including the root directory.  Inode 0 is
40
     * on the disk, but not used.  Thus s_ninodes = 4 means that 5 bits will be
44
     *      on the disk, but not used.  Thus s_ninodes = 4 means that 5 bits will be
41
     * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
45
     *      used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
42
     * for files and directories.  The disk layout is:
46
     *      for files and directories.  
43
     *
-
 
44
     *      Item        # blocks
-
 
45
     *    boot block      1
-
 
46
     *    super block     1
-
 
47
     *    inode map     s_imap_blocks
-
 
48
     *    zone map      s_zmap_blocks
-
 
49
     *    inodes        (s_ninodes + 'inodes per block' - 1)/'inodes per block'
-
 
50
     *    unused        whatever is needed to fill out the current zone
-
 
51
     *    data zones    (s_zones - s_firstdatazone) << s_log_zone_size
-
 
52
     *
47
     *
53
*/
48
*/
54
   
49
   
55
 
50
 
56
#ifndef _SUPER_H
51
#ifndef _SUPER_H
57
#define _SUPER_H
52
#define _SUPER_H
58
 
53
 
59
#define NIL_SUPER (super_block_t *) 0
54
#define NIL_SUPER (super_block_t *) 0   /**< An empty super block */
60
 
55
 
-
 
56
/**
-
 
57
* The disk layout is:
-
 
58
*
-
 
59
*    Item        # blocks
-
 
60
*    boot block      1
-
 
61
*    super block     1
-
 
62
*    inode map     s_imap_blocks
-
 
63
*    zone map      s_zmap_blocks
-
 
64
*    inodes        (s_ninodes + 'inodes per block' - 1)/'inodes per block'
-
 
65
*    unused        whatever is needed to fill out the current zone
-
 
66
*    data zones    (s_zones - s_firstdatazone) << s_log_zone_size
-
 
67
*/   
61
typedef struct {
68
typedef struct {
62
      ino_t s_ninodes;          /* # usable inodes on the minor device */
69
      ino_t s_ninodes;          /**< # usable inodes on the minor device */
63
      zone1_t  s_nzones;            /* total device size, including bit maps etc */
70
      zone1_t  s_nzones;            /**< total device size, including bit maps etc */
64
      short s_imap_blocks;          /* # of blocks used by inode bit map */
71
      short s_imap_blocks;          /**< # of blocks used by inode bit map */
65
      short s_zmap_blocks;          /* # of blocks used by zone bit map */
72
      short s_zmap_blocks;          /**< # of blocks used by zone bit map */
66
      zone1_t s_firstdatazone;      /* number of first data zone */
73
      zone1_t s_firstdatazone;      /**< number of first data zone */
67
      short s_log_zone_size;        /* log2 of blocks/zone */
74
      short s_log_zone_size;        /**< log2 of blocks/zone */
68
      offset_t s_max_size;          /* maximum file size on this device */
75
      offset_t s_max_size;          /**< maximum file size on this device */
69
      short s_magic;                /* magic number to recognize super-blocks */
76
      short s_magic;                /**< magic number to recognize super-blocks */
70
      short s_pad;                  /* try to avoid compiler-dependent padding */
77
      short s_pad;                  /**< try to avoid compiler-dependent padding */
71
      zone_t s_zones;               /* number of zones (replaces s_nzones in V2) */    
78
      zone_t s_zones;               /**< number of zones (replaces s_nzones in V2) */      
72
   
79
   
73
      /* The following items are only used when the super_block is in memory. */
80
      /* The following items are only used when the super_block is in memory. */
74
      unsigned s_inodes_per_block;  /* precalculated from magic number */
81
      unsigned s_inodes_per_block;  /**< precalculated from magic number */
75
      int s_native;         /* set to 1 iff not byte swapped file system */
82
      int s_native;         /**< set to 1 iff not byte swapped file system */
76
      int s_version;                /* file system version, zero means bad magic */
83
      int s_version;                /**< file system version, zero means bad magic */
77
      int s_extend;         /* 1 if file system support 30 chars in file name */
84
      int s_extend;         /**< 1 if file system support 30 chars in file name */
78
      int s_ndzones;                /* # direct zones in an inode */
85
      int s_ndzones;                /**< # direct zones in an inode */
79
      int s_nindirs;                /* # indirect zones per indirect block */
86
      int s_nindirs;                /**< # indirect zones per indirect block */
80
      bit_t s_isearch;              /* inodes below this bit number are in use */
87
      bit_t s_isearch;              /**< inodes below this bit number are in use */
81
      bit_t s_zsearch;              /* all zones below this bit number are in use*/
88
      bit_t s_zsearch;              /**< all zones below this bit number are in use*/
82
    } super_block_t;
89
    } super_block_t;
83
 
90
 
84
extern super_block_t* super_block;
91
extern super_block_t* super_block;    /**< A variable to store the super block */
85
 
92
 
86
#endif /* _SUPER_H */
93
#endif /* _SUPER_H */
-
 
94
 
-
 
95
/**
-
 
96
 * }
-
 
97
 */
-
 
98