path: root/utils.h
diff options
authorAnand Jain <>2015-09-15 16:46:22 +0800
committerDavid Sterba <>2015-10-02 17:52:10 +0200
commit94789777b9e8f350ba815b07baa5383e99cd1944 (patch)
treec7874b6f83c52ecbac8dd8f9747004963004ae20 /utils.h
parent3276a9f519155486383e20958e0c5eb55d4c0b4f (diff)
btrfs-progs: provide fail safe for BTRFS_IOC_GET_FSLABEL ioctl
Old kernels before 3.9 do not provide ioctl BTRFS_IOC_GET_FSLABEL. So we need to provide a fail safe logic for btrfs-progs running on those kernel. In this patch when get_label_mounted() fails on the old kernel it will fail back to the old method and uses get_label_unmounted(), where it will read from the disk directly. Signed-off-by: Anand Jain <> Signed-off-by: David Sterba <>
Diffstat (limited to 'utils.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index dce0a47c..93e1de6b 100644
--- a/utils.h
+++ b/utils.h
@@ -164,6 +164,7 @@ u64 btrfs_device_size(int fd, struct stat *st);
#define strncpy_null(dest, src) __strncpy__null(dest, src, sizeof(dest))
int test_dev_for_mkfs(char *file, int force_overwrite);
int get_label_mounted(const char *mount_path, char *labelp);
+int get_label_unmounted(const char *dev, char *label);
int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
u64 dev_cnt, int mixed);
int group_profile_max_safe_loss(u64 flags);