On Tue, Nov 29, 2011 at 03:48:29PM +0000, Shradha Shah wrote:
--- src/util/pci.c | 35 ----------------------------------- src/util/pci.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c index cd82b43..857078d 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -45,45 +45,10 @@ # define MODPROBE "modprobe" #endif
-#define PCI_SYSFS "/sys/bus/pci/" -#define PCI_ID_LEN 10 /* "XXXX XXXX" */ -#define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */ - #define SRIOV_FOUND 0 #define SRIOV_NOT_FOUND 1 #define SRIOV_ERROR -1
-struct _pciDevice { - unsigned domain; - unsigned bus; - unsigned slot; - unsigned function; - - char name[PCI_ADDR_LEN]; /* domain:bus:slot.function */ - char id[PCI_ID_LEN]; /* product vendor */ - char *path; - const char *used_by; /* The domain which uses the device */ - int fd; - - unsigned initted; - unsigned pcie_cap_pos; - unsigned pci_pm_cap_pos; - unsigned has_flr : 1; - unsigned has_pm_reset : 1; - unsigned managed : 1; - - /* used by reattach function */ - unsigned unbind_from_stub : 1; - unsigned remove_slot : 1; - unsigned reprobe : 1; -}; - -struct _pciDeviceList { - unsigned count; - pciDevice **devs; -}; - - /* For virReportOOMError() and virReportSystemError() */ #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/pci.h b/src/util/pci.h index 76e37e3..8e47fc2 100644 --- a/src/util/pci.h +++ b/src/util/pci.h @@ -24,9 +24,43 @@
# include "internal.h"
+#define PCI_SYSFS "/sys/bus/pci/" +#define PCI_ID_LEN 10 /* "XXXX XXXX" */ +#define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */ + typedef struct _pciDevice pciDevice; typedef struct _pciDeviceList pciDeviceList;
+struct _pciDevice { + unsigned domain; + unsigned bus; + unsigned slot; + unsigned function; + + char name[PCI_ADDR_LEN]; /* domain:bus:slot.function */ + char id[PCI_ID_LEN]; /* product vendor */ + char *path; + const char *used_by; /* The domain which uses the device */ + int fd; + + unsigned initted; + unsigned pcie_cap_pos; + unsigned pci_pm_cap_pos; + unsigned has_flr : 1; + unsigned has_pm_reset : 1; + unsigned managed : 1; + + /* used by reattach function */ + unsigned unbind_from_stub : 1; + unsigned remove_slot : 1; + unsigned reprobe : 1; +}; + +struct _pciDeviceList { + unsigned count; + pciDevice **devs; +};
I could have misread something, but looking at the following 4 patches, I don't see any code which requires direct access to the internals of the 'struct pciDevice' type. If there is such a need I've missed, then it would be desirable to just add more setter/getter APIs in the pci.h, and keep 'struct pciDevice' private to pci.c Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|