1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_BFS_FS_H
20 #define _LINUX_BFS_FS_H
21 #include <linux/types.h>
22 #define BFS_BSIZE_BITS 9
23 #define BFS_BSIZE (1 << BFS_BSIZE_BITS)
24 #define BFS_MAGIC 0x1BADFACE
25 #define BFS_ROOT_INO 2
26 #define BFS_INODES_PER_BLOCK 8
27 #define BFS_VDIR 2L
28 #define BFS_VREG 1L
29 struct bfs_inode {
30   __le16 i_ino;
31   __u16 i_unused;
32   __le32 i_sblock;
33   __le32 i_eblock;
34   __le32 i_eoffset;
35   __le32 i_vtype;
36   __le32 i_mode;
37   __le32 i_uid;
38   __le32 i_gid;
39   __le32 i_nlink;
40   __le32 i_atime;
41   __le32 i_mtime;
42   __le32 i_ctime;
43   __u32 i_padding[4];
44 };
45 #define BFS_NAMELEN 14
46 #define BFS_DIRENT_SIZE 16
47 #define BFS_DIRS_PER_BLOCK 32
48 struct bfs_dirent {
49   __le16 ino;
50   char name[BFS_NAMELEN];
51 };
52 struct bfs_super_block {
53   __le32 s_magic;
54   __le32 s_start;
55   __le32 s_end;
56   __le32 s_from;
57   __le32 s_to;
58   __s32 s_bfrom;
59   __s32 s_bto;
60   char s_fsname[6];
61   char s_volume[6];
62   __u32 s_padding[118];
63 };
64 #define BFS_OFF2INO(offset) ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
65 #define BFS_INO2OFF(ino) ((__u32) (((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
66 #define BFS_NZFILESIZE(ip) ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
67 #define BFS_FILESIZE(ip) ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
68 #define BFS_FILEBLOCKS(ip) ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
69 #define BFS_UNCLEAN(bfs_sb,sb) ((le32_to_cpu(bfs_sb->s_from) != - 1) && (le32_to_cpu(bfs_sb->s_to) != - 1) && ! (sb->s_flags & SB_RDONLY))
70 #endif
71