]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blkdev: Get rid of get_device_by_uuid
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 8 May 2018 20:31:25 +0000 (16:31 -0400)
committerNathan Cutler <ncutler@suse.com>
Fri, 18 May 2018 13:30:35 +0000 (15:30 +0200)
This function's interface is bad, in that it takes char*s with no
sizes. Also nobody calls it.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
(cherry picked from commit ef8465c2a534875864563e6f0d48ab0e351e67f5)

src/common/blkdev.cc
src/common/blkdev.h

index e88c9e69c10553e5623422b10681c0284dc73294..2e32b9dc969abd5688accfbbbe51065e33a83cab 100644 (file)
@@ -209,45 +209,6 @@ 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)
-{
-  char uuid_str[UUID_LEN+1];
-  char basename[PATH_MAX];
-  const char* temp_partition_ptr = NULL;
-  blkid_cache cache = NULL;
-  blkid_dev dev = NULL;
-  int rc = 0;
-
-  dev_uuid.print(uuid_str);
-
-  if (blkid_get_cache(&cache, NULL) >= 0)
-    dev = blkid_find_dev_with_tag(cache, label, (const char*)uuid_str);
-  else
-    return -EINVAL;
-
-  if (dev) {
-    temp_partition_ptr = blkid_dev_devname(dev);
-    strncpy(partition, temp_partition_ptr, PATH_MAX);
-    rc = get_block_device_base(partition, basename,
-      sizeof(basename));
-    if (rc >= 0) {
-      strncpy(device, basename, sizeof(basename));
-      rc = 0;
-    } else {
-      rc = -ENODEV;
-    }
-  } else {
-    rc = -EINVAL;
-  }
-
-  /* From what I can tell, blkid_put_cache cleans up dev, which
-   * appears to be a pointer into cache, as well */
-  if (cache)
-    blkid_put_cache(cache);
-  return rc;
-}
-
 int get_device_by_fd(int fd, char *partition, char *device, size_t max)
 {
   struct stat st;
@@ -424,12 +385,6 @@ bool block_device_is_rotational(const char *devname)
   return false;
 }
 
-int get_device_by_uuid(uuid_d dev_uuid, const char* label, char* partition,
-       char* device)
-{
-  return -EOPNOTSUPP;
-}
-
 void get_dm_parents(const std::string& dev, std::set<std::string> *ls)
 {
 }
@@ -475,11 +430,6 @@ bool block_device_is_rotational(const char *devname)
   return false;
 }
 
-int get_device_by_uuid(uuid_d dev_uuid, const char* label, char* partition,
-       char* device)
-{
-  return -EOPNOTSUPP;
-}
 int get_device_by_fd(int fd, char *partition, char *device, size_t max)
 {
   return -EOPNOTSUPP;
@@ -525,12 +475,6 @@ bool block_device_is_rotational(const char *devname)
   return false;
 }
 
-int get_device_by_uuid(uuid_d dev_uuid, const char* label, char* partition,
-       char* device)
-{
-  return -EOPNOTSUPP;
-}
-
 int get_device_by_fd(int fd, char *partition, char *device, size_t max)
 {
   return -EOPNOTSUPP;
index 6b926285c38637bb593b56cb4b0fe5ddfe7430d2..badf5c993ff83f98a4065961d13386f6217b0b62 100644 (file)
@@ -15,10 +15,6 @@ extern int block_device_discard(int fd, int64_t offset, int64_t len);
 extern int get_block_device_size(int fd, int64_t *psize);
 extern int get_device_by_fd(int fd, char* partition, char* device, size_t max);
 
-// from a uuid
-extern int get_device_by_uuid(uuid_d dev_uuid, const char* label,
-                             char* partition, char* device);
-
 // from a device (e.g., "sdb")
 extern int64_t get_block_device_int_property(
        const char *devname, const char *property);