aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/ext2.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/ext2.h')
-rw-r--r--fs/ext2/ext2.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
new file mode 100644
index 000000000000..9f1a40e7945c
--- /dev/null
+++ b/fs/ext2/ext2.h
@@ -0,0 +1,160 @@
1#include <linux/fs.h>
2#include <linux/ext2_fs.h>
3
4/*
5 * second extended file system inode data in memory
6 */
7struct ext2_inode_info {
8 __le32 i_data[15];
9 __u32 i_flags;
10 __u32 i_faddr;
11 __u8 i_frag_no;
12 __u8 i_frag_size;
13 __u16 i_state;
14 __u32 i_file_acl;
15 __u32 i_dir_acl;
16 __u32 i_dtime;
17
18 /*
19 * i_block_group is the number of the block group which contains
20 * this file's inode. Constant across the lifetime of the inode,
21 * it is ued for making block allocation decisions - we try to
22 * place a file's data blocks near its inode block, and new inodes
23 * near to their parent directory's inode.
24 */
25 __u32 i_block_group;
26
27 /*
28 * i_next_alloc_block is the logical (file-relative) number of the
29 * most-recently-allocated block in this file. Yes, it is misnamed.
30 * We use this for detecting linearly ascending allocation requests.
31 */
32 __u32 i_next_alloc_block;
33
34 /*
35 * i_next_alloc_goal is the *physical* companion to i_next_alloc_block.
36 * it the the physical block number of the block which was most-recently
37 * allocated to this file. This give us the goal (target) for the next
38 * allocation when we detect linearly ascending requests.
39 */
40 __u32 i_next_alloc_goal;
41 __u32 i_prealloc_block;
42 __u32 i_prealloc_count;
43 __u32 i_dir_start_lookup;
44#ifdef CONFIG_EXT2_FS_XATTR
45 /*
46 * Extended attributes can be read independently of the main file
47 * data. Taking i_sem even when reading would cause contention
48 * between readers of EAs and writers of regular file data, so
49 * instead we synchronize on xattr_sem when reading or changing
50 * EAs.
51 */
52 struct rw_semaphore xattr_sem;
53#endif
54#ifdef CONFIG_EXT2_FS_POSIX_ACL
55 struct posix_acl *i_acl;
56 struct posix_acl *i_default_acl;
57#endif
58 rwlock_t i_meta_lock;
59 struct inode vfs_inode;
60};
61
62/*
63 * Inode dynamic state flags
64 */
65#define EXT2_STATE_NEW 0x00000001 /* inode is newly created */
66
67
68/*
69 * Function prototypes
70 */
71
72/*
73 * Ok, these declarations are also in <linux/kernel.h> but none of the
74 * ext2 source programs needs to include it so they are duplicated here.
75 */
76
77static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
78{
79 return container_of(inode, struct ext2_inode_info, vfs_inode);
80}
81
82/* balloc.c */
83extern int ext2_bg_has_super(struct super_block *sb, int group);
84extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
85extern int ext2_new_block (struct inode *, unsigned long,
86 __u32 *, __u32 *, int *);
87extern void ext2_free_blocks (struct inode *, unsigned long,
88 unsigned long);
89extern unsigned long ext2_count_free_blocks (struct super_block *);
90extern unsigned long ext2_count_dirs (struct super_block *);
91extern void ext2_check_blocks_bitmap (struct super_block *);
92extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
93 unsigned int block_group,
94 struct buffer_head ** bh);
95
96/* dir.c */
97extern int ext2_add_link (struct dentry *, struct inode *);
98extern ino_t ext2_inode_by_name(struct inode *, struct dentry *);
99extern int ext2_make_empty(struct inode *, struct inode *);
100extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,struct dentry *, struct page **);
101extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
102extern int ext2_empty_dir (struct inode *);
103extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
104extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *);
105
106/* fsync.c */
107extern int ext2_sync_file (struct file *, struct dentry *, int);
108
109/* ialloc.c */
110extern struct inode * ext2_new_inode (struct inode *, int);
111extern void ext2_free_inode (struct inode *);
112extern unsigned long ext2_count_free_inodes (struct super_block *);
113extern void ext2_check_inodes_bitmap (struct super_block *);
114extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
115
116/* inode.c */
117extern void ext2_read_inode (struct inode *);
118extern int ext2_write_inode (struct inode *, int);
119extern void ext2_delete_inode (struct inode *);
120extern int ext2_sync_inode (struct inode *);
121extern void ext2_discard_prealloc (struct inode *);
122extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
123extern void ext2_truncate (struct inode *);
124extern int ext2_setattr (struct dentry *, struct iattr *);
125extern void ext2_set_inode_flags(struct inode *inode);
126
127/* ioctl.c */
128extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
129 unsigned long);
130
131/* super.c */
132extern void ext2_error (struct super_block *, const char *, const char *, ...)
133 __attribute__ ((format (printf, 3, 4)));
134extern void ext2_warning (struct super_block *, const char *, const char *, ...)
135 __attribute__ ((format (printf, 3, 4)));
136extern void ext2_update_dynamic_rev (struct super_block *sb);
137extern void ext2_write_super (struct super_block *);
138
139/*
140 * Inodes and files operations
141 */
142
143/* dir.c */
144extern struct file_operations ext2_dir_operations;
145
146/* file.c */
147extern struct inode_operations ext2_file_inode_operations;
148extern struct file_operations ext2_file_operations;
149
150/* inode.c */
151extern struct address_space_operations ext2_aops;
152extern struct address_space_operations ext2_nobh_aops;
153
154/* namei.c */
155extern struct inode_operations ext2_dir_inode_operations;
156extern struct inode_operations ext2_special_inode_operations;
157
158/* symlink.c */
159extern struct inode_operations ext2_fast_symlink_inode_operations;
160extern struct inode_operations ext2_symlink_inode_operations;