Btrfs-progs: add type root to label property
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 12 Nov 2013 13:41:45 +0000 (13:41 +0000)
committerChris Mason <clm@fb.com>
Fri, 31 Jan 2014 16:22:32 +0000 (08:22 -0800)
So that we can get the label of a mounted filesystem.

Before this change:

        $ btrfs prop get /mnt/btrfs label
        ERROR: object is not compatible with property

        $ btrfs prop get /dev/sdb3 label
        ERROR: dev /dev/sdb3 is mounted, use mount point
        ERROR: failed to set/get property for object.

After this change:

        $ btrfs prop get /mnt/btrfs label
        label=foobar

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
props.c

diff --git a/props.c b/props.c
index 763fd57..12fdc52 100644 (file)
--- a/props.c
+++ b/props.c
@@ -105,6 +105,7 @@ static int prop_label(enum prop_object_type type,
 const struct prop_handler prop_handlers[] = {
        {"ro", "Set/get read-only flag of subvolume.", 0, prop_object_subvol,
         prop_read_only},
-       {"label", "Set/get label of device.", 0, prop_object_dev, prop_label},
+       {"label", "Set/get label of device.", 0,
+        prop_object_dev | prop_object_root, prop_label},
        {0, 0, 0, 0, 0}
 };