1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright (C) 2001-2002 Will Dyson <will_dyson@pobox.com>
6 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
12 #include "befs_fs_types.h"
15 #define BEFS_VERSION "0.9.3"
18 typedef u64 befs_blocknr_t;
20 * BeFS in memory structures
23 struct befs_mount_options {
37 befs_off_t num_blocks;
38 befs_off_t used_blocks;
42 /* Allocation group information */
47 /* State of the superblock */
50 /* Journal log entry */
51 befs_block_run log_blocks;
55 befs_inode_addr root_dir;
56 befs_inode_addr indices;
59 struct befs_mount_options mount_opts;
60 struct nls_table *nls;
63 struct befs_inode_info {
67 befs_inode_addr i_inode_num;
68 befs_inode_addr i_parent;
69 befs_inode_addr i_attribute;
73 char symlink[BEFS_SYMLINK_LEN];
76 struct inode vfs_inode;
91 /****************************/
94 void befs_error(const struct super_block *sb, const char *fmt, ...);
96 void befs_warning(const struct super_block *sb, const char *fmt, ...);
98 void befs_debug(const struct super_block *sb, const char *fmt, ...);
100 void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
101 void befs_dump_inode(const struct super_block *sb, befs_inode *);
102 void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
103 void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
104 /****************************/
107 /* Gets a pointer to the private portion of the super_block
108 * structure from the public part
110 static inline struct befs_sb_info *
111 BEFS_SB(const struct super_block *super)
113 return (struct befs_sb_info *) super->s_fs_info;
116 static inline struct befs_inode_info *
117 BEFS_I(const struct inode *inode)
119 return container_of(inode, struct befs_inode_info, vfs_inode);
122 static inline befs_blocknr_t
123 iaddr2blockno(struct super_block *sb, const befs_inode_addr *iaddr)
125 return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
129 static inline befs_inode_addr
130 blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
132 befs_inode_addr iaddr;
134 iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
136 blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
142 static inline unsigned int
143 befs_iaddrs_per_block(struct super_block *sb)
145 return BEFS_SB(sb)->block_size / sizeof(befs_disk_inode_addr);
150 #endif /* _LINUX_BEFS_H */