]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Updated library ABI with proper versioning.
authorMartin Mares <mj@ucw.cz>
Tue, 11 Nov 2008 11:09:20 +0000 (12:09 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 11 Nov 2008 11:09:20 +0000 (12:09 +0100)
TODO
lib/access.c
lib/caps.c
lib/filter.c
lib/internal.h
lib/libpci.ver
lib/pci.h

diff --git a/TODO b/TODO
index 4c21cc7df2132635d783d5be7d77fe6d5a146c9d..420d16cbaf1e8aca3cf94db48238386ce5f3cea2 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,8 +2,6 @@
 
 Setpci:
 - auto-width
-- man page
-- update library ABI
 - extend the register table
 
 Capabilities with partial decoding:
index 39be330851538d7b67c753aa659cbdf66429e3d8..bd829a6e37537be6451f9c9a7caec9ec563982f3 100644 (file)
@@ -145,7 +145,7 @@ pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
 }
 
 int
-pci_fill_info(struct pci_dev *d, int flags)
+pci_fill_info_v31(struct pci_dev *d, int flags)
 {
   if (flags & PCI_FILL_RESCAN)
     {
@@ -158,6 +158,12 @@ pci_fill_info(struct pci_dev *d, int flags)
   return d->known_fields;
 }
 
+/* In version 3.1, pci_fill_info got new flags => versioned alias */
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v31(d,flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v31);
+SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
+SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@@LIBPCI_3.1);
+
 void
 pci_setup_cache(struct pci_dev *d, byte *cache, int len)
 {
index 13e395617758ad90befac56c4d31e8b6ecffc258..b8a25a146501732b2eaea799520832207136edab 100644 (file)
@@ -106,7 +106,7 @@ pci_find_cap(struct pci_dev *d, unsigned int id, unsigned int type)
 {
   struct pci_cap *c;
 
-  pci_fill_info(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
+  pci_fill_info_v31(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
   for (c=d->first_cap; c; c=c->next)
     if (c->type == type && c->id == id)
       return c;
index 2bedc95e050a4f168b356747211129e31a3fe4da..0b7ce6e6e9bb6df8500683caf2001d2e0f07b3c1 100644 (file)
@@ -114,7 +114,7 @@ pci_filter_match(struct pci_filter *f, struct pci_dev *d)
     return 0;
   if (f->device >= 0 || f->vendor >= 0)
     {
-      pci_fill_info(d, PCI_FILL_IDENT);
+      pci_fill_info_v31(d, PCI_FILL_IDENT);
       if ((f->device >= 0 && f->device != d->device_id) ||
          (f->vendor >= 0 && f->vendor != d->vendor_id))
        return 0;
index deeaaafa64a270b2ef3c7728b33d299716c8dbe3..35ed65f1b426a55dcb3a651c7eef7f9e1573828b 100644 (file)
 
 #ifdef PCI_SHARED_LIB
 #define PCI_ABI __attribute__((visibility("default")))
+#define STATIC_ALIAS(_decl, _for)
+#define DEFINE_ALIAS(_decl, _for) extern _decl __attribute__((alias(#_for)))
+#define SYMBOL_VERSION(_int, _ext) asm(".symver " #_int "," #_ext)
+#else
+#define STATIC_ALIAS(_decl, _for) _decl { return _for; }
+#define DEFINE_ALIAS(_decl, _for)
+#define SYMBOL_VERSION(_int, _ext)
 #endif
 
 #include "pci.h"
@@ -46,6 +53,9 @@ char *pci_strdup(struct pci_access *a, char *s);
 struct pci_dev *pci_alloc_dev(struct pci_access *);
 int pci_link_dev(struct pci_access *, struct pci_dev *);
 
+int pci_fill_info_v30(struct pci_dev *, int flags) PCI_ABI;
+int pci_fill_info_v31(struct pci_dev *, int flags) PCI_ABI;
+
 /* params.c */
 void pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
 int pci_set_param_internal(struct pci_access *acc, char *param, char *val, int copy);
index a1b7252fea4ff1302c9af846176b8ccfe9496df9..68cc932363c03f3cfc7ff1f792c1f07c9c54bd34 100644 (file)
@@ -7,6 +7,42 @@
  */
 
 LIBPCI_3.0 {
-       global: pci_*;
+       global:
+               pci_alloc;
+               pci_cleanup;
+               pci_fill_info;
+               pci_filter_init;
+               pci_filter_match;
+               pci_filter_parse_id;
+               pci_filter_parse_slot;
+               pci_free_dev;
+               pci_free_name_list;
+               pci_get_dev;
+               pci_get_method_name;
+               pci_get_param;
+               pci_id_cache_flush;
+               pci_init;
+               pci_load_name_list;
+               pci_lookup_method;
+               pci_lookup_name;
+               pci_read_block;
+               pci_read_byte;
+               pci_read_long;
+               pci_read_word;
+               pci_scan_bus;
+               pci_set_name_list_path;
+               pci_set_param;
+               pci_setup_cache;
+               pci_walk_params;
+               pci_write_block;
+               pci_write_byte;
+               pci_write_long;
+               pci_write_word;
        local: *;
 };
+
+LIBPCI_3.1 {
+       global:
+               pci_fill_info;
+               pci_find_cap;
+};
index 3a8355a3f94d6d812f72039879a4027c59f8efdf..d7f7fee31f71f638c16c3c36326d7b0a1898560c 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -16,7 +16,7 @@
 #include "header.h"
 #include "types.h"
 
-#define PCI_LIB_VERSION 0x030000
+#define PCI_LIB_VERSION 0x030100
 
 #ifndef PCI_ABI
 #define PCI_ABI
@@ -127,6 +127,7 @@ struct pci_dev {
   pciaddr_t size[6];                   /* Region sizes */
   pciaddr_t rom_base_addr;             /* Expansion ROM base address */
   pciaddr_t rom_size;                  /* Expansion ROM size */
+  struct pci_cap *first_cap;           /* List of capabilities */
 
   /* Fields used internally: */
   struct pci_access *access;
@@ -135,9 +136,6 @@ struct pci_dev {
   int cache_len;
   int hdrtype;                         /* Cached low 7 bits of header type, -1 if unknown */
   void *aux;                           /* Auxillary data */
-
-  /* Another field set by pci_fill_info() */
-  struct pci_cap *first_cap;           /* List of capabilities */
 };
 
 #define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3)