]> git.hungrycats.org Git - linux/commitdiff
Export dev_item.type in sysfs /sys/fs/btrfs/<uuid>/devinfo/<devid>/type
authorGoffredo Baroncelli <kreijack@inwind.it>
Thu, 28 May 2020 18:34:50 +0000 (20:34 +0200)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 25 Dec 2020 09:07:50 +0000 (04:07 -0500)
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
(cherry picked from commit 35c9b7a7469c616af39ddae46d7645918f53bbda)
(cherry picked from commit af8e3c07b2fba9c917be34558baf1ef387bf4d45)

fs/btrfs/sysfs.c

index 21a1f4b0152e75baf614ae43b7f3b9a09a2d56bf..61a909985822e96ed486351214f2f9b41bbd38b0 100644 (file)
@@ -1248,11 +1248,22 @@ static ssize_t btrfs_devinfo_writeable_show(struct kobject *kobj,
 }
 BTRFS_ATTR(devid, writeable, btrfs_devinfo_writeable_show);
 
+static ssize_t btrfs_devinfo_type_show(struct kobject *kobj,
+                                           struct kobj_attribute *a, char *buf)
+{
+       struct btrfs_device *device = container_of(kobj, struct btrfs_device,
+                                                  devid_kobj);
+
+       return scnprintf(buf, PAGE_SIZE, "0x%08llx\n",device->type);
+}
+BTRFS_ATTR(devid, type, btrfs_devinfo_type_show);
+
 static struct attribute *devid_attrs[] = {
        BTRFS_ATTR_PTR(devid, in_fs_metadata),
        BTRFS_ATTR_PTR(devid, missing),
        BTRFS_ATTR_PTR(devid, replace_target),
        BTRFS_ATTR_PTR(devid, writeable),
+       BTRFS_ATTR_PTR(devid, type),
        NULL
 };
 ATTRIBUTE_GROUPS(devid);