1 /* 2 * This header was generated from the Linux kernel headers by update_headers.py, 3 * to provide necessary information from kernel to userspace, such as constants, 4 * structures, and macros, and thus, contains no copyrightable information. 5 */ 6 #ifndef _LINUX_BFS_FS_H 7 #define _LINUX_BFS_FS_H 8 #include <linux/types.h> 9 #define BFS_BSIZE_BITS 9 10 #define BFS_BSIZE (1<<BFS_BSIZE_BITS) 11 #define BFS_MAGIC 0x1BADFACE 12 #define BFS_ROOT_INO 2 13 #define BFS_INODES_PER_BLOCK 8 14 #define BFS_VDIR 2L 15 #define BFS_VREG 1L 16 struct bfs_inode { 17 __le16 i_ino; 18 __u16 i_unused; 19 __le32 i_sblock; 20 __le32 i_eblock; 21 __le32 i_eoffset; 22 __le32 i_vtype; 23 __le32 i_mode; 24 __le32 i_uid; 25 __le32 i_gid; 26 __le32 i_nlink; 27 __le32 i_atime; 28 __le32 i_mtime; 29 __le32 i_ctime; 30 __u32 i_padding[4]; 31 }; 32 #define BFS_NAMELEN 14 33 #define BFS_DIRENT_SIZE 16 34 #define BFS_DIRS_PER_BLOCK 32 35 struct bfs_dirent { 36 __le16 ino; 37 char name[BFS_NAMELEN]; 38 }; 39 struct bfs_super_block { 40 __le32 s_magic; 41 __le32 s_start; 42 __le32 s_end; 43 __le32 s_from; 44 __le32 s_to; 45 __s32 s_bfrom; 46 __s32 s_bto; 47 char s_fsname[6]; 48 char s_volume[6]; 49 __u32 s_padding[118]; 50 }; 51 #define BFS_OFF2INO(offset) \ 52 ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) 53 #define BFS_INO2OFF(ino) \ 54 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) 55 #define BFS_NZFILESIZE(ip) \ 56 ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) 57 #define BFS_FILESIZE(ip) \ 58 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) 59 #define BFS_FILEBLOCKS(ip) \ 60 ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) 61 #define BFS_UNCLEAN(bfs_sb, sb) \ 62 ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY)) 63 #endif 64