Hitoshi Mitake | e38be99 | 2009-06-22 11:11:20 +0900 | [diff] [blame] | 1 | #ifndef FS_MINIX_H |
| 2 | #define FS_MINIX_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <linux/fs.h> |
| 5 | #include <linux/pagemap.h> |
| 6 | #include <linux/minix_fs.h> |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #define INODE_VERSION(inode) minix_sb(inode->i_sb)->s_version |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #define MINIX_V1 0x0001 /* original minix fs */ |
| 10 | #define MINIX_V2 0x0002 /* minix V2 fs */ |
Andries Brouwer | 939b00d | 2007-02-12 00:52:49 -0800 | [diff] [blame] | 11 | #define MINIX_V3 0x0003 /* minix V3 fs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | /* |
| 14 | * minix fs inode data in memory |
| 15 | */ |
| 16 | struct minix_inode_info { |
| 17 | union { |
| 18 | __u16 i1_data[16]; |
| 19 | __u32 i2_data[16]; |
| 20 | } u; |
| 21 | struct inode vfs_inode; |
| 22 | }; |
| 23 | |
| 24 | /* |
| 25 | * minix super-block data in memory |
| 26 | */ |
| 27 | struct minix_sb_info { |
| 28 | unsigned long s_ninodes; |
| 29 | unsigned long s_nzones; |
| 30 | unsigned long s_imap_blocks; |
| 31 | unsigned long s_zmap_blocks; |
| 32 | unsigned long s_firstdatazone; |
| 33 | unsigned long s_log_zone_size; |
| 34 | unsigned long s_max_size; |
| 35 | int s_dirsize; |
| 36 | int s_namelen; |
| 37 | int s_link_max; |
| 38 | struct buffer_head ** s_imap; |
| 39 | struct buffer_head ** s_zmap; |
| 40 | struct buffer_head * s_sbh; |
| 41 | struct minix_super_block * s_ms; |
| 42 | unsigned short s_mount_state; |
| 43 | unsigned short s_version; |
| 44 | }; |
| 45 | |
David Howells | a90a0880 | 2008-02-07 00:15:44 -0800 | [diff] [blame] | 46 | extern struct inode *minix_iget(struct super_block *, unsigned long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); |
| 48 | extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); |
Dmitry Monakhov | 9eed1fb | 2010-03-04 17:32:14 +0300 | [diff] [blame] | 49 | extern struct inode * minix_new_inode(const struct inode *, int, int *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | extern void minix_free_inode(struct inode * inode); |
| 51 | extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi); |
| 52 | extern int minix_new_block(struct inode * inode); |
Andries Brouwer | 939b00d | 2007-02-12 00:52:49 -0800 | [diff] [blame] | 53 | extern void minix_free_block(struct inode *inode, unsigned long block); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | extern unsigned long minix_count_free_blocks(struct minix_sb_info *sbi); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | extern int minix_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
Christoph Hellwig | f4e420d | 2010-06-04 11:29:56 +0200 | [diff] [blame] | 56 | extern int minix_prepare_chunk(struct page *page, loff_t pos, unsigned len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | extern void V1_minix_truncate(struct inode *); |
| 59 | extern void V2_minix_truncate(struct inode *); |
| 60 | extern void minix_truncate(struct inode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | extern void minix_set_inode(struct inode *, dev_t); |
| 62 | extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int); |
| 63 | extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int); |
Andries Brouwer | 939b00d | 2007-02-12 00:52:49 -0800 | [diff] [blame] | 64 | extern unsigned V1_minix_blocks(loff_t, struct super_block *); |
| 65 | extern unsigned V2_minix_blocks(loff_t, struct super_block *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**); |
| 68 | extern int minix_add_link(struct dentry*, struct inode*); |
| 69 | extern int minix_delete_entry(struct minix_dir_entry*, struct page*); |
| 70 | extern int minix_make_empty(struct inode*, struct inode*); |
| 71 | extern int minix_empty_dir(struct inode*); |
| 72 | extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*); |
| 73 | extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); |
| 74 | extern ino_t minix_inode_by_name(struct dentry*); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Arjan van de Ven | 92e1d5b | 2007-02-12 00:55:39 -0800 | [diff] [blame] | 76 | extern const struct inode_operations minix_file_inode_operations; |
| 77 | extern const struct inode_operations minix_dir_inode_operations; |
Arjan van de Ven | 4b6f5d2 | 2006-03-28 01:56:42 -0800 | [diff] [blame] | 78 | extern const struct file_operations minix_file_operations; |
| 79 | extern const struct file_operations minix_dir_operations; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | static inline struct minix_sb_info *minix_sb(struct super_block *sb) |
| 82 | { |
| 83 | return sb->s_fs_info; |
| 84 | } |
| 85 | |
| 86 | static inline struct minix_inode_info *minix_i(struct inode *inode) |
| 87 | { |
| 88 | return list_entry(inode, struct minix_inode_info, vfs_inode); |
| 89 | } |
Hitoshi Mitake | e38be99 | 2009-06-22 11:11:20 +0900 | [diff] [blame] | 90 | |
| 91 | #endif /* FS_MINIX_H */ |