4 * Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #ifndef _FS_EFS_EFS_SB_H_
24 #define _FS_EFS_EFS_SB_H_
27 * EFS superblock (92 bytes)
30 * [0] - Values can either be EFS_SB_MAGIC, or EFS_SB_NEWMAGIC (IRIX 3.3+).
31 * [1] - Only used in a grown filesystem. Original bitmap is unused.
32 * [2] - Only exists in IRIX3.3+. (XXX - IRIX man pages say 3.3+ fsck
33 * creates a replicated superblock if space free. Does it update magic?)
34 * [3] - According to IRIX kernel elf headers, two checksum routines exist.
35 * [4] - New at some point (in IRIX 5, but apparently not in IRIX 4).
38 int32_t sb_size
; /* 0: fs size incl. bb 0 (in bb) */
39 int32_t sb_firstcg
; /* 4: first cg offset (in bb) */
40 int32_t sb_cgfsize
; /* 8: cg size (in bb) */
41 int16_t sb_cgisize
; /* 12: inodes/cg (in bb) */
42 int16_t sb_sectors
; /* 14: geom: sectors/track */
43 int16_t sb_heads
; /* 16: geom: heads/cylinder (unused) */
44 int16_t sb_ncg
; /* 18: num of cg's in the filesystem */
45 int16_t sb_dirty
; /* 20: non-0 indicates fsck required */
46 int16_t sb_pad0
; /* 22: */
47 int32_t sb_time
; /* 24: superblock ctime */
48 int32_t sb_magic
; /* 28: magic [0] */
49 char sb_fname
[6]; /* 32: name of filesystem */
50 char sb_fpack
[6]; /* 38: name of filesystem pack */
51 int32_t sb_bmsize
; /* 44: bitmap size (in bytes) */
52 int32_t sb_tfree
; /* 48: total free data blocks */
53 int32_t sb_tinode
; /* 52: total free inodes */
54 int32_t sb_bmblock
; /* 56: bitmap offset (grown fs) [1] */
55 int32_t sb_replsb
; /* 62: repl. superblock offset [2] */
56 int32_t sb_lastinode
; /* 64: last allocated inode [4] */
57 int8_t sb_spare
[20]; /* 68: unused */
58 int32_t sb_checksum
; /* 88: checksum (all above) [3] */
61 #define EFS_SB_SIZE (sizeof(struct efs_sb))
62 #define EFS_SB_CHECKSUM_SIZE (EFS_SB_SIZE - 4)
64 #define EFS_SB_MAGIC 0x00072959 /* original, ungrown layout */
65 #define EFS_SB_NEWMAGIC 0x0007295A /* grown fs (IRIX >= 3.3) */
68 #define EFS_SB_CLEAN 0 /* filesystem is clean */
70 #endif /* !_FS_EFS_EFS_SB_H_ */