1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * include/linux/bfs_fs.h - BFS data structures on disk.
4 * Copyright (C) 1999-2018 Tigran Aivazian <aivazian.tigran@gmail.com>
7 #ifndef _LINUX_BFS_FS_H
8 #define _LINUX_BFS_FS_H
10 #include <linux/types.h>
12 #define BFS_BSIZE_BITS 9
13 #define BFS_BSIZE (1<<BFS_BSIZE_BITS)
15 #define BFS_MAGIC 0x1BADFACE
16 #define BFS_ROOT_INO 2
17 #define BFS_INODES_PER_BLOCK 8
19 /* SVR4 vnode type values (bfs_inode->i_vtype) */
23 /* BFS inode layout on disk */
41 #define BFS_NAMELEN 14
42 #define BFS_DIRENT_SIZE 16
43 #define BFS_DIRS_PER_BLOCK 32
47 char name[BFS_NAMELEN];
50 /* BFS superblock layout on disk */
51 struct bfs_super_block {
65 #define BFS_OFF2INO(offset) \
66 ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
68 #define BFS_INO2OFF(ino) \
69 ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
70 #define BFS_NZFILESIZE(ip) \
71 ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
73 #define BFS_FILESIZE(ip) \
74 ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
76 #define BFS_FILEBLOCKS(ip) \
77 ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
78 #define BFS_UNCLEAN(bfs_sb, sb) \
79 ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY))
82 #endif /* _LINUX_BFS_FS_H */