Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/bfs_fs.h - BFS data structures on disk. |
| 3 | * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> |
| 4 | */ |
| 5 | |
| 6 | #ifndef _LINUX_BFS_FS_H |
| 7 | #define _LINUX_BFS_FS_H |
| 8 | |
| 9 | #define BFS_BSIZE_BITS 9 |
| 10 | #define BFS_BSIZE (1<<BFS_BSIZE_BITS) |
| 11 | |
| 12 | #define BFS_MAGIC 0x1BADFACE |
| 13 | #define BFS_ROOT_INO 2 |
| 14 | #define BFS_INODES_PER_BLOCK 8 |
| 15 | |
| 16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ |
Andrew Stribblehill | fac92be | 2005-09-09 13:02:04 -0700 | [diff] [blame] | 17 | #define BFS_VDIR 2L |
| 18 | #define BFS_VREG 1L |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | /* BFS inode layout on disk */ |
| 22 | struct bfs_inode { |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 23 | __le16 i_ino; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | __u16 i_unused; |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 25 | __le32 i_sblock; |
| 26 | __le32 i_eblock; |
| 27 | __le32 i_eoffset; |
| 28 | __le32 i_vtype; |
| 29 | __le32 i_mode; |
| 30 | __le32 i_uid; |
| 31 | __le32 i_gid; |
| 32 | __le32 i_nlink; |
| 33 | __le32 i_atime; |
| 34 | __le32 i_mtime; |
| 35 | __le32 i_ctime; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | __u32 i_padding[4]; |
| 37 | }; |
| 38 | |
| 39 | #define BFS_NAMELEN 14 |
| 40 | #define BFS_DIRENT_SIZE 16 |
| 41 | #define BFS_DIRS_PER_BLOCK 32 |
| 42 | |
| 43 | struct bfs_dirent { |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 44 | __le16 ino; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | char name[BFS_NAMELEN]; |
| 46 | }; |
| 47 | |
| 48 | /* BFS superblock layout on disk */ |
| 49 | struct bfs_super_block { |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 50 | __le32 s_magic; |
| 51 | __le32 s_start; |
| 52 | __le32 s_end; |
| 53 | __le32 s_from; |
| 54 | __le32 s_to; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | __s32 s_bfrom; |
| 56 | __s32 s_bto; |
| 57 | char s_fsname[6]; |
| 58 | char s_volume[6]; |
| 59 | __u32 s_padding[118]; |
| 60 | }; |
| 61 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | #define BFS_OFF2INO(offset) \ |
| 64 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) |
| 65 | |
| 66 | #define BFS_INO2OFF(ino) \ |
| 67 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) |
Andrew Stribblehill | fac92be | 2005-09-09 13:02:04 -0700 | [diff] [blame] | 68 | #define BFS_NZFILESIZE(ip) \ |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 69 | ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Andrew Stribblehill | fac92be | 2005-09-09 13:02:04 -0700 | [diff] [blame] | 71 | #define BFS_FILESIZE(ip) \ |
| 72 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) |
| 73 | |
| 74 | #define BFS_FILEBLOCKS(ip) \ |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 75 | ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | #define BFS_UNCLEAN(bfs_sb, sb) \ |
Alexey Dobriyan | ce0fe7e | 2005-10-04 17:43:06 +0100 | [diff] [blame] | 77 | ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) |
Andrew Stribblehill | fac92be | 2005-09-09 13:02:04 -0700 | [diff] [blame] | 78 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
| 80 | #endif /* _LINUX_BFS_FS_H */ |