lsblk: remove huge all-function if-condition
Let's make it more readable and easy to extend. Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
24e896c140
commit
d1574dae64
1 changed files with 59 additions and 59 deletions
|
@ -54,6 +54,8 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *dev
|
||||||
static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
|
static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
|
||||||
{
|
{
|
||||||
struct udev_device *dev;
|
struct udev_device *dev;
|
||||||
|
const char *data;
|
||||||
|
struct lsblk_devprop *prop;
|
||||||
|
|
||||||
if (ld->udev_requested)
|
if (ld->udev_requested)
|
||||||
return ld->properties;
|
return ld->properties;
|
||||||
|
@ -64,9 +66,10 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
dev = udev_device_new_from_subsystem_sysname(udev, "block", ld->name);
|
dev = udev_device_new_from_subsystem_sysname(udev, "block", ld->name);
|
||||||
if (dev) {
|
if (!dev)
|
||||||
const char *data;
|
goto done;
|
||||||
struct lsblk_devprop *prop;
|
|
||||||
|
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
|
||||||
|
|
||||||
if (ld->properties)
|
if (ld->properties)
|
||||||
lsblk_device_free_properties(ld->properties);
|
lsblk_device_free_properties(ld->properties);
|
||||||
|
@ -127,9 +130,6 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
|
||||||
}
|
}
|
||||||
|
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ld->udev_requested = 1;
|
ld->udev_requested = 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue