From 0e2039757664a651975918b333ae88c47bdc1aef Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 8 May 2018 16:31:25 -0400 Subject: [PATCH] blkdev: Get rid of get_device_by_uuid 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 (cherry picked from commit ef8465c2a534875864563e6f0d48ab0e351e67f5) --- src/common/blkdev.cc | 56 -------------------------------------------- src/common/blkdev.h | 4 ---- 2 files changed, 60 deletions(-) diff --git a/src/common/blkdev.cc b/src/common/blkdev.cc index e88c9e69c1055..2e32b9dc969ab 100644 --- a/src/common/blkdev.cc +++ b/src/common/blkdev.cc @@ -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 *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; diff --git a/src/common/blkdev.h b/src/common/blkdev.h index 6b926285c3863..badf5c993ff83 100644 --- a/src/common/blkdev.h +++ b/src/common/blkdev.h @@ -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); -- 2.39.5