ext2.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #include <linux/fs.h>
  2. #include <linux/ext2_fs.h>
  3. /*
  4. * ext2 mount options
  5. */
  6. struct ext2_mount_options {
  7. unsigned long s_mount_opt;
  8. uid_t s_resuid;
  9. gid_t s_resgid;
  10. };
  11. /*
  12. * second extended file system inode data in memory
  13. */
  14. struct ext2_inode_info {
  15. __le32 i_data[15];
  16. __u32 i_flags;
  17. __u32 i_faddr;
  18. __u8 i_frag_no;
  19. __u8 i_frag_size;
  20. __u16 i_state;
  21. __u32 i_file_acl;
  22. __u32 i_dir_acl;
  23. __u32 i_dtime;
  24. /*
  25. * i_block_group is the number of the block group which contains
  26. * this file's inode. Constant across the lifetime of the inode,
  27. * it is ued for making block allocation decisions - we try to
  28. * place a file's data blocks near its inode block, and new inodes
  29. * near to their parent directory's inode.
  30. */
  31. __u32 i_block_group;
  32. /* block reservation info */
  33. struct ext2_block_alloc_info *i_block_alloc_info;
  34. __u32 i_dir_start_lookup;
  35. #ifdef CONFIG_EXT2_FS_XATTR
  36. /*
  37. * Extended attributes can be read independently of the main file
  38. * data. Taking i_mutex even when reading would cause contention
  39. * between readers of EAs and writers of regular file data, so
  40. * instead we synchronize on xattr_sem when reading or changing
  41. * EAs.
  42. */
  43. struct rw_semaphore xattr_sem;
  44. #endif
  45. #ifdef CONFIG_EXT2_FS_POSIX_ACL
  46. struct posix_acl *i_acl;
  47. struct posix_acl *i_default_acl;
  48. #endif
  49. rwlock_t i_meta_lock;
  50. /*
  51. * truncate_mutex is for serialising ext2_truncate() against
  52. * ext2_getblock(). It also protects the internals of the inode's
  53. * reservation data structures: ext2_reserve_window and
  54. * ext2_reserve_window_node.
  55. */
  56. struct mutex truncate_mutex;
  57. struct inode vfs_inode;
  58. struct list_head i_orphan; /* unlinked but open inodes */
  59. };
  60. /*
  61. * Inode dynamic state flags
  62. */
  63. #define EXT2_STATE_NEW 0x00000001 /* inode is newly created */
  64. /*
  65. * Function prototypes
  66. */
  67. /*
  68. * Ok, these declarations are also in <linux/kernel.h> but none of the
  69. * ext2 source programs needs to include it so they are duplicated here.
  70. */
  71. static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
  72. {
  73. return container_of(inode, struct ext2_inode_info, vfs_inode);
  74. }
  75. /* balloc.c */
  76. extern int ext2_bg_has_super(struct super_block *sb, int group);
  77. extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
  78. extern ext2_fsblk_t ext2_new_block(struct inode *, unsigned long, int *);
  79. extern ext2_fsblk_t ext2_new_blocks(struct inode *, unsigned long,
  80. unsigned long *, int *);
  81. extern void ext2_free_blocks (struct inode *, unsigned long,
  82. unsigned long);
  83. extern unsigned long ext2_count_free_blocks (struct super_block *);
  84. extern unsigned long ext2_count_dirs (struct super_block *);
  85. extern void ext2_check_blocks_bitmap (struct super_block *);
  86. extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
  87. unsigned int block_group,
  88. struct buffer_head ** bh);
  89. extern void ext2_discard_reservation (struct inode *);
  90. extern int ext2_should_retry_alloc(struct super_block *sb, int *retries);
  91. extern void ext2_init_block_alloc_info(struct inode *);
  92. extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_window_node *rsv);
  93. /* dir.c */
  94. extern int ext2_add_link (struct dentry *, struct inode *);
  95. extern ino_t ext2_inode_by_name(struct inode *, struct dentry *);
  96. extern int ext2_make_empty(struct inode *, struct inode *);
  97. extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,struct dentry *, struct page **);
  98. extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
  99. extern int ext2_empty_dir (struct inode *);
  100. extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
  101. extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *);
  102. /* fsync.c */
  103. extern int ext2_sync_file (struct file *, struct dentry *, int);
  104. /* ialloc.c */
  105. extern struct inode * ext2_new_inode (struct inode *, int);
  106. extern void ext2_free_inode (struct inode *);
  107. extern unsigned long ext2_count_free_inodes (struct super_block *);
  108. extern void ext2_check_inodes_bitmap (struct super_block *);
  109. extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
  110. /* inode.c */
  111. extern void ext2_read_inode (struct inode *);
  112. extern int ext2_write_inode (struct inode *, int);
  113. extern void ext2_put_inode (struct inode *);
  114. extern void ext2_delete_inode (struct inode *);
  115. extern int ext2_sync_inode (struct inode *);
  116. extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
  117. extern void ext2_truncate (struct inode *);
  118. extern int ext2_setattr (struct dentry *, struct iattr *);
  119. extern void ext2_set_inode_flags(struct inode *inode);
  120. extern void ext2_get_inode_flags(struct ext2_inode_info *);
  121. int __ext2_write_begin(struct file *file, struct address_space *mapping,
  122. loff_t pos, unsigned len, unsigned flags,
  123. struct page **pagep, void **fsdata);
  124. /* ioctl.c */
  125. extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
  126. unsigned long);
  127. extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long);
  128. /* namei.c */
  129. struct dentry *ext2_get_parent(struct dentry *child);
  130. /* super.c */
  131. extern void ext2_error (struct super_block *, const char *, const char *, ...)
  132. __attribute__ ((format (printf, 3, 4)));
  133. extern void ext2_warning (struct super_block *, const char *, const char *, ...)
  134. __attribute__ ((format (printf, 3, 4)));
  135. extern void ext2_update_dynamic_rev (struct super_block *sb);
  136. extern void ext2_write_super (struct super_block *);
  137. /*
  138. * Inodes and files operations
  139. */
  140. /* dir.c */
  141. extern const struct file_operations ext2_dir_operations;
  142. /* file.c */
  143. extern const struct inode_operations ext2_file_inode_operations;
  144. extern const struct file_operations ext2_file_operations;
  145. extern const struct file_operations ext2_xip_file_operations;
  146. /* inode.c */
  147. extern const struct address_space_operations ext2_aops;
  148. extern const struct address_space_operations ext2_aops_xip;
  149. extern const struct address_space_operations ext2_nobh_aops;
  150. /* namei.c */
  151. extern const struct inode_operations ext2_dir_inode_operations;
  152. extern const struct inode_operations ext2_special_inode_operations;
  153. /* symlink.c */
  154. extern const struct inode_operations ext2_fast_symlink_inode_operations;
  155. extern const struct inode_operations ext2_symlink_inode_operations;