]> xenbits.xensource.com Git - xen.git/commitdiff
vpci: do not expose unneeded functions to the user-space test harness
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 22 Mar 2018 14:00:00 +0000 (15:00 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Mar 2018 09:27:50 +0000 (10:27 +0100)
Some functions in vpci.c (vpci_remove_device and vpci_add_handlers)
are not used by the user-space test harness, so guard them with
__XEN__ in order to avoid exposing them to the user-space test
harness.

Requested-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/vpci/Makefile
xen/drivers/vpci/vpci.c
xen/include/xen/vpci.h

index e45fcb5cd90b37d95b8854f5466c4a7ad6577aa1..5075bc2be28cb2317a75ab082d2128bb436188f3 100644 (file)
@@ -24,12 +24,8 @@ distclean: clean
 install:
 
 vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c
-       # Trick the compiler so it doesn't complain about missing symbols
-       sed -e '/#include/d' \
-           -e '1s;^;#include "emul.h"\
-                    vpci_register_init_t *const __start_vpci_array[1]\;\
-                    vpci_register_init_t *const __end_vpci_array[1]\;\
-                    ;' <$< >$@
+       # Remove includes and add the test harness header
+       sed -e '/#include/d' -e '1s/^/#include "emul.h"/' <$< >$@
 
 list.h: $(XEN_ROOT)/xen/include/xen/list.h
 vpci.h: $(XEN_ROOT)/xen/include/xen/vpci.h
index 8ec9c916eaf42692c839aeaa725d8ada752c0eae..2913b56500f186014a2775ed79f43ea3bf286df5 100644 (file)
 #include <xen/sched.h>
 #include <xen/vpci.h>
 
-extern vpci_register_init_t *const __start_vpci_array[];
-extern vpci_register_init_t *const __end_vpci_array[];
-#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
-
 /* Internal struct to store the emulated PCI registers. */
 struct vpci_register {
     vpci_read_t *read;
@@ -34,6 +30,11 @@ struct vpci_register {
     struct list_head node;
 };
 
+#ifdef __XEN__
+extern vpci_register_init_t *const __start_vpci_array[];
+extern vpci_register_init_t *const __end_vpci_array[];
+#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
+
 void vpci_remove_device(struct pci_dev *pdev)
 {
     spin_lock(&pdev->vpci->lock);
@@ -80,6 +81,7 @@ int __hwdom_init vpci_add_handlers(struct pci_dev *pdev)
 
     return rc;
 }
+#endif /* __XEN__ */
 
 static int vpci_register_cmp(const struct vpci_register *r1,
                              const struct vpci_register *r2)
index fc47163ba66a18e0783d857c1776286f668bac13..cb39e0ebea91240cbbf8aa3530cb32df09b84641 100644 (file)
@@ -90,11 +90,9 @@ struct vpci {
         bool rom_enabled      : 1;
         /* FIXME: currently there's no support for SR-IOV. */
     } header;
-#endif
 
     /* MSI data. */
     struct vpci_msi {
-#ifdef __XEN__
       /* Address. */
         uint64_t address;
         /* Mask bitfield. */
@@ -113,12 +111,10 @@ struct vpci {
         uint8_t vectors     : 5;
         /* Arch-specific data. */
         struct vpci_arch_msi arch;
-#endif
     } *msi;
 
     /* MSI-X data. */
     struct vpci_msix {
-#ifdef __XEN__
         struct pci_dev *pdev;
         /* List link. */
         struct list_head next;
@@ -141,8 +137,8 @@ struct vpci {
             bool updated : 1;
             struct vpci_arch_msix_entry arch;
         } entries[];
-#endif
     } *msix;
+#endif
 };
 
 struct vpci_vcpu {