1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cmd: save device_id_sysfs_dir

read and save device_id_sysfs_dir to avoid spamming
debug output from find_config_tree_str.
This commit is contained in:
David Teigland 2022-10-24 16:15:53 -05:00
parent 94dde57699
commit 830ece75e8
3 changed files with 3 additions and 3 deletions

View File

@ -643,6 +643,7 @@ static int _process_config(struct cmd_context *cmd)
if (!dm_set_uuid_prefix(UUID_PREFIX))
return_0;
#endif
cmd->device_id_sysfs_dir = find_config_tree_str(cmd, devices_device_id_sysfs_dir_CFG, NULL);
dev_ext_info_src = find_config_tree_str(cmd, devices_external_device_info_source_CFG, NULL);

View File

@ -247,6 +247,7 @@ struct cmd_context {
* Paths.
*/
const char *lib_dir; /* cache value global/library_dir */
const char *device_id_sysfs_dir;
char system_dir[PATH_MAX];
char dev_dir[PATH_MAX];
char proc_dir[PATH_MAX];

View File

@ -193,9 +193,7 @@ static int _read_sys_block(struct cmd_context *cmd, struct device *dev,
dev_t prim = 0;
int ret;
if (!(sysfs_dir = find_config_tree_str(cmd, devices_device_id_sysfs_dir_CFG, NULL)))
sysfs_dir = dm_sysfs_dir();
sysfs_dir = cmd->device_id_sysfs_dir ?: dm_sysfs_dir();
retry:
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/%s",
sysfs_dir, (int)MAJOR(devt), (int)MINOR(devt), suffix) < 0) {