[Libosinfo] [libosinfo] Allow to use system pci.ids/usb.ids files

Daniel P. Berrange berrange at redhat.com
Mon Mar 4 18:37:41 UTC 2013


On Mon, Mar 04, 2013 at 08:18:12PM +0200, Zeeshan Ali (Khattak) wrote:
> On Mon, Mar 4, 2013 at 7:57 PM, Daniel P. Berrange <berrange at redhat.com> wrote:
> > On Thu, Feb 28, 2013 at 12:33:13PM +0100, Christophe Fergeau wrote:
> >> Most distros already ship copies of pci.ids/usb.ids. This commit
> >> allows to make use of these rather than the ones shipped with
> >> libosinfo. This is achieved through the use of
> >> --with-usb-ids-path and --with-pci-ids-path configure flags.
> >> ---
> >>  configure.ac           | 24 ++++++++++++++++++++++++
> >>  data/Makefile.am       | 25 ++++++++++++++-----------
> >>  libosinfo.spec.in      |  2 +-
> >>  osinfo/osinfo_loader.c | 45 +++++++++++++++++++++++++++++++++++++++++----
> >>  4 files changed, 80 insertions(+), 16 deletions(-)
> >
> >> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> >> index 76e9bc2..ec8c94c 100644
> >> --- a/osinfo/osinfo_loader.c
> >> +++ b/osinfo/osinfo_loader.c
> >> @@ -1653,10 +1653,26 @@ osinfo_loader_process_file(OsinfoLoader *loader,
> >>      case G_FILE_TYPE_REGULAR:
> >>          if (g_str_has_suffix(name, ".xml"))
> >>              osinfo_loader_process_file_reg_xml(loader, file, info, &error);
> >> -        else if (strcmp(name, "usb.ids") == 0)
> >> -            osinfo_loader_process_file_reg_usb(loader, file, info, &error);
> >> -        else if (strcmp(name, "pci.ids") == 0)
> >> -            osinfo_loader_process_file_reg_pci(loader, file, info, &error);
> >> +        else {
> >> +            gchar *pci_ids_filename;
> >> +            gchar *usb_ids_filename;
> >> +#if defined(PCI_IDS)
> >> +            pci_ids_filename = g_path_get_basename(PCI_IDS);
> >> +#else
> >> +            pci_ids_filename = g_strdup("pci.ids");
> >> +#endif
> >> +#if defined(USB_IDS)
> >> +            usb_ids_filename = g_path_get_basename(USB_IDS);
> >> +#else
> >> +            usb_ids_filename = g_strdup("usb.ids");
> >> +#endif
> >
> > This seems pretty strange to me - I don't see why we need to change this
> > part of the code at all in fact. If the user wants to drop a usb.ids
> > file into the osinfo database directory we should load that regardless
> > of whether we shipped one in the RPM or pointed at the common file
> > instead.
> 
> Except that they are not doing this for libosinfo. AFAIK, these files
> are even going to be part of systemd in near future.

You're missing my point. If I, as a end user, want to update the PCI
IDs file, I should be able to just put it into $HOME/.config/libosinfo/db/pci.ids
We shouldn't be changing /the way/ libosinfo loads files from the database
directories. We should only change /where/ the default data comes from.
This is nothing todo with systemd or any distro decision on whether to
use the built-in pci.ids, or a distro default version of the file.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list