1N/A * GRUB -- GRand Unified Bootloader 1N/A * Copyright (C) 2000 International Business Machines Corp. 1N/A * Copyright (C) 2001 Free Software Foundation, Inc. 1N/A * This program is free software; you can redistribute it and/or modify 1N/A * it under the terms of the GNU General Public License as published by 1N/A * the Free Software Foundation; either version 2 of the License, or 1N/A * (at your option) any later version. 1N/A * This program is distributed in the hope that it will be useful, 1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 1N/A * the GNU General Public License for more details. 1N/A * You should have received a copy of the GNU General Public License 1N/A * along with this program; if not, write to the Free Software 1N/A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1N/A * file system option (superblock flag) 1N/A/* platform option (conditional compilation) */ 1N/A/* directory option */ 1N/A * buffer cache configuration 1N/A#
define PSIZE 4096 /* page size (in byte) */ 1N/A * fs fundamental size 1N/A * PSIZE >= file system block size >= PBSIZE >= DISIZE 1N/A#
define PBSIZE 512 /* physical block size (in byte) */ 1N/A#
define DISIZE 512 /* on-disk inode size (in byte) */ 1N/A/* Minimum number of bytes supported for a JFS partition */ 1N/A * fixed byte offset address 1N/A * fixed reserved inode number 1N/A/* aggregate inode */ 1N/A * fileset inode map inode 1N/A/* per fileset inode */ 1N/A * directory configuration 1N/Atypedef unsigned long long u64;
1N/A/* xd_t field extraction */ 1N/A * data extent descriptor (dxd) 1N/A unsigned len:
24;
/* 3: length in unit of fsblksize */ 1N/A unsigned addr1:
8;
/* 1: address in unit of fsblksize */ 1N/A * DASD limit information - stored in directory inode 1N/A u8 delta;
/* Alert Threshold delta (in percent) */ 1N/A * VFS: number of blocks 1N/A * VFS: fragment size 1N/A s16 pad;
/* 2: padding necessary for alignment */ 1N/A * aggregate inode table 1N/A * aggregate inode map 1N/A * the fsck service log. 1N/A * N.B. These blocks are divided among the 1N/A * versions kept. This is not a per 1N/A * N.B. These blocks are included in the 1N/A * length field of s_fsckpxd. 1N/A * 0 => no service log data yet 1N/A * 1 => the first one 1N/A * N.B. This must be 11 bytes to 1N/A * conform with the OS/2 BootSector 1N/A /* extendfs() parameter under s_state & FM_EXTENDFS */ 1N/A /* - 128 byte boundary - */ 1N/A * DFS VFS support (preliminary) 1N/A char s_attach;
/* 1: VFS: flag: set when aggregate is attached 1N/A * available to "normal" (non-root) users. 1N/A * exclusive use of root. This value can be 0, 1N/A * and if it is then totalUsable will be equal 1N/A * to # of blocks in aggregate. I believe this 1N/A * means that minFree + totalUsable = # blocks. 1N/A * In that case, we don't need to store both 1N/A * totalUsable and minFree since we can compute 1N/A * one from the other. I would guess minFree 1N/A * would be the one we should store, and 1N/A * totalUsable would be the one we should 1N/A * compute. (Just a guess...) 1N/A * "normal" users. It may be this is something 1N/A * we should compute when asked for instead of 1N/A * storing in the superblock. I don't know how 1N/A * often this information is needed. 1N/A * N.B. last/only segment of entry is terminated by next = -1; 1N/A * directory page slot 1N/A * For legacy filesystems, name contains 13 unichars -- no index field 1N/A * dir_table used for directory traversal during readdir 1N/A * Maximum entry in inline directory table 1N/A u8 slot;
/* 1: slot within leaf page of entry */ 1N/A u8 addr1;
/* 1: upper 8 bits of leaf page address */ 1N/A u32 addr2;
/* 4: lower 32 bits of leaf page address -OR- 1N/A index of next entry when this entry was deleted */ 1N/A * directory root page (in-line in on-disk inode): 1N/A * cf. dtpage_t below. 1N/A s8 stbl[
8];
/* 8: sorted entry index table */ 1N/A * directory regular page: 1N/A * entry slot array of 32 byte slot 1N/A * sorted entry slot index table (stbl): 1N/A * contiguous slots at slot specified by stblindex, 1N/A * 512 byte block: 16 entry tbl (1 slot) 1N/A * 1024 byte block: 32 entry tbl (1 slot) 1N/A * 2048 byte block: 64 entry tbl (2 slot) 1N/A * 4096 byte block: 128 entry tbl (4 slot) 1N/A * 512 byte block: 16 - 2 = 14 slot 1N/A * 1024 byte block: 32 - 2 = 30 slot 1N/A * 2048 byte block: 64 - 3 = 61 slot 1N/A * 4096 byte block: 128 - 5 = 123 slot 1N/A * N.B. index is 0-based; index fields refer to slot index 1N/A * except nextindex which refers to entry index in stbl; 1N/A * end of entry stot list or freelist is marked with -1. 1N/A * extent allocation descriptor (xad) 1N/A unsigned off1:
8;
/* 1: offset in unit of fsblksize */ 1N/A unsigned len:
24;
/* 3: length in unit of fsblksize */ 1N/A unsigned addr1:
8;
/* 1: address in unit of fsblksize */ 1N/A/* xad_t field extraction */ 1N/A/* possible values for maxentry */ 1N/A * I. base area (128 bytes) 1N/A * ------------------------ 1N/A * Historically, the inode was partitioned into 4 128-byte areas, 1N/A * the last 3 being defined as unions which could have multiple 1N/A * uses. The first 96 bytes had been completely unused until 1N/A * an index table was added to the directory. It is now more 1N/A * useful to describe the last 3/4 of the inode as a single 1N/A * union. We would probably be better off redesigning the 1N/A * entire structure from scratch, but we don't want to break 1N/A * commonality with OS/2's JFS at this time. 1N/A * This table contains the information needed to 1N/A * find a directory entry from a 32-bit index. 1N/A * If the index is small enough, the table is inline, 1N/A * otherwise, an x-tree root overlays this table 1N/A#
define IFMT 0xF000 /* S_IFMT - mask of file type */ 1N/A#
define IFDIR 0x4000 /* S_IFDIR - directory */ 1N/A#
define IFREG 0x8000 /* S_IFREG - regular file */ 1N/A#
define IFLNK 0xA000 /* S_IFLNK - symbolic link */ 1N/A/* extended mode bits (on-disk inode di_mode) */ 1N/A#
define SMAPSZ 4 /* number of words per summary map */ 1N/A#
define MAXAG 128 /* maximum number of allocation groups */ 1N/A * inode allocation map: 1N/A * inode allocation map consists of 1N/A * . the inode map control page and 1N/A * . inode allocation group pages (per 4096 inodes) 1N/A * which are addressed by standard JFS xtree. 1N/A * inode allocation group page (per 4096 inodes of an AG) 1N/A /* summary map: 1 bit per inode extent */ 1N/A * note: this indicates free and backed 1N/A * inodes, if the extent is not backed the 1N/A * value will be 1. if the extent is 1N/A * backed but all inodes are being used the 1N/A * value will be 1. if the extent is 1N/A * backed but at least one of the inodes is 1N/A * free the value will be 0. 1N/A u8 pad[
1976];
/* 1976: pad to 2048 bytes */ 1N/A /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */