summaryrefslogtreecommitdiff
path: root/convert/source-fs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-22 20:34:36 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commitc05c70c77ca797549e45c971bc3c02bb3ec79e6e (patch)
tree7c387f6a3c311ef9da0380125d029efb6e0c04f2 /convert/source-fs.c
parent385bbf35e245bfa71c83d6c41e563ce4ed22663e (diff)
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>
Diffstat (limited to 'convert/source-fs.c')
-rw-r--r--convert/source-fs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/convert/source-fs.c b/convert/source-fs.c
index 4755efb2..d6dfc077 100644
--- a/convert/source-fs.c
+++ b/convert/source-fs.c
@@ -28,6 +28,23 @@ const struct simple_range btrfs_reserved_ranges[3] = {
{ 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)
{
int i;