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;
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)
{
}
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;
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;
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);