mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-24 12:07:54 +00:00
btrfs-progs: convert: move acl helper to common source file
There were 2 copies of ext2_acl_count and acl_ea_size. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
385bbf35e2
commit
c05c70c77c
@ -424,27 +424,6 @@ static int ext2_xattr_check_entry(struct ext2_ext_attr_entry *entry,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ext2_acl_count(size_t size)
|
|
||||||
{
|
|
||||||
ssize_t s;
|
|
||||||
size -= sizeof(ext2_acl_header);
|
|
||||||
s = size - 4 * sizeof(ext2_acl_entry_short);
|
|
||||||
if (s < 0) {
|
|
||||||
if (size % sizeof(ext2_acl_entry_short))
|
|
||||||
return -1;
|
|
||||||
return size / sizeof(ext2_acl_entry_short);
|
|
||||||
} else {
|
|
||||||
if (s % sizeof(ext2_acl_entry))
|
|
||||||
return -1;
|
|
||||||
return s / sizeof(ext2_acl_entry) + 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline size_t acl_ea_size(int count)
|
|
||||||
{
|
|
||||||
return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ext2_acl_to_xattr(void *dst, const void *src,
|
static int ext2_acl_to_xattr(void *dst, const void *src,
|
||||||
size_t dst_size, size_t src_size)
|
size_t dst_size, size_t src_size)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,23 @@ const struct simple_range btrfs_reserved_ranges[3] = {
|
|||||||
{ BTRFS_SB_MIRROR_OFFSET(2), SZ_64K }
|
{ BTRFS_SB_MIRROR_OFFSET(2), SZ_64K }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int ext2_acl_count(size_t size)
|
||||||
|
{
|
||||||
|
ssize_t s;
|
||||||
|
|
||||||
|
size -= sizeof(ext2_acl_header);
|
||||||
|
s = size - 4 * sizeof(ext2_acl_entry_short);
|
||||||
|
if (s < 0) {
|
||||||
|
if (size % sizeof(ext2_acl_entry_short))
|
||||||
|
return -1;
|
||||||
|
return size / sizeof(ext2_acl_entry_short);
|
||||||
|
} else {
|
||||||
|
if (s % sizeof(ext2_acl_entry))
|
||||||
|
return -1;
|
||||||
|
return s / sizeof(ext2_acl_entry) + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static u64 intersect_with_reserved(u64 bytenr, u64 num_bytes)
|
static u64 intersect_with_reserved(u64 bytenr, u64 num_bytes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -102,6 +102,8 @@ static inline size_t acl_ea_size(int count)
|
|||||||
return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
|
return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ext2_acl_count(size_t size);
|
||||||
|
|
||||||
struct btrfs_convert_operations {
|
struct btrfs_convert_operations {
|
||||||
const char name[SOURCE_FS_NAME_LEN];
|
const char name[SOURCE_FS_NAME_LEN];
|
||||||
int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname);
|
int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname);
|
||||||
|
@ -29,22 +29,6 @@
|
|||||||
|
|
||||||
#define REISERFS_ACL_VERSION 0x0001
|
#define REISERFS_ACL_VERSION 0x0001
|
||||||
|
|
||||||
static inline int ext2_acl_count(size_t size)
|
|
||||||
{
|
|
||||||
ssize_t s;
|
|
||||||
size -= sizeof(ext2_acl_header);
|
|
||||||
s = size - 4 * sizeof(ext2_acl_entry_short);
|
|
||||||
if (s < 0) {
|
|
||||||
if (size % sizeof(ext2_acl_entry_short))
|
|
||||||
return -1;
|
|
||||||
return size / sizeof(ext2_acl_entry_short);
|
|
||||||
} else {
|
|
||||||
if (s % sizeof(ext2_acl_entry))
|
|
||||||
return -1;
|
|
||||||
return s / sizeof(ext2_acl_entry) + 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline dev_t new_decode_dev(u32 dev)
|
static inline dev_t new_decode_dev(u32 dev)
|
||||||
{
|
{
|
||||||
unsigned major = (dev & 0xfff00) >> 8;
|
unsigned major = (dev & 0xfff00) >> 8;
|
||||||
|
Loading…
Reference in New Issue
Block a user