0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef OCFS2_DIR_H
0011 #define OCFS2_DIR_H
0012
0013 struct ocfs2_dx_hinfo {
0014 u32 major_hash;
0015 u32 minor_hash;
0016 };
0017
0018 struct ocfs2_dir_lookup_result {
0019 struct buffer_head *dl_leaf_bh;
0020
0021 struct ocfs2_dir_entry *dl_entry;
0022
0023
0024 struct buffer_head *dl_dx_root_bh;
0025
0026
0027 struct buffer_head *dl_dx_leaf_bh;
0028 struct ocfs2_dx_entry *dl_dx_entry;
0029
0030 struct ocfs2_dx_hinfo dl_hinfo;
0031
0032 struct buffer_head *dl_prev_leaf_bh;
0033
0034
0035
0036
0037 };
0038
0039 void ocfs2_free_dir_lookup_result(struct ocfs2_dir_lookup_result *res);
0040
0041 int ocfs2_find_entry(const char *name, int namelen,
0042 struct inode *dir,
0043 struct ocfs2_dir_lookup_result *lookup);
0044 int ocfs2_delete_entry(handle_t *handle,
0045 struct inode *dir,
0046 struct ocfs2_dir_lookup_result *res);
0047 int __ocfs2_add_entry(handle_t *handle,
0048 struct inode *dir,
0049 const char *name, int namelen,
0050 struct inode *inode, u64 blkno,
0051 struct buffer_head *parent_fe_bh,
0052 struct ocfs2_dir_lookup_result *lookup);
0053 static inline int ocfs2_add_entry(handle_t *handle,
0054 struct dentry *dentry,
0055 struct inode *inode, u64 blkno,
0056 struct buffer_head *parent_fe_bh,
0057 struct ocfs2_dir_lookup_result *lookup)
0058 {
0059 return __ocfs2_add_entry(handle, d_inode(dentry->d_parent),
0060 dentry->d_name.name, dentry->d_name.len,
0061 inode, blkno, parent_fe_bh, lookup);
0062 }
0063 int ocfs2_update_entry(struct inode *dir, handle_t *handle,
0064 struct ocfs2_dir_lookup_result *res,
0065 struct inode *new_entry_inode);
0066
0067 int ocfs2_check_dir_for_entry(struct inode *dir,
0068 const char *name,
0069 int namelen);
0070 int ocfs2_empty_dir(struct inode *inode);
0071
0072 int ocfs2_find_files_on_disk(const char *name,
0073 int namelen,
0074 u64 *blkno,
0075 struct inode *inode,
0076 struct ocfs2_dir_lookup_result *res);
0077 int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name,
0078 int namelen, u64 *blkno);
0079 int ocfs2_readdir(struct file *file, struct dir_context *ctx);
0080 int ocfs2_dir_foreach(struct inode *inode, struct dir_context *ctx);
0081 int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
0082 struct inode *dir,
0083 struct buffer_head *parent_fe_bh,
0084 const char *name,
0085 int namelen,
0086 struct ocfs2_dir_lookup_result *lookup);
0087 struct ocfs2_alloc_context;
0088 int ocfs2_fill_new_dir(struct ocfs2_super *osb,
0089 handle_t *handle,
0090 struct inode *parent,
0091 struct inode *inode,
0092 struct buffer_head *fe_bh,
0093 struct ocfs2_alloc_context *data_ac,
0094 struct ocfs2_alloc_context *meta_ac);
0095
0096 int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh);
0097
0098 struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize,
0099 void *data);
0100 #endif