Subversion Repositories HelenOS

Rev

Rev 2404 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2404 konopa 1
/*
2
 * Copyright (c) 1987,1997, Prentice Hall
3
 * All rights reserved.
4
 *
5
 * Redistribution and use of the MINIX operating system in source and
6
 * binary forms, with or without modification, are permitted provided
7
 * that the following conditions are met:
8
 
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 
12
 * - Redistributions in binary form must reproduce the above
13
 *   copyright notice, this list of conditions and the following
14
 *   disclaimer in the documentation and/or other materials provided
15
 *   with the distribution.
16
 
17
 * - Neither the name of Prentice Hall nor the names of the software
18
 *   authors or contributors may be used to endorse or promote
19
 *   products derived from this software without specific prior
20
 *   written permission.
21
 
22
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
23
 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26
 * IN NO EVENT SHALL PRENTICE HALL OR ANY AUTHORS OR CONTRIBUTORS BE
27
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 */
2435 jelen 35
 
36
/** @addtogroup FileSystemImpl
37
* @{
38
*/
2404 konopa 39
 
2435 jelen 40
/**
41
 * @file    super.h
42
 * @brief   The s_ninodes field gives the number of inodes available
43
     *      for files and directories, including the root directory.  Inode 0 is
44
     *      on the disk, but not used.  Thus s_ninodes = 4 means that 5 bits will be
45
     *      used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
46
     *      for files and directories.  
2382 konopa 47
     *
48
*/
49
 
50
 
51
#ifndef _SUPER_H
52
#define _SUPER_H
53
 
2435 jelen 54
#define NIL_SUPER (super_block_t *) 0   /**< An empty super block */
2382 konopa 55
 
2435 jelen 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
*/   
2382 konopa 68
typedef struct {
2435 jelen 69
      ino_t s_ninodes;          /**< # usable inodes on the minor device */
70
      zone1_t  s_nzones;            /**< total device size, including bit maps etc */
71
      short s_imap_blocks;          /**< # of blocks used by inode bit map */
72
      short s_zmap_blocks;          /**< # of blocks used by zone bit map */
73
      zone1_t s_firstdatazone;      /**< number of first data zone */
74
      short s_log_zone_size;        /**< log2 of blocks/zone */
75
      offset_t s_max_size;          /**< maximum file size on this device */
76
      short s_magic;                /**< magic number to recognize super-blocks */
77
      short s_pad;                  /**< try to avoid compiler-dependent padding */
78
      zone_t s_zones;               /**< number of zones (replaces s_nzones in V2) */      
2382 konopa 79
 
80
      /* The following items are only used when the super_block is in memory. */
2435 jelen 81
      unsigned s_inodes_per_block;  /**< precalculated from magic number */
82
      int s_native;         /**< set to 1 iff not byte swapped file system */
83
      int s_version;                /**< file system version, zero means bad magic */
84
      int s_extend;         /**< 1 if file system support 30 chars in file name */
85
      int s_ndzones;                /**< # direct zones in an inode */
86
      int s_nindirs;                /**< # indirect zones per indirect block */
87
      bit_t s_isearch;              /**< inodes below this bit number are in use */
88
      bit_t s_zsearch;              /**< all zones below this bit number are in use*/
2382 konopa 89
    } super_block_t;
90
 
2435 jelen 91
extern super_block_t* super_block;    /**< A variable to store the super block */
2382 konopa 92
 
93
#endif /* _SUPER_H */
2435 jelen 94
 
95
/**
96
 * }
97
 */
98