&maj, &min, &patchlevel);
}
-int get_device_list(const struct volume_group *vg, struct dm_list **devs,
- unsigned *devs_features)
+int get_dm_active_devices(const struct volume_group *vg, struct dm_list **devs,
+ unsigned *devs_features)
{
if (!activation())
return 0;
- return dev_manager_get_device_list(NULL, devs, devs_features);
+ return dev_manager_get_dm_active_devices(NULL, devs, devs_features);
}
/*
int target_version(const char *target_name, uint32_t *maj,
uint32_t *min, uint32_t *patchlevel);
-int get_device_list(const struct volume_group *vg, struct dm_list **devs,
+int get_dm_active_devices(const struct volume_group *vg, struct dm_list **devs,
unsigned *devs_features);
-int device_get_uuid(struct cmd_context *cmd, int major, int minor,
- char *uuid_buf, size_t uuid_buf_size);
+int devno_dm_uuid(struct cmd_context *cmd, int major, int minor,
+ char *uuid_buf, size_t uuid_buf_size);
+int dev_dm_uuid(struct cmd_context *cmd, struct device *dev,
+ char *uuid_buf, size_t uuid_buf_size);
int raid4_is_supported(struct cmd_context *cmd, const struct segment_type *segtype);
int lvm_dm_prefix_check(int major, int minor, const char *prefix);
}
/* Read UUID from a given DM device into buf_uuid */
-int device_get_uuid(struct cmd_context *cmd, int major, int minor,
- char *uuid_buf, size_t uuid_buf_size)
+int devno_dm_uuid(struct cmd_context *cmd, int major, int minor,
+ char *uuid_buf, size_t uuid_buf_size)
{
struct dm_task *dmt;
struct dm_info info;
return r;
}
+int dev_dm_uuid(struct cmd_context *cmd, struct device *dev,
+ char *uuid_buf, size_t uuid_buf_size)
+{
+ return devno_dm_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev),
+ uuid_buf, uuid_buf_size);
+}
+
/*
* If active LVs were activated by a version of LVM2 before 2.02.00 we must
* perform additional checks to find them because they do not have the LVM-
return r;
}
-int dev_manager_get_device_list(const char *prefix, struct dm_list **devs, unsigned *devs_features)
+/*
+ * Get a list of active dm devices from the kernel.
+ * The 'devs' list contains a struct dm_active_device.
+ */
+
+int dev_manager_get_dm_active_devices(const char *prefix, struct dm_list **devs, unsigned *devs_features)
{
struct dm_task *dmt;
int r = 1;
int dev_manager_remove_dm_major_minor(uint32_t major, uint32_t minor);
int dev_manager_check_prefix_dm_major_minor(uint32_t major, uint32_t minor, const char *prefix);
-int dev_manager_get_device_list(const char *prefix, struct dm_list **devs,
- unsigned *devs_features);
+int dev_manager_get_dm_active_devices(const char *prefix, struct dm_list **devs,
+ unsigned *devs_features);
#endif
char uuid[DM_UUID_LEN];
size_t uuid_len;
- if (!device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), uuid, sizeof(uuid)))
+ if (!dev_dm_uuid(cmd, dev, uuid, sizeof(uuid)))
return_0;
uuid_len = strlen(uuid);
_cache.dm_uuids = NULL;
}
- if (!get_device_list(NULL, &cmd->cache_dm_devs, &devs_features))
+ if (!get_dm_active_devices(NULL, &cmd->cache_dm_devs, &devs_features))
return 1;
if (!(devs_features & DM_DEVICE_LIST_HAS_UUID)) {
/* Check whether holder's UUID uses MPATH prefix */
/* TODO: reuse/merge with dev_has_mpath_uuid() as this function also recognizes kpartx partition */
- if (device_get_uuid(cmd, dm_dev_major, dm_dev_minor, uuid, sizeof(uuid)) &&
+ if (devno_dm_uuid(cmd, dm_dev_major, dm_dev_minor, uuid, sizeof(uuid)) &&
!strncmp(uuid, MPATH_PREFIX, sizeof(MPATH_PREFIX) - 1)) {
log_debug_devs("dev_is_mpath_component %s holder %s %u:%u ignore mpath component",
dev_name(dev), holder_name, dm_dev_major, dm_dev_minor);
{
char buffer[128];
- if (device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev),
- buffer, sizeof(buffer)) &&
+ if (dev_dm_uuid(cmd, dev, buffer, sizeof(buffer)) &&
!strncmp(buffer, UUID_PREFIX, sizeof(UUID_PREFIX) - 1))
return 1;
* by reading DM status and seeing if the uuid begins
* with UUID_PREFIX ("LVM-")
*/
- if (!device_get_uuid(cmd, dm_dev_major, dm_dev_minor, dm_uuid, sizeof(dm_uuid)))
+ if (!devno_dm_uuid(cmd, dm_dev_major, dm_dev_minor, dm_uuid, sizeof(dm_uuid)))
continue;
if (!strncmp(dm_uuid, UUID_PREFIX, lvm_prefix_len))
char uuid[DM_UUID_LEN];
char *idname;
- if (!device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), uuid, sizeof(uuid)))
+ if (!dev_dm_uuid(cmd, dev, uuid, sizeof(uuid)))
return_0;
if (!_dm_uuid_has_prefix(uuid, "mpath-"))
char uuid[DM_UUID_LEN];
char *idname;
- if (!device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), uuid, sizeof(uuid)))
+ if (!dev_dm_uuid(cmd, dev, uuid, sizeof(uuid)))
return_0;
if (!_dm_uuid_has_prefix(uuid, "CRYPT-"))
char uuid[DM_UUID_LEN];
char *idname;
- if (!device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), uuid, sizeof(uuid)))
+ if (!dev_dm_uuid(cmd, dev, uuid, sizeof(uuid)))
return_0;
if (!_dm_uuid_has_prefix(uuid, UUID_PREFIX))
case DEV_ID_TYPE_MPATH_UUID:
case DEV_ID_TYPE_CRYPT_UUID:
case DEV_ID_TYPE_LVMLV_UUID:
- (void)device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), sysbuf, sizeof(sysbuf));
+ (void)dev_dm_uuid(cmd, dev, sysbuf, sizeof(sysbuf));
break;
case DEV_ID_TYPE_MD_UUID:
read_sys_block(cmd, dev, "md/uuid", sysbuf, sizeof(sysbuf));
}
if ((MAJOR(dev->dev) == cmd->dev_types->device_mapper_major)) {
- if (!device_get_uuid(cmd, MAJOR(dev->dev), MINOR(dev->dev), sysbuf, sizeof(sysbuf)))
+ if (!dev_dm_uuid(cmd, dev, sysbuf, sizeof(sysbuf)))
goto_out;
if (_dm_uuid_has_prefix(sysbuf, "mpath-"))
if (!label_scan_setup_bcache())
return_0;
- /* Initialize dm device cache early so
- * 'Hints' file processing can also use it */
+ /*
+ * Initialize cache of dm device uuids, which uses a special dm kernel
+ * feature for efficiently querying many dm devs together. (It's done
+ * here, before processing the hints file, so that the dm uuid checks
+ * in hint processing can benefit from the dm uuid cache.)
+ */
if (!dev_cache_update_dm_devs(cmd))
return_0;
if (stat(me->mnt_dir, &info) < 0)
return_0;
- if (!device_get_uuid(cmd, MAJOR(info.st_dev), MINOR(info.st_dev), dm_uuid, sizeof(dm_uuid)))
+ if (!devno_dm_uuid(cmd, MAJOR(info.st_dev), MINOR(info.st_dev), dm_uuid, sizeof(dm_uuid)))
return_0;
log_debug("Found root dm_uuid %s", dm_uuid);