blob: 73ef84f8fb0bb7fff4583b9a96c6b0a81dcee0cb [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
5/*
6 * change the define below to 0 if you want names > info->s_namelen chars to be
7 * truncated. Else they will be disallowed (ENAMETOOLONG).
8 */
9#define NO_TRUNCATE 1
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#define INODE_VERSION(inode) minix_sb(inode->i_sb)->s_version
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#define MINIX_V1 0x0001 /* original minix fs */
12#define MINIX_V2 0x0002 /* minix V2 fs */
Andries Brouwer939b00d2007-02-12 00:52:49 -080013#define MINIX_V3 0x0003 /* minix V3 fs */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15/*
16 * minix fs inode data in memory
17 */
18struct minix_inode_info {
19 union {
20 __u16 i1_data[16];
21 __u32 i2_data[16];
22 } u;
23 struct inode vfs_inode;
24};
25
26/*
27 * minix super-block data in memory
28 */
29struct minix_sb_info {
30 unsigned long s_ninodes;
31 unsigned long s_nzones;
32 unsigned long s_imap_blocks;
33 unsigned long s_zmap_blocks;
34 unsigned long s_firstdatazone;
35 unsigned long s_log_zone_size;
36 unsigned long s_max_size;
37 int s_dirsize;
38 int s_namelen;
39 int s_link_max;
40 struct buffer_head ** s_imap;
41 struct buffer_head ** s_zmap;
42 struct buffer_head * s_sbh;
43 struct minix_super_block * s_ms;
44 unsigned short s_mount_state;
45 unsigned short s_version;
46};
47
48extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **);
49extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **);
50extern struct inode * minix_new_inode(const struct inode * dir, int * error);
51extern void minix_free_inode(struct inode * inode);
52extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi);
53extern int minix_new_block(struct inode * inode);
Andries Brouwer939b00d2007-02-12 00:52:49 -080054extern void minix_free_block(struct inode *inode, unsigned long block);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055extern unsigned long minix_count_free_blocks(struct minix_sb_info *sbi);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056extern int minix_getattr(struct vfsmount *, struct dentry *, struct kstat *);
57
Linus Torvalds1da177e2005-04-16 15:20:36 -070058extern void V1_minix_truncate(struct inode *);
59extern void V2_minix_truncate(struct inode *);
60extern void minix_truncate(struct inode *);
61extern int minix_sync_inode(struct inode *);
62extern void minix_set_inode(struct inode *, dev_t);
63extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int);
64extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
Andries Brouwer939b00d2007-02-12 00:52:49 -080065extern unsigned V1_minix_blocks(loff_t, struct super_block *);
66extern unsigned V2_minix_blocks(loff_t, struct super_block *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**);
69extern int minix_add_link(struct dentry*, struct inode*);
70extern int minix_delete_entry(struct minix_dir_entry*, struct page*);
71extern int minix_make_empty(struct inode*, struct inode*);
72extern int minix_empty_dir(struct inode*);
73extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*);
74extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**);
75extern ino_t minix_inode_by_name(struct dentry*);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076extern int minix_sync_file(struct file *, struct dentry *, int);
77
Arjan van de Ven92e1d5b2007-02-12 00:55:39 -080078extern const struct inode_operations minix_file_inode_operations;
79extern const struct inode_operations minix_dir_inode_operations;
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -080080extern const struct file_operations minix_file_operations;
81extern const struct file_operations minix_dir_operations;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082extern struct dentry_operations minix_dentry_operations;
83
84static inline struct minix_sb_info *minix_sb(struct super_block *sb)
85{
86 return sb->s_fs_info;
87}
88
89static inline struct minix_inode_info *minix_i(struct inode *inode)
90{
91 return list_entry(inode, struct minix_inode_info, vfs_inode);
92}