ext2.h 5.5 KB

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