1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_DIRENT_H
3 #define _BCACHEFS_DIRENT_H
7 extern const struct bch_hash_desc bch2_dirent_hash_desc;
9 const char *bch2_dirent_invalid(const struct bch_fs *, struct bkey_s_c);
10 void bch2_dirent_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
12 #define bch2_bkey_ops_dirent (struct bkey_ops) { \
13 .key_invalid = bch2_dirent_invalid, \
14 .val_to_text = bch2_dirent_to_text, \
22 struct bch_inode_info;
24 unsigned bch2_dirent_name_bytes(struct bkey_s_c_dirent);
26 static inline unsigned dirent_val_u64s(unsigned len)
28 return DIV_ROUND_UP(offsetof(struct bch_dirent, d_name) + len,
32 int bch2_dirent_create(struct btree_trans *, u64,
33 const struct bch_hash_info *, u8,
34 const struct qstr *, u64, int);
36 int bch2_dirent_delete_at(struct btree_trans *,
37 const struct bch_hash_info *,
40 enum bch_rename_mode {
46 int bch2_dirent_rename(struct btree_trans *,
47 u64, struct bch_hash_info *,
48 u64, struct bch_hash_info *,
49 const struct qstr *, u64 *,
50 const struct qstr *, u64 *,
51 enum bch_rename_mode);
54 __bch2_dirent_lookup_trans(struct btree_trans *, u64,
55 const struct bch_hash_info *,
56 const struct qstr *, unsigned);
57 u64 bch2_dirent_lookup(struct bch_fs *, u64, const struct bch_hash_info *,
60 int bch2_empty_dir_trans(struct btree_trans *, u64);
61 int bch2_readdir(struct bch_fs *, u64, struct dir_context *);
63 #endif /* _BCACHEFS_DIRENT_H */