Linux Audio

Check our new training course

Loading...
v4.10.11
 
  1/*
  2 * befs.h
  3 *
  4 * Copyright (C) 2001-2002 Will Dyson <will_dyson@pobox.com>
  5 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
  6 */
  7
  8#ifndef _LINUX_BEFS_H
  9#define _LINUX_BEFS_H
 10
 11#include "befs_fs_types.h"
 12
 13/* used in debug.c */
 14#define BEFS_VERSION "0.9.3"
 15
 16
 17typedef u64 befs_blocknr_t;
 18/*
 19 * BeFS in memory structures
 20 */
 21
 22struct befs_mount_options {
 23	kgid_t gid;
 24	kuid_t uid;
 25	int use_gid;
 26	int use_uid;
 27	int debug;
 28	char *iocharset;
 29};
 30
 31struct befs_sb_info {
 32	u32 magic1;
 33	u32 block_size;
 34	u32 block_shift;
 35	int byte_order;
 36	befs_off_t num_blocks;
 37	befs_off_t used_blocks;
 38	u32 inode_size;
 39	u32 magic2;
 40
 41	/* Allocation group information */
 42	u32 blocks_per_ag;
 43	u32 ag_shift;
 44	u32 num_ags;
 45
 46	/* State of the superblock */
 47	u32 flags;
 48
 49	/* Journal log entry */
 50	befs_block_run log_blocks;
 51	befs_off_t log_start;
 52	befs_off_t log_end;
 53
 54	befs_inode_addr root_dir;
 55	befs_inode_addr indices;
 56	u32 magic3;
 57
 58	struct befs_mount_options mount_opts;
 59	struct nls_table *nls;
 60};
 61
 62struct befs_inode_info {
 63	u32 i_flags;
 64	u32 i_type;
 65
 66	befs_inode_addr i_inode_num;
 67	befs_inode_addr i_parent;
 68	befs_inode_addr i_attribute;
 69
 70	union {
 71		befs_data_stream ds;
 72		char symlink[BEFS_SYMLINK_LEN];
 73	} i_data;
 74
 75	struct inode vfs_inode;
 76};
 77
 78enum befs_err {
 79	BEFS_OK,
 80	BEFS_ERR,
 81	BEFS_BAD_INODE,
 82	BEFS_BT_END,
 83	BEFS_BT_EMPTY,
 84	BEFS_BT_MATCH,
 85	BEFS_BT_OVERFLOW,
 86	BEFS_BT_NOT_FOUND
 87};
 88
 89
 90/****************************/
 91/* debug.c */
 92__printf(2, 3)
 93void befs_error(const struct super_block *sb, const char *fmt, ...);
 94__printf(2, 3)
 95void befs_warning(const struct super_block *sb, const char *fmt, ...);
 96__printf(2, 3)
 97void befs_debug(const struct super_block *sb, const char *fmt, ...);
 98
 99void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
