0001
0002
0003
0004
0005
0006
0007 #ifndef _LINUX_BFS_FS_H
0008 #define _LINUX_BFS_FS_H
0009
0010 #include <linux/types.h>
0011
0012 #define BFS_BSIZE_BITS 9
0013 #define BFS_BSIZE (1<<BFS_BSIZE_BITS)
0014
0015 #define BFS_MAGIC 0x1BADFACE
0016 #define BFS_ROOT_INO 2
0017 #define BFS_INODES_PER_BLOCK 8
0018
0019
0020 #define BFS_VDIR 2L
0021 #define BFS_VREG 1L
0022
0023
0024 struct bfs_inode {
0025 __le16 i_ino;
0026 __u16 i_unused;
0027 __le32 i_sblock;
0028 __le32 i_eblock;
0029 __le32 i_eoffset;
0030 __le32 i_vtype;
0031 __le32 i_mode;
0032 __le32 i_uid;
0033 __le32 i_gid;
0034 __le32 i_nlink;
0035 __le32 i_atime;
0036 __le32 i_mtime;
0037 __le32 i_ctime;
0038 __u32 i_padding[4];
0039 };
0040
0041 #define BFS_NAMELEN 14
0042 #define BFS_DIRENT_SIZE 16
0043 #define BFS_DIRS_PER_BLOCK 32
0044
0045 struct bfs_dirent {
0046 __le16 ino;
0047 char name[BFS_NAMELEN];
0048 };
0049
0050
0051 struct bfs_super_block {
0052 __le32 s_magic;
0053 __le32 s_start;
0054 __le32 s_end;
0055 __le32 s_from;
0056 __le32 s_to;
0057 __s32 s_bfrom;
0058 __s32 s_bto;
0059 char s_fsname[6];
0060 char s_volume[6];
0061 __u32 s_padding[118];
0062 };
0063
0064
0065 #define BFS_OFF2INO(offset) \
0066 ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
0067
0068 #define BFS_INO2OFF(ino) \
0069 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
0070 #define BFS_NZFILESIZE(ip) \
0071 ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
0072
0073 #define BFS_FILESIZE(ip) \
0074 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
0075
0076 #define BFS_FILEBLOCKS(ip) \
0077 ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
0078 #define BFS_UNCLEAN(bfs_sb, sb) \
0079 ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY))
0080
0081
0082 #endif