Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  fs/bfs/bfs.h
0004  *  Copyright (C) 1999-2018 Tigran Aivazian <aivazian.tigran@gmail.com>
0005  */
0006 #ifndef _FS_BFS_BFS_H
0007 #define _FS_BFS_BFS_H
0008 
0009 #include <linux/bfs_fs.h>
0010 
0011 /* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up to 513 inclusive.
0012    In actual fact, attempting to create the 512th inode (i.e. inode No. 513 or file No. 511)
0013    will fail with ENOSPC in bfs_add_entry(): the root directory cannot contain so many entries, counting '..'.
0014    So, mkfs.bfs(8) should really limit its -N option to 511 and not 512. For now, we just print a warning
0015    if a filesystem is mounted with such "impossible to fill up" number of inodes */
0016 #define BFS_MAX_LASTI   513
0017 
0018 /*
0019  * BFS file system in-core superblock info
0020  */
0021 struct bfs_sb_info {
0022     unsigned long si_blocks;
0023     unsigned long si_freeb;
0024     unsigned long si_freei;
0025     unsigned long si_lf_eblk;
0026     unsigned long si_lasti;
0027     DECLARE_BITMAP(si_imap, BFS_MAX_LASTI+1);
0028     struct mutex bfs_lock;
0029 };
0030 
0031 /*
0032  * BFS file system in-core inode info
0033  */
0034 struct bfs_inode_info {
0035     unsigned long i_dsk_ino; /* inode number from the disk, can be 0 */
0036     unsigned long i_sblock;
0037     unsigned long i_eblock;
0038     struct inode vfs_inode;
0039 };
0040 
0041 static inline struct bfs_sb_info *BFS_SB(struct super_block *sb)
0042 {
0043     return sb->s_fs_info;
0044 }
0045 
0046 static inline struct bfs_inode_info *BFS_I(struct inode *inode)
0047 {
0048     return container_of(inode, struct bfs_inode_info, vfs_inode);
0049 }
0050 
0051 
0052 #define printf(format, args...) \
0053     printk(KERN_ERR "BFS-fs: %s(): " format, __func__, ## args)
0054 
0055 /* inode.c */
0056 extern struct inode *bfs_iget(struct super_block *sb, unsigned long ino);
0057 extern void bfs_dump_imap(const char *, struct super_block *);
0058 
0059 /* file.c */
0060 extern const struct inode_operations bfs_file_inops;
0061 extern const struct file_operations bfs_file_operations;
0062 extern const struct address_space_operations bfs_aops;
0063 
0064 /* dir.c */
0065 extern const struct inode_operations bfs_dir_inops;
0066 extern const struct file_operations bfs_dir_operations;
0067 
0068 #endif /* _FS_BFS_BFS_H */