100void befs_dump_inode(const struct super_block *sb, befs_inode *);
101void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
102void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
103/****************************/
104
105
106/* Gets a pointer to the private portion of the super_block
107 * structure from the public part
108 */
109static inline struct befs_sb_info *
110BEFS_SB(const struct super_block *super)
111{
112	return (struct befs_sb_info *) super->s_fs_info;
113}
114
115static inline struct befs_inode_info *
116BEFS_I(const struct inode *inode)
117{
118	return container_of(inode, struct befs_inode_info, vfs_inode);
119}
120
121static inline befs_blocknr_t
122iaddr2blockno(struct super_block *sb, const befs_inode_addr *iaddr)
123{
124	return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
125		iaddr->start);
126}
127
128static inline befs_inode_addr
129blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
130{
131	befs_inode_addr iaddr;
132
133	iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
134	iaddr.start =
135	    blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
136	iaddr.len = 1;
137
138	return iaddr;
139}
140
141static inline unsigned int
142befs_iaddrs_per_block(struct super_block *sb)
143{
144	return BEFS_SB(sb)->block_size / sizeof(befs_disk_inode_addr);
145}
146
147#include "endian.h"
148
149#endif				/* _LINUX_BEFS_H */
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * befs.h
  4 *
  5 * Copyright (C) 2001-2002 Will Dyson <will_dyson@pobox.com>
  6 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
  7 */
  8
  9#ifndef _LINUX_BEFS_H
 10#define _LINUX_BEFS_H
 11
 12#include "befs_fs_types.h"
 13
 14/* used in debug.c */
 15#define BEFS_VERSION "0.9.3"
 16
 17
 18typedef u64 befs_blocknr_t;
 19/*
 20 * BeFS in memory structures
 21 */
 22
 23struct befs_mount_options {
 24	kgid_t gid;
 25	kuid_t uid;
 26	int use_gid;
 27	int use_uid;
 28	int debug;
 29	char *iocharset;
 30};
 31
 32struct befs_sb_info {
 33	u32 magic1;
 34	u32 block_size;
 35	u32 block_shift;
 36	int byte_order;
 37	befs_off_t num_blocks;
 38	befs_off_t used_blocks;
 39	u32 inode_size;
 40	u32 magic2;
 41
 42	/* Allocation group information */
 43	u32 blocks_per_ag;
 44	u32 ag_shift;
 45	u32 num_ags;
 46
 47	/* State of the superblock */
 48	u32 flags;
 49
 50	/* Journal log entry */
 51	befs_block_run log_blocks;
 52	befs_off_t log_start;
 53	befs_off_t log_end;
 54
 55	befs_inode_addr root_dir;
 56	befs_inode_addr indices;
 57	u32 magic3;
 58
 59	struct befs_mount_options mount_opts;
 60	struct nls_table *nls;
 61};
 62
 63struct befs_inode_info {
 64	u32 i_flags;
 65	u32 i_type;
 66
 67	befs_inode_addr i_inode_num;
 68	befs_inode_addr i_parent;
 69	befs_inode_addr i_attribute;
 70
 71	union {
 72		befs_data_stream ds;
 73		char symlink[BEFS_SYMLINK_LEN];
 74	} i_data;
 75
 76	struct inode vfs_inode;
 77};
 78
 79enum befs_err {
 80	BEFS_OK,
 81	BEFS_ERR,
 82	BEFS_BAD_INODE,
 83	BEFS_BT_END,
 84	BEFS_BT_EMPTY,
 85	BEFS_BT_MATCH,
 86	BEFS_BT_OVERFLOW,
 87	BEFS_BT_NOT_FOUND
 88};
 89
 90
 91/****************************/
 92/* debug.c */
 93__printf(2, 3)
 94void befs_error(const struct super_block *sb, const char *fmt, ...);
 95__printf(2, 3)
 96void befs_warning(const struct super_block *sb, const char *fmt, ...);
 97__printf(2, 3)
 98void befs_debug(const struct super_block *sb, const char *fmt, ...);
 99
100void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
101void befs_dump_inode(const struct super_block *sb, befs_inode *);
102void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
103void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
104/****************************/
105
106
107/* Gets a pointer to the private portion of the super_block
108 * structure from the public part
109 */
110static inline struct befs_sb_info *
111BEFS_SB(const struct super_block *super)
112{
113	return (struct befs_sb_info *) super->s_fs_info;
114}
115
116static inline struct befs_inode_info *
117BEFS_I(const struct inode *inode)
118{
119	return container_of(inode, struct befs_inode_info, vfs_inode);
120}
121
122static inline befs_blocknr_t
123iaddr2blockno(struct super_block *sb, const befs_inode_addr *iaddr)
124{
125	return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
126		iaddr->start);
127}
128
129static inline befs_inode_addr
130blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
131{
132	befs_inode_addr iaddr;
133
134	iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
135	iaddr.start =
136	    blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
137	iaddr.len = 1;
138
139	return iaddr;
140}
141
142static inline unsigned int
143befs_iaddrs_per_block(struct super_block *sb)
144{
145	return BEFS_SB(sb)->block_size / sizeof(befs_disk_inode_addr);
146}
147
148#include "endian.h"
149
150#endif				/* _LINUX_BEFS_H */