]> mj.ucw.cz Git - pciutils.git/commitdiff
NUMA node scanning is now done in an ABI-compatible way
authorMartin Mares <mj@ucw.cz>
Mon, 14 Sep 2015 15:00:28 +0000 (17:00 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 14 Sep 2015 15:00:28 +0000 (17:00 +0200)
The numa_node field was moved to the end of the public part of
struct pci_dev. As usually, it has to be requested using the
PCI_FILL_NUMA_NODE and pci_fill_info() is versioned.

lib/access.c
lib/internal.h
lib/libpci.ver
lib/pci.h
lib/sysfs.c
lspci.c

index a547d2c4eee91aad2ec3c3ab3140f71429cf2e51..5994008d42a6d1e9f753e5fe38e2d2d666f3606a 100644 (file)
@@ -155,7 +155,7 @@ pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
 }
 
 int
-pci_fill_info_v33(struct pci_dev *d, int flags)
+pci_fill_info_v34(struct pci_dev *d, int flags)
 {
   if (flags & PCI_FILL_RESCAN)
     {
@@ -169,15 +169,17 @@ pci_fill_info_v33(struct pci_dev *d, int flags)
 }
 
 /* In version 3.1, pci_fill_info got new flags => versioned alias */
-/* In versions 3.2 and 3.3, the same has happened */
-STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v33(d, flags));
-DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v33);
-DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v33);
-DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v33);
+/* In versions 3.2, 3.3 and 3.4, the same has happened */
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v34(d, flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v34);
 SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
 SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
 SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@LIBPCI_3.2);
-SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@@LIBPCI_3.3);
+SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@LIBPCI_3.3);
+SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@@LIBPCI_3.4);
 
 void
 pci_setup_cache(struct pci_dev *d, byte *cache, int len)
index a3123858cf1e2fe13d3f323195247262bce7bedf..7e101aba8b36d8749d6fccadab6a5b691d102c3c 100644 (file)
@@ -69,6 +69,7 @@ int pci_fill_info_v30(struct pci_dev *, int flags) VERSIONED_ABI;
 int pci_fill_info_v31(struct pci_dev *, int flags) VERSIONED_ABI;
 int pci_fill_info_v32(struct pci_dev *, int flags) VERSIONED_ABI;
 int pci_fill_info_v33(struct pci_dev *, int flags) VERSIONED_ABI;
+int pci_fill_info_v34(struct pci_dev *, int flags) VERSIONED_ABI;
 
 /* params.c */
 void pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
index 31f89fd6a4f6eb7327ed58fc23ad4d376dd0bac6..7ac8d344c64e294a28313d474f6b0ecfaf7dfb2c 100644 (file)
@@ -61,3 +61,8 @@ LIBPCI_3.3 {
                pci_filter_parse_id;
                pci_filter_parse_slot;
 };
+
+LIBPCI_3.4 {
+       global:
+               pci_fill_info;
+};
index aafcfcb789a9cae38fafaf17bbfeace211ae8c31..39df8ea6af5896f737c90267d6a81a9dfe229c26 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -127,7 +127,6 @@ struct pci_dev {
   u16 vendor_id, device_id;            /* Identity of the device */
   u16 device_class;                    /* PCI device class */
   int irq;                             /* IRQ number */
-  int numa_node;                       /* NUMA node */
   pciaddr_t base_addr[6];              /* Base addresses including flags in lower bits */
   pciaddr_t size[6];                   /* Region sizes */
   pciaddr_t rom_base_addr;             /* Expansion ROM base address */
@@ -136,6 +135,7 @@ struct pci_dev {
   char *phy_slot;                      /* Physical slot */
   char *module_alias;                  /* Linux kernel module alias */
   char *label;                         /* Device name as exported by BIOS */
+  int numa_node;                       /* NUMA node */
 
   /* Fields used internally: */
   struct pci_access *access;
@@ -162,18 +162,19 @@ int pci_write_block(struct pci_dev *, int pos, u8 *buf, int len) PCI_ABI;
 
 int pci_fill_info(struct pci_dev *, int flags) PCI_ABI; /* Fill in device information */
 
-#define PCI_FILL_IDENT         1
-#define PCI_FILL_IRQ           2
-#define PCI_FILL_BASES         4
-#define PCI_FILL_ROM_BASE      8
-#define PCI_FILL_SIZES         16
-#define PCI_FILL_CLASS         32
-#define PCI_FILL_CAPS          64
-#define PCI_FILL_EXT_CAPS      128
-#define PCI_FILL_PHYS_SLOT     256
-#define PCI_FILL_MODULE_ALIAS  512
-#define PCI_FILL_LABEL         1024
-#define PCI_FILL_RESCAN                0x10000
+#define PCI_FILL_IDENT         0x0001
+#define PCI_FILL_IRQ           0x0002
+#define PCI_FILL_BASES         0x0004
+#define PCI_FILL_ROM_BASE      0x0008
+#define PCI_FILL_SIZES         0x0010
+#define PCI_FILL_CLASS         0x0020
+#define PCI_FILL_CAPS          0x0040
+#define PCI_FILL_EXT_CAPS      0x0080
+#define PCI_FILL_PHYS_SLOT     0x0100
+#define PCI_FILL_MODULE_ALIAS  0x0200
+#define PCI_FILL_LABEL         0x0400
+#define PCI_FILL_NUMA_NODE     0x0800
+#define PCI_FILL_RESCAN                0x00010000
 
 void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
 
index 800fb4e430087afb5fc3a8838789e1570df13c18..9c005bb19115afa5939f3422a5df28b44356566e 100644 (file)
@@ -200,7 +200,7 @@ static void sysfs_scan(struct pci_access *a)
          d->vendor_id = sysfs_get_value(d, "vendor");
          d->device_id = sysfs_get_value(d, "device");
          d->device_class = sysfs_get_value(d, "class") >> 8;
-         d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES;
+         d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_NUMA_NODE;
        }
       pci_link_dev(a, d);
     }
diff --git a/lspci.c b/lspci.c
index 9ec65701af5f49bf08c6542eeb0fcc11672dcdc0..219e260deff21037e742bce72b83a477aead75e1 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -138,7 +138,9 @@ scan_device(struct pci_dev *p)
        d->config_cached += 64;
     }
   pci_setup_cache(p, d->config, d->config_cached);
-  pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL);
+  pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES |
+    PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL |
+    PCI_FILL_NUMA_NODE);
   return d;
 }