]> mj.ucw.cz Git - pciutils.git/commitdiff
Use DNS on all architectures except AIX.
authorMartin Mares <mj@ucw.cz>
Mon, 11 Feb 2008 20:10:49 +0000 (21:10 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 11 Feb 2008 20:10:49 +0000 (21:10 +0100)
lib/Makefile
lib/configure
lib/names-cache.c
lib/names-net.c

index 1a0678c229599d24f4c586148b0568b9be987376..87a87fdb93b644901585046fc51a2397c5fcf864 100644 (file)
@@ -3,7 +3,7 @@
 
 include config.mk
 
-OBJS=access.o generic.o dump.o names.o filter.o names-hash.o names-parse.o
+OBJS=access.o generic.o dump.o names.o filter.o names-hash.o names-parse.o names-net.o names-cache.o
 INCL=internal.h pci.h config.h header.h sysdep.h types.h
 
 PCILIB=libpci.a
@@ -46,9 +46,6 @@ OBJS += nbsd-libpci.o
 PCILIB=libpciutils.a
 endif
 
-# FIXME: Conditions
-OBJS += names-net.o names-cache.o
-
 all: $(PCILIB) $(PCILIBPC)
 
 $(PCILIB): $(OBJS)
index b368c98a8c71e3d4908133ac8c356e83188f6f49..f26e51d8601c08c88ade8253e4aaffcf98191af0 100755 (executable)
@@ -57,6 +57,7 @@ case $sys in
                                                ;;
                esac
                echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+               echo >>$c '#define PCI_USE_DNS'
                ;;
        sunos)
                case $cpu in
@@ -69,16 +70,19 @@ case $sys in
                                                ;;
                esac
                echo >>$c '#define PCI_HAVE_STDINT_H'
+               echo >>$c '#define PCI_USE_DNS'
                ;;
        freebsd)
                echo_n " fbsd-device"
                echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
                echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
+               echo >>$c '#define PCI_USE_DNS'
                ;;
         openbsd)
                echo_n " obsd-device"
                echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
                echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
+               echo >>$c '#define PCI_USE_DNS'
                ;;
        aix)
                echo_n " aix-device"
@@ -89,6 +93,7 @@ case $sys in
                ;;
        netbsd)
                echo_n " nbsd-libpci"
+               echo >>$c '#define PCI_USE_DNS'
                echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
                echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
                echo >>$m 'PCILIB=lib/libpciutils.a'
@@ -97,6 +102,7 @@ case $sys in
        gnu)
                echo_n " i386-ports"
                echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+               echo >>$c '#define PCI_USE_DNS'
                ;;
         *)
                echo " Unfortunately, your OS is not supported by the PCI Library"
index 2811fe46eb1391ea554f612fa14c92a2f45e0693..09f29b2ecb938e5cb0cd9d5e6d70b7a12be1be45 100644 (file)
@@ -17,6 +17,8 @@
 #include "internal.h"
 #include "names.h"
 
+#ifdef PCI_USE_DNS
+
 static const char cache_version[] = "#PCI-CACHE-1.0";
 
 int
@@ -96,13 +98,6 @@ pci_id_cache_load(struct pci_access *a, int flags)
   return 1;
 }
 
-void
-pci_id_cache_dirty(struct pci_access *a)
-{
-  if (a->id_cache_status >= 1)
-    a->id_cache_status = 2;
-}
-
 void
 pci_id_cache_flush(struct pci_access *a)
 {
@@ -149,6 +144,28 @@ pci_id_cache_flush(struct pci_access *a)
   fclose(f);
 }
 
+#else
+
+int pci_id_cache_load(struct pci_access *a UNUSED, int flags UNUSED)
+{
+  a->id_cache_status = 1;
+  return 0;
+}
+
+void pci_id_cache_flush(struct pci_access *a)
+{
+  a->id_cache_status = 0;
+}
+
+#endif
+
+void
+pci_id_cache_dirty(struct pci_access *a)
+{
+  if (a->id_cache_status >= 1)
+    a->id_cache_status = 2;
+}
+
 void
 pci_set_id_cache(struct pci_access *a, char *name, int to_be_freed)
 {
index 167cd1fb10229b489974fd9f53d395bb9ec204a8..112e1ad4af73c26fb24b19eae9b9fee7a964f659 100644 (file)
@@ -8,13 +8,16 @@
 
 #include <string.h>
 #include <stdlib.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
 
 #include "internal.h"
 #include "names.h"
 
+#ifdef PCI_USE_DNS
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
 char
 *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4)
 {
@@ -88,6 +91,15 @@ char
   return NULL;
 }
 
+#else
+
+char *pci_id_net_lookup(struct pci_access *a UNUSED, int cat UNUSED, int id1 UNUSED, int id2 UNUSED, int id3 UNUSED, int id4 UNUSED)
+{
+  return NULL;
+}
+
+#endif
+
 void
 pci_set_net_domain(struct pci_access *a, char *name, int to_be_freed)
 {