Re: [PATCH] Remove /sys prefix in udev_enumerate_devices()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



looks good

--

  Martin Gracik

----- "Hans de Goede" <hdegoede@xxxxxxxxxx> wrote:

> The recent base_udev.py changes to switch over to
> global_udev.enumerate_devices(), move the removing of the /sys prefix
> to
> udev_get_device(). But in various places in the devicetree we call
> udev_get_device() (through udev_get_block_device) to get information
> from
> parents which are not yet in the tree (ie when we scan a partition
> before its disk).
> 
> All these calls are broken now, as all those pass in a path without
> /sys
> at the front and the new udev_get_device() wants it with /sys in
> front.
> 
> This patch makes udev_enumerate_devices() return paths without the
> /sys
> prefix, and reverses the changes to udev_get_device() to expect a full
> path,
> so that we use sysfs paths without /sys in front consistently
> everywhere.
> ---
>  baseudev.py |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/baseudev.py b/baseudev.py
> index 5ba1011..7266bc6 100644
> --- a/baseudev.py
> +++ b/baseudev.py
> @@ -31,19 +31,22 @@ import logging
>  log = logging.getLogger("storage")
>  
>  def udev_enumerate_devices(deviceClass="block"):
> -    return global_udev.enumerate_devices(subsystem=deviceClass)
> +    devices = global_udev.enumerate_devices(subsystem=deviceClass)
> +    return [path[4:] for path in devices]
>  
>  def udev_get_device(sysfs_path):
> -    if not os.path.exists(sysfs_path):
> +    if not os.path.exists("/sys%s" % sysfs_path):
>          log.debug("%s does not exist" % sysfs_path)
>          return None
>  
> -    dev = global_udev.create_device(sysfs_path)
> +    # XXX we remove the /sys part when enumerating devices,
> +    # so we have to prepend it when creating the device
> +    dev = global_udev.create_device("/sys" + sysfs_path)
>  
>      if dev:
>          dev["name"] = dev.sysname
>          dev["symlinks"] = dev["DEVLINKS"]
> -        dev["sysfs_path"] = sysfs_path[4:]
> +        dev["sysfs_path"] = sysfs_path
>  
>          # now add in the contents of the uevent file since they're
> handy
>          dev = udev_parse_uevent_file(dev)
> -- 
> 1.6.5.2
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux