blob: 4a11e8aa0c1061e708e39b9f396b84055a774cff [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
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
Tao Baod7db5942015-01-28 10:07:51 -080023#define BFS_BSIZE (1 << BFS_BSIZE_BITS)
Ben Cheng655a7c02013-10-16 16:09:24 -070024#define BFS_MAGIC 0x1BADFACE
25#define BFS_ROOT_INO 2
26#define BFS_INODES_PER_BLOCK 8
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define BFS_VDIR 2L
28#define BFS_VREG 1L
29struct bfs_inode {
Tao Baod7db5942015-01-28 10:07:51 -080030 __le16 i_ino;
Tao Baod7db5942015-01-28 10:07:51 -080031 __u16 i_unused;
32 __le32 i_sblock;
33 __le32 i_eblock;
34 __le32 i_eoffset;
Tao Baod7db5942015-01-28 10:07:51 -080035 __le32 i_vtype;
36 __le32 i_mode;
37 __le32 i_uid;
38 __le32 i_gid;
Tao Baod7db5942015-01-28 10:07:51 -080039 __le32 i_nlink;
40 __le32 i_atime;
41 __le32 i_mtime;
42 __le32 i_ctime;
Tao Baod7db5942015-01-28 10:07:51 -080043 __u32 i_padding[4];
Ben Cheng655a7c02013-10-16 16:09:24 -070044};
45#define BFS_NAMELEN 14
46#define BFS_DIRENT_SIZE 16
Ben Cheng655a7c02013-10-16 16:09:24 -070047#define BFS_DIRS_PER_BLOCK 32
48struct bfs_dirent {
Tao Baod7db5942015-01-28 10:07:51 -080049 __le16 ino;
50 char name[BFS_NAMELEN];
Ben Cheng655a7c02013-10-16 16:09:24 -070051};
52struct bfs_super_block {
Tao Baod7db5942015-01-28 10:07:51 -080053 __le32 s_magic;
54 __le32 s_start;
Tao Baod7db5942015-01-28 10:07:51 -080055 __le32 s_end;
56 __le32 s_from;
57 __le32 s_to;
58 __s32 s_bfrom;
Tao Baod7db5942015-01-28 10:07:51 -080059 __s32 s_bto;
60 char s_fsname[6];
61 char s_volume[6];
62 __u32 s_padding[118];
Ben Cheng655a7c02013-10-16 16:09:24 -070063};
Tao Baod7db5942015-01-28 10:07:51 -080064#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)
Tao Baod7db5942015-01-28 10:07:51 -080067#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))
Christopher Ferris934ec942018-01-31 15:29:16 -080069#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 -070070#endif