2019-10-02 18:35:36 -04:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2025-03-20 10:53:52 -04:00
|
|
|
#ifndef _BCACHEFS_NAMEI_H
|
|
|
|
#define _BCACHEFS_NAMEI_H
|
2019-10-02 18:35:36 -04:00
|
|
|
|
2024-06-17 13:58:17 -04:00
|
|
|
#include "dirent.h"
|
|
|
|
|
2019-10-02 18:35:36 -04:00
|
|
|
struct posix_acl;
|
|
|
|
|
2021-03-16 00:28:17 -04:00
|
|
|
#define BCH_CREATE_TMPFILE (1U << 0)
|
2021-03-16 23:28:43 -04:00
|
|
|
#define BCH_CREATE_SUBVOL (1U << 1)
|
|
|
|
#define BCH_CREATE_SNAPSHOT (1U << 2)
|
|
|
|
#define BCH_CREATE_SNAPSHOT_RO (1U << 3)
|
2021-03-16 00:28:17 -04:00
|
|
|
|
|
|
|
int bch2_create_trans(struct btree_trans *, subvol_inum,
|
2019-10-02 18:35:36 -04:00
|
|
|
struct bch_inode_unpacked *,
|
|
|
|
struct bch_inode_unpacked *,
|
|
|
|
const struct qstr *,
|
|
|
|
uid_t, gid_t, umode_t, dev_t,
|
|
|
|
struct posix_acl *,
|
2021-03-16 00:28:17 -04:00
|
|
|
struct posix_acl *,
|
2021-03-16 23:28:43 -04:00
|
|
|
subvol_inum, unsigned);
|
2019-10-02 18:35:36 -04:00
|
|
|
|
2021-03-16 00:28:17 -04:00
|
|
|
int bch2_link_trans(struct btree_trans *,
|
|
|
|
subvol_inum, struct bch_inode_unpacked *,
|
|
|
|
subvol_inum, struct bch_inode_unpacked *,
|
2019-10-02 18:35:36 -04:00
|
|
|
const struct qstr *);
|
|
|
|
|
2021-03-16 00:28:17 -04:00
|
|
|
int bch2_unlink_trans(struct btree_trans *, subvol_inum,
|
|
|
|
struct bch_inode_unpacked *,
|
2019-10-02 18:35:36 -04:00
|
|
|
struct bch_inode_unpacked *,
|
2021-10-11 12:03:19 -04:00
|
|
|
const struct qstr *, bool);
|
2019-10-02 18:35:36 -04:00
|
|
|
|
|
|
|
int bch2_rename_trans(struct btree_trans *,
|
2021-03-16 00:28:17 -04:00
|
|
|
subvol_inum, struct bch_inode_unpacked *,
|
|
|
|
subvol_inum, struct bch_inode_unpacked *,
|
2019-10-02 18:35:36 -04:00
|
|
|
struct bch_inode_unpacked *,
|
|
|
|
struct bch_inode_unpacked *,
|
|
|
|
const struct qstr *,
|
|
|
|
const struct qstr *,
|
|
|
|
enum bch_rename_mode);
|
|
|
|
|
|
|
|
bool bch2_reinherit_attrs(struct bch_inode_unpacked *,
|
|
|
|
struct bch_inode_unpacked *);
|
|
|
|
|
2024-09-28 15:40:49 -04:00
|
|
|
int bch2_inum_to_path(struct btree_trans *, subvol_inum, struct printbuf *);
|
2025-05-19 09:48:50 -04:00
|
|
|
int bch2_inum_snapshot_to_path(struct btree_trans *, u64, u32,
|
|
|
|
snapshot_id_list *, struct printbuf *);
|
2024-09-28 15:40:49 -04:00
|
|
|
|
2025-03-20 11:06:50 -04:00
|
|
|
int __bch2_check_dirent_target(struct btree_trans *,
|
|
|
|
struct btree_iter *,
|
|
|
|
struct bkey_s_c_dirent,
|
|
|
|
struct bch_inode_unpacked *, bool);
|
|
|
|
|
|
|
|
static inline bool inode_points_to_dirent(struct bch_inode_unpacked *inode,
|
|
|
|
struct bkey_s_c_dirent d)
|
|
|
|
{
|
|
|
|
return inode->bi_dir == d.k->p.inode &&
|
|
|
|
inode->bi_dir_offset == d.k->p.offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int bch2_check_dirent_target(struct btree_trans *trans,
|
|
|
|
struct btree_iter *dirent_iter,
|
|
|
|
struct bkey_s_c_dirent d,
|
|
|
|
struct bch_inode_unpacked *target,
|
|
|
|
bool in_fsck)
|
|
|
|
{
|
|
|
|
if (likely(inode_points_to_dirent(target, d) &&
|
|
|
|
d.v->d_type == inode_d_type(target)))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return __bch2_check_dirent_target(trans, dirent_iter, d, target, in_fsck);
|
|
|
|
}
|
2025-03-20 11:06:50 -04:00
|
|
|
|
2025-05-19 10:31:44 -04:00
|
|
|
int bch2_maybe_propagate_has_case_insensitive(struct btree_trans *, subvol_inum,
|
|
|
|
struct bch_inode_unpacked *);
|
|
|
|
int bch2_check_inode_has_case_insensitive(struct btree_trans *, struct bch_inode_unpacked *,
|
|
|
|
snapshot_id_list *, bool *);
|
|
|
|
|
2025-03-20 10:53:52 -04:00
|
|
|
#endif /* _BCACHEFS_NAMEI_H */
|