source: mainline/uspace/srv/fs/minixfs/mfs_super.h@ 7de65cd

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7de65cd was e2ad8e4, checked in by Maurizio Lombardi <m.lombardi85@…>, 15 years ago

Add MinixFS superblock structure definition.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2011 Maurizio Lombardi
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup fs
30 * @{
31 */
32
33#ifndef _MFS_SUPER_H_
34#define _MFS_SUPER_H_
35
36#include "mfs_const.h"
37
38/* Super block table. The root file system and every mounted file system
39 * has an entry here. The entry holds information about the sizes of the bit
40 * maps and inodes. The s_ninodes field gives the number of inodes available
41 * for files and directories, including the root directory. Inode 0 is
42 * on the disk, but not used. Thus s_ninodes = 4 means that 5 bits will be
43 * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
44 * for files and directories. The disk layout is:
45 *
46 * Item # blocks
47 * boot block 1
48 * super block 1 (offset 1kB)
49 * inode map s_imap_blocks
50 * zone map s_zmap_blocks
51 * inodes (s_ninodes + 'inodes per block' - 1)/'inodes per block'
52 * unused whatever is needed to fill out the current zone
53 * data zones (s_zones - s_firstdatazone) << s_log_zone_size
54 *
55 */
56
57struct mfs_v3_superblock {
58 uint32_t s_ninodes; /*# usable inodes on the device*/
59 uint16_t s_nzones; /*total device size including bitmaps etc*/
60 int16_t s_imap_blocks; /*# of blocks used by inode bitmap*/
61 int16_t s_zmap_blocks; /*# of blocks used by zone bitmap*/
62 uint16_t s_firstdatazone_old; /*# of first data zone (small)*/
63 int16_t s_log_zone_size; /*log2 of blocks / zone*/
64 int16_t s_pad; /*try to avoid compiler dependent padding*/
65 int32_t s_max_size; /*maximum file size*/
66 uint32_t s_zones; /*number of zones*/
67 int16_t s_magic; /*magic number to recognize superblocks*/
68
69 /* The following items are valid on disk only for V3 and above */
70
71 int16_t s_pad2;
72 uint16_t s_block_size; /*block size in bytes*/
73 int8_t s_disk_version; /*filesystem format sub-version*/
74} __attribute__ ((packed));
75
76#endif
77
78/**
79 * @}
80 */
Note: See TracBrowser for help on using the repository browser.