/*
* Copyright (c) 1987,1997, Prentice Hall
* All rights reserved.
*
* Redistribution and use of the MINIX operating system in source and
* binary forms, with or without modification, are permitted provided
* that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* - Neither the name of Prentice Hall nor the names of the software
* authors or contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL PRENTICE HALL OR ANY AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** @addtogroup FileSystemImpl
* @{
*/
/**
* @file super.h
* @brief The s_ninodes field gives the number of inodes available
* for files and directories, including the root directory. Inode 0 is
* on the disk, but not used. Thus s_ninodes = 4 means that 5 bits will be
* used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
* for files and directories.
*
*/
#ifndef _SUPER_H
#define _SUPER_H
#define NIL_SUPER (super_block_t *) 0 /**< An empty super block */
/**
* The disk layout is:
*
* Item # blocks
* boot block 1
* super block 1
* inode map s_imap_blocks
* zone map s_zmap_blocks
* inodes (s_ninodes + 'inodes per block' - 1)/'inodes per block'
* unused whatever is needed to fill out the current zone
* data zones (s_zones - s_firstdatazone) << s_log_zone_size
*/
typedef struct {
ino_t s_ninodes; /**< # usable inodes on the minor device */
zone1_t s_nzones; /**< total device size, including bit maps etc */
short s_imap_blocks; /**< # of blocks used by inode bit map */
short s_zmap_blocks; /**< # of blocks used by zone bit map */
zone1_t s_firstdatazone; /**< number of first data zone */
short s_log_zone_size; /**< log2 of blocks/zone */
offset_t s_max_size; /**< maximum file size on this device */
short s_magic; /**< magic number to recognize super-blocks */
short s_pad; /**< try to avoid compiler-dependent padding */
zone_t s_zones; /**< number of zones (replaces s_nzones in V2) */
/* The following items are only used when the super_block is in memory. */
unsigned s_inodes_per_block; /**< precalculated from magic number */
int s_native; /**< set to 1 iff not byte swapped file system */
int s_version; /**< file system version, zero means bad magic */
int s_extend; /**< 1 if file system support 30 chars in file name */
int s_ndzones; /**< # direct zones in an inode */
int s_nindirs; /**< # indirect zones per indirect block */
bit_t s_isearch; /**< inodes below this bit number are in use */
bit_t s_zsearch; /**< all zones below this bit number are in use*/
} super_block_t;
extern super_block_t* super_block; /**< A variable to store the super block */
#endif /* _SUPER_H */
/**
* }
*/