]> mj.ucw.cz Git - pciutils.git/commit
Library: Big cleanup of pci_fill_info()
authorMartin Mares <mj@ucw.cz>
Mon, 25 May 2020 13:10:07 +0000 (15:10 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 25 May 2020 13:10:07 +0000 (15:10 +0200)
commit82c06b47dea5a38075ce9d56f743360bc47b4c78
tree6303832e10e83a2a1becda7695db2315752f3d69
parent22c4be4aadbee37c61ff34e17f3ea99c88210465
Library: Big cleanup of pci_fill_info()

There was a lot of minor issues in the implementation of the fill_info
call-back in various back-ends. Most importantly, semantics of pci_dev->
known_fields was not formally defined and it was implemented inconsistently.

We now define known_fields as the set of fields which were already
obtained during the lifetime of the pci_dev. We never consider known
fields which are not supported by the back-end. All fields which are
unsupported by either the back-end, the OS, or the particular device,
are guaranteed to have sensible default values (0 or NULL). Also, bit
masks are always unsigned except for the signature of pci_fill_info()
which should be preferably kept stable.

All back-ends and the pci_generic_fill_info() function have been changed
to follow this semantics.

In the sysfs back-end, we read as few attributes as possible during
device initialization, so applications which use pci_get_dev() are not
slowed down unnecessarily.

In the Hurd back-end, we also respect the buscentric mode.
TODO
lib/access.c
lib/generic.c
lib/hurd.c
lib/internal.h
lib/pci.h
lib/sysfs.c