diff options
author | Martin Mares <mj@ucw.cz> | 2008-02-20 12:18:19 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2008-02-20 12:18:19 +0100 |
commit | a2bf30a4fd407c55e8172e2f6fd158725ccb90b6 (patch) | |
tree | 971b143dc78a2b88ac43e01e2914ba23b95fcd57 /lib/names.h | |
parent | daf1afbf693d83566863e6dc5447e0bebdd1c679 (diff) | |
parent | 4d59f9e543c291e1454c638e32cbe94af66b11b8 (diff) | |
download | pciutils-network.tar.gz |
Merge with git+ssh://git.ucw.cz/home/mj/GIT/pciutils.git#networknetwork
Diffstat (limited to 'lib/names.h')
-rw-r--r-- | lib/names.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/names.h b/lib/names.h new file mode 100644 index 0000000..81c373f --- /dev/null +++ b/lib/names.h @@ -0,0 +1,69 @@ +/* + * The PCI Library -- ID to Name Translation + * + * Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz> + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#define MAX_LINE 1024 + +/* names-hash.c */ + +struct id_entry { + struct id_entry *next; + u32 id12, id34; + byte cat; + byte src; + char name[1]; +}; + +enum id_entry_type { + ID_UNKNOWN, + ID_VENDOR, + ID_DEVICE, + ID_SUBSYSTEM, + ID_GEN_SUBSYSTEM, + ID_CLASS, + ID_SUBCLASS, + ID_PROGIF +}; + +enum id_entry_src { + SRC_UNKNOWN, + SRC_CACHE, + SRC_NET, + SRC_LOCAL, +}; + +#define BUCKET_SIZE 8192 +#define HASH_SIZE 4099 + +static inline u32 id_pair(unsigned int x, unsigned int y) +{ + return ((x << 16) | y); +} + +static inline unsigned int pair_first(unsigned int x) +{ + return (x >> 16) & 0xffff; +} + +static inline unsigned int pair_second(unsigned int x) +{ + return x & 0xffff; +} + +int pci_id_insert(struct pci_access *a, int cat, int id1, int id2, int id3, int id4, char *text, enum id_entry_src src); +char *pci_id_lookup(struct pci_access *a, int flags, int cat, int id1, int id2, int id3, int id4); + +/* names-cache.c */ + +int pci_id_cache_load(struct pci_access *a, int flags); +void pci_id_cache_dirty(struct pci_access *a); +void pci_id_cache_flush(struct pci_access *a); +void pci_id_hash_free(struct pci_access *a); + +/* names-dns.c */ + +char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4); |