blob: e6a0b193bea4141567f4462574584c4064a72a26 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/fs.h>
2#include <linux/pagemap.h>
3#include <linux/minix_fs.h>
4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#define INODE_VERSION(inode) minix_sb(inode->i_sb)->s_version
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#define MINIX_V1 0x0001 /* original minix fs */
7#define MINIX_V2 0x0002 /* minix V2 fs */
Andries Brouwer939b00d2007-02-12 00:52:49 -08008#define MINIX_V3 0x0003 /* minix V3 fs */
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10/*
11 * minix fs inode data in memory
12 */
13struct minix_inode_info {
14 union {
15 __u16 i1_data[16];
16 __u32 i2_data[16];
17 } u;
18 struct inode vfs_inode;
19};
20
21/*
22 * minix super-block data in memory
23 */
24struct minix_sb_info {
25 unsigned long s_ninodes;
26 unsigned long s_nzones;
27 unsigned long s_imap_blocks;
28 unsigned long s_zmap_blocks;
29 unsigned long s_firstdatazone;
30 unsigned long s_log_zone_size;
31 unsigned long s_max_size;
32 int s_dirsize;
33 int s_namelen;
34 int s_link_max;
35 struct buffer_head ** s_imap;
36 struct buffer_head ** s_zmap;
37 struct buffer_head * s_sbh;
38 struct minix_super_block * s_ms;
39 unsigned short s_mount_state;
40 unsigned short s_version;
41};
42
David Howellsa90a08802008-02-07 00:15:44 -080043extern struct inode *minix_iget(struct super_block *, unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **);
45extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **);
46extern struct inode * minix_new_inode(const struct inode * dir, int * error);
47extern void minix_free_inode(struct inode * inode);
48extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi);
49extern int minix_new_block(struct inode * inode);
Andries Brouwer939b00d2007-02-12 00:52:49 -080050extern void minix_free_block(struct inode *inode, unsigned long block);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051extern unsigned long minix_count_free_blocks(struct minix_sb_info *sbi);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052extern int minix_getattr(struct vfsmount *, struct dentry *, struct kstat *);
Nick Piggin4a66af92007-10-16 01:25:21 -070053extern int __minix_write_begin(struct file *file, struct address_space *mapping,
54 loff_t pos, unsigned len, unsigned flags,
55 struct page **pagep, void **fsdata);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057extern void V1_minix_truncate(struct inode *);
58extern void V2_minix_truncate(struct inode *);
59extern void minix_truncate(struct inode *);
60extern int minix_sync_inode(struct inode *);
61extern void minix_set_inode(struct inode *, dev_t);
62extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int);
63extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
Andries Brouwer939b00d2007-02-12 00:52:49 -080064extern unsigned V1_minix_blocks(loff_t, struct super_block *);
65extern unsigned V2_minix_blocks(loff_t, struct super_block *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**);
68extern int minix_add_link(struct dentry*, struct inode*);
69extern int minix_delete_entry(struct minix_dir_entry*, struct page*);
70extern int minix_make_empty(struct inode*, struct inode*);
71extern int minix_empty_dir(struct inode*);
72extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*);
73extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**);
74extern ino_t minix_inode_by_name(struct dentry*);
Linus Torvalds1da177e2005-04-16 15:20:36 -070075extern int minix_sync_file(struct file *, struct dentry *, int);
76
Arjan van de Ven92e1d5b2007-02-12 00:55:39 -080077extern const struct inode_operations minix_file_inode_operations;
78extern const struct inode_operations minix_dir_inode_operations;
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -080079extern const struct file_operations minix_file_operations;
80extern const struct file_operations minix_dir_operations;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82static inline struct minix_sb_info *minix_sb(struct super_block *sb)
83{
84 return sb->s_fs_info;
85}
86
87static inline struct minix_inode_info *minix_i(struct inode *inode)
88{
89 return list_entry(inode, struct minix_inode_info, vfs_inode);
90}