Restrict query to udev device properties in DMRaid::get_udev_dm_name()

Restricting the udev query from all types of device data to only
properties slightly simplifies the output from udevadm info which has to
be parsed.  From this:
    $ udevadm info --query=all --name=/dev/dm-0 | grep DM_NAME
    E: DM_NAME=isw_cbaccqjiij_myarray

to:
    $ udevadm info --query=property --name=/dev/dm-0 | grep DM_NAME
    DM_NAME=isw_cbaccqjiij_myarray
This commit is contained in:
Mike Fleetwood 2024-08-09 15:29:53 +01:00
parent ad97634246
commit c6ee5d8df5
1 changed files with 2 additions and 2 deletions

View File

@ -283,9 +283,9 @@ Glib::ustring DMRaid::get_udev_dm_name( const Glib::ustring & dev_path )
//Retrieve DM_NAME of device using udev information
Glib::ustring output;
Glib::ustring error;
Utils::execute_command("udevadm info --query=all --name=" + Glib::shell_quote(dev_path),
Utils::execute_command("udevadm info --query=property --name=" + Glib::shell_quote(dev_path),
output, error, true);
dm_name = Utils::regexp_label(output, "^E: DM_NAME=([^\n]*)$");
dm_name = Utils::regexp_label(output, "^DM_NAME=([^\n]*)$");
return dm_name ;
}