Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef _LINUX_BFS_FS_H |
| 8 | #define _LINUX_BFS_FS_H |
| 9 | #include <linux/types.h> |
| 10 | #define BFS_BSIZE_BITS 9 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 11 | #define BFS_BSIZE (1 << BFS_BSIZE_BITS) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 12 | #define BFS_MAGIC 0x1BADFACE |
| 13 | #define BFS_ROOT_INO 2 |
| 14 | #define BFS_INODES_PER_BLOCK 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 15 | #define BFS_VDIR 2L |
| 16 | #define BFS_VREG 1L |
| 17 | struct bfs_inode { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 18 | __le16 i_ino; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 19 | __u16 i_unused; |
| 20 | __le32 i_sblock; |
| 21 | __le32 i_eblock; |
| 22 | __le32 i_eoffset; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | __le32 i_vtype; |
| 24 | __le32 i_mode; |
| 25 | __le32 i_uid; |
| 26 | __le32 i_gid; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 27 | __le32 i_nlink; |
| 28 | __le32 i_atime; |
| 29 | __le32 i_mtime; |
| 30 | __le32 i_ctime; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 | __u32 i_padding[4]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 32 | }; |
| 33 | #define BFS_NAMELEN 14 |
| 34 | #define BFS_DIRENT_SIZE 16 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 35 | #define BFS_DIRS_PER_BLOCK 32 |
| 36 | struct bfs_dirent { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 37 | __le16 ino; |
| 38 | char name[BFS_NAMELEN]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | }; |
| 40 | struct bfs_super_block { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 41 | __le32 s_magic; |
| 42 | __le32 s_start; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 | __le32 s_end; |
| 44 | __le32 s_from; |
| 45 | __le32 s_to; |
| 46 | __s32 s_bfrom; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 47 | __s32 s_bto; |
| 48 | char s_fsname[6]; |
| 49 | char s_volume[6]; |
| 50 | __u32 s_padding[118]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 51 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 52 | #define BFS_OFF2INO(offset) ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) |
| 53 | #define BFS_INO2OFF(ino) ((__u32) (((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) |
| 54 | #define BFS_NZFILESIZE(ip) ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | #define BFS_FILESIZE(ip) ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) |
| 56 | #define BFS_FILEBLOCKS(ip) ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 57 | #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)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 58 | #endif |