Skip to content
  • Christian Kellner's avatar
    device+sysfs: new device ident struct · 95ef1b8b
    Christian Kellner authored
    Introduce a new BoltIdent struct that holds the name and vendor
    information for a thunderbolt device together with a reference
    to the 'struct udev_device' that provides those information.
    This binds the lifetime of the char pointers directly to the
    struct where they are contained and thus prevent accidental
    bugs where the strings are used after the udev_device is not
    valid anymore (got un-referenced).
    Since the struct holds a reference, define a clear method for
    it and the corresponding auto-cleanup method.
    Use the new BoltIdent struct for 'bolt_device_ident'. Re-factor
    it to not use a loop anymore.
    
    The read_sysattr_name helper, use in 'bolt_device_ident' now
    uses the recently introduced sysattr value getter.
    95ef1b8b