]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/blkdev: add block_device_model
authorSage Weil <sage@redhat.com>
Fri, 24 Mar 2017 00:41:05 +0000 (19:41 -0500)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 17:23:59 +0000 (13:23 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/blkdev.cc
src/common/blkdev.h

index 5842063b3c4efe26b57c58ba84df675044efc041..27d491dc2cba7a0321e68c545a078ed06c1d4e95 100644 (file)
@@ -206,6 +206,11 @@ bool block_device_is_rotational(const char *devname)
   return get_block_device_int_property(devname, "queue/rotational") > 0;
 }
 
+int block_device_model(const char *devname, char *model, size_t max)
+{
+  return get_block_device_string_property(devname, "device/model", model, max);
+}
+
 int get_device_by_uuid(uuid_d dev_uuid, const char* label, char* partition,
        char* device)
 {
index 1c8f8da2733d89955cacf2b40e01f7ba7dc9d3e9..4292066fbeae89a5254c0eb28d88558fe8082c58 100644 (file)
@@ -11,6 +11,7 @@ extern int64_t get_block_device_string_property(const char *devname, const char
                                                char *val, size_t maxlen);
 extern bool block_device_support_discard(const char *devname);
 extern bool block_device_is_rotational(const char *devname);
+extern int block_device_model(const char *devname, char *model, size_t max);
 extern int block_device_discard(int fd, int64_t offset, int64_t len);
 extern int get_device_by_uuid(uuid_d dev_uuid, const char* label,
                char* partition, char* device);