From: Martin Mares Date: Tue, 11 Nov 2008 11:09:20 +0000 (+0100) Subject: Updated library ABI with proper versioning. X-Git-Tag: v3.1-alpha1~1 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=89c51b98b81ab451b3c5c17f4c3ae643110ce13b;p=pciutils.git Updated library ABI with proper versioning. --- diff --git a/TODO b/TODO index 4c21cc7..420d16c 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ Setpci: - auto-width -- man page -- update library ABI - extend the register table Capabilities with partial decoding: diff --git a/lib/access.c b/lib/access.c index 39be330..bd829a6 100644 --- a/lib/access.c +++ b/lib/access.c @@ -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) { diff --git a/lib/caps.c b/lib/caps.c index 13e3956..b8a25a1 100644 --- a/lib/caps.c +++ b/lib/caps.c @@ -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; diff --git a/lib/filter.c b/lib/filter.c index 2bedc95..0b7ce6e 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -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; diff --git a/lib/internal.h b/lib/internal.h index deeaaaf..35ed65f 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -10,6 +10,13 @@ #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); diff --git a/lib/libpci.ver b/lib/libpci.ver index a1b7252..68cc932 100644 --- a/lib/libpci.ver +++ b/lib/libpci.ver @@ -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; +}; diff --git a/lib/pci.h b/lib/pci.h index 3a8355a..d7f7fee 100644 --- 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)