blob: f46508f325713a0636d4f6301bb9ae14d5002b75 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _LINUX_BFS_FS_H
8#define _LINUX_BFS_FS_H
9#include <linux/types.h>
10#define BFS_BSIZE_BITS 9
Tao Baod7db5942015-01-28 10:07:51 -080011#define BFS_BSIZE (1 << BFS_BSIZE_BITS)
Ben Cheng655a7c02013-10-16 16:09:24 -070012#define BFS_MAGIC 0x1BADFACE
13#define BFS_ROOT_INO 2
14#define BFS_INODES_PER_BLOCK 8
Ben Cheng655a7c02013-10-16 16:09:24 -070015#define BFS_VDIR 2L
16#define BFS_VREG 1L
17struct bfs_inode {
Tao Baod7db5942015-01-28 10:07:51 -080018 __le16 i_ino;
Tao Baod7db5942015-01-28 10:07:51 -080019 __u16 i_unused;
20 __le32 i_sblock;
21 __le32 i_eblock;
22 __le32 i_eoffset;
Tao Baod7db5942015-01-28 10:07:51 -080023 __le32 i_vtype;
24 __le32 i_mode;
25 __le32 i_uid;
26 __le32 i_gid;
Tao Baod7db5942015-01-28 10:07:51 -080027 __le32 i_nlink;
28 __le32 i_atime;
29 __le32 i_mtime;
30 __le32 i_ctime;
Tao Baod7db5942015-01-28 10:07:51 -080031 __u32 i_padding[4];
Ben Cheng655a7c02013-10-16 16:09:24 -070032};
33#define BFS_NAMELEN 14
34#define BFS_DIRENT_SIZE 16
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define BFS_DIRS_PER_BLOCK 32
36struct bfs_dirent {
Tao Baod7db5942015-01-28 10:07:51 -080037 __le16 ino;
38 char name[BFS_NAMELEN];
Ben Cheng655a7c02013-10-16 16:09:24 -070039};
40struct bfs_super_block {
Tao Baod7db5942015-01-28 10:07:51 -080041 __le32 s_magic;
42 __le32 s_start;
Tao Baod7db5942015-01-28 10:07:51 -080043 __le32 s_end;
44 __le32 s_from;
45 __le32 s_to;
46 __s32 s_bfrom;
Tao Baod7db5942015-01-28 10:07:51 -080047 __s32 s_bto;
48 char s_fsname[6];
49 char s_volume[6];
50 __u32 s_padding[118];
Ben Cheng655a7c02013-10-16 16:09:24 -070051};
Tao Baod7db5942015-01-28 10:07:51 -080052#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 Baod7db5942015-01-28 10:07:51 -080055#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 Ferris934ec942018-01-31 15:29:16 -080057#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 Cheng655a7c02013-10-16 16:09:24 -070058#endif