btrfs-progs: check: Export btrfs_type_to_imode
This function will be later used by common mode code, so export it. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
1796d5099f
commit
87207654f1
15
check/main.c
15
check/main.c
|
@ -2448,21 +2448,6 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static u32 btrfs_type_to_imode(u8 type)
|
||||
{
|
||||
static u32 imode_by_btrfs_type[] = {
|
||||
[BTRFS_FT_REG_FILE] = S_IFREG,
|
||||
[BTRFS_FT_DIR] = S_IFDIR,
|
||||
[BTRFS_FT_CHRDEV] = S_IFCHR,
|
||||
[BTRFS_FT_BLKDEV] = S_IFBLK,
|
||||
[BTRFS_FT_FIFO] = S_IFIFO,
|
||||
[BTRFS_FT_SOCK] = S_IFSOCK,
|
||||
[BTRFS_FT_SYMLINK] = S_IFLNK,
|
||||
};
|
||||
|
||||
return imode_by_btrfs_type[(type)];
|
||||
}
|
||||
|
||||
static int repair_inode_no_item(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
struct btrfs_path *path,
|
||||
|
|
|
@ -156,4 +156,19 @@ static inline bool is_valid_imode(u32 imode)
|
|||
}
|
||||
|
||||
int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb);
|
||||
|
||||
static inline u32 btrfs_type_to_imode(u8 type)
|
||||
{
|
||||
static u32 imode_by_btrfs_type[] = {
|
||||
[BTRFS_FT_REG_FILE] = S_IFREG,
|
||||
[BTRFS_FT_DIR] = S_IFDIR,
|
||||
[BTRFS_FT_CHRDEV] = S_IFCHR,
|
||||
[BTRFS_FT_BLKDEV] = S_IFBLK,
|
||||
[BTRFS_FT_FIFO] = S_IFIFO,
|
||||
[BTRFS_FT_SOCK] = S_IFSOCK,
|
||||
[BTRFS_FT_SYMLINK] = S_IFLNK,
|
||||
};
|
||||
|
||||
return imode_by_btrfs_type[(type)];
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue