[PATCH v2 2/3] nodedev: move pci express types to virpci.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Finding virPCIE* code is more intuitive if located in virpci.h
instead of node_device_conf.h.

* src/conf/node_device_conf.h (virPCIELinkSpeed, virPCIELink)
(virPCIEDeviceInfo): Move...
* src/util/virpci.h: ...here.
* src/conf/node_device_conf.c (virPCIELinkSpeed): Likewise.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/conf/node_device_conf.c |  3 ---
 src/conf/node_device_conf.h | 29 +----------------------------
 src/util/virpci.c           |  3 +++
 src/util/virpci.h           | 30 +++++++++++++++++++++++++++++-
 4 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index ac966d3..b244a1f 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -58,9 +58,6 @@ VIR_ENUM_IMPL(virNodeDevNetCap, VIR_NODE_DEV_CAP_NET_LAST,
               "80203",
               "80211")

-VIR_ENUM_IMPL(virPCIELinkSpeed, VIR_PCIE_LINK_SPEED_LAST,
-              "", "2.5", "5", "8")
-
 static int
 virNodeDevCapsDefParseString(const char *xpath,
                              xmlXPathContextPtr ctxt,
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index b5bfb7b..fd5d179 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -1,7 +1,7 @@
 /*
  * node_device_conf.h: config handling for node devices
  *
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  * Copyright (C) 2008 Virtual Iron Software, Inc.
  * Copyright (C) 2008 David F. Lively
  *
@@ -81,33 +81,6 @@ typedef enum {
     VIR_NODE_DEV_CAP_FLAG_PCIE                      = (1 << 2),
 } virNodeDevPCICapFlags;

-typedef enum {
-    VIR_PCIE_LINK_SPEED_NA = 0,
-    VIR_PCIE_LINK_SPEED_25,
-    VIR_PCIE_LINK_SPEED_5,
-    VIR_PCIE_LINK_SPEED_8,
-    VIR_PCIE_LINK_SPEED_LAST
-} virPCIELinkSpeed;
-
-VIR_ENUM_DECL(virPCIELinkSpeed)
-
-typedef struct _virPCIELink virPCIELink;
-typedef virPCIELink *virPCIELinkPtr;
-struct _virPCIELink {
-    int port;
-    virPCIELinkSpeed speed;
-    unsigned int width;
-};
-
-typedef struct _virPCIEDeviceInfo virPCIEDeviceInfo;
-typedef virPCIEDeviceInfo *virPCIEDeviceInfoPtr;
-struct _virPCIEDeviceInfo {
-    /* Not all PCI Express devices has link. For example this 'Root Complex
-     * Integrated Endpoint' and 'Root Complex Event Collector' don't have it. */
-    virPCIELink *link_cap;   /* PCIe device link capabilities */
-    virPCIELink *link_sta;   /* Actually negotiated capabilities */
-};
-
 typedef struct _virNodeDevCapsDef virNodeDevCapsDef;
 typedef virNodeDevCapsDef *virNodeDevCapsDefPtr;
 struct _virNodeDevCapsDef {
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 6f4f6af..b7400e9 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -52,6 +52,9 @@ VIR_LOG_INIT("util.pci");
 #define PCI_ID_LEN 10   /* "XXXX XXXX" */
 #define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */

+VIR_ENUM_IMPL(virPCIELinkSpeed, VIR_PCIE_LINK_SPEED_LAST,
+              "", "2.5", "5", "8")
+
 struct _virPCIDevice {
     unsigned int  domain;
     unsigned int  bus;
diff --git a/src/util/virpci.h b/src/util/virpci.h
index d64c3e2..edec439 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -1,7 +1,7 @@
 /*
  * virpci.h: helper APIs for managing host PCI devices
  *
- * Copyright (C) 2009, 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2009, 2011-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,7 @@

 # include "internal.h"
 # include "virobject.h"
+# include "virutil.h"

 typedef struct _virPCIDevice virPCIDevice;
 typedef virPCIDevice *virPCIDevicePtr;
@@ -41,6 +42,33 @@ struct _virPCIDeviceAddress {
     unsigned int function;
 };

+typedef enum {
+    VIR_PCIE_LINK_SPEED_NA = 0,
+    VIR_PCIE_LINK_SPEED_25,
+    VIR_PCIE_LINK_SPEED_5,
+    VIR_PCIE_LINK_SPEED_8,
+    VIR_PCIE_LINK_SPEED_LAST
+} virPCIELinkSpeed;
+
+VIR_ENUM_DECL(virPCIELinkSpeed)
+
+typedef struct _virPCIELink virPCIELink;
+typedef virPCIELink *virPCIELinkPtr;
+struct _virPCIELink {
+    int port;
+    virPCIELinkSpeed speed;
+    unsigned int width;
+};
+
+typedef struct _virPCIEDeviceInfo virPCIEDeviceInfo;
+typedef virPCIEDeviceInfo *virPCIEDeviceInfoPtr;
+struct _virPCIEDeviceInfo {
+    /* Not all PCI Express devices has link. For example this 'Root Complex
+     * Integrated Endpoint' and 'Root Complex Event Collector' don't have it. */
+    virPCIELink *link_cap;   /* PCIe device link capabilities */
+    virPCIELink *link_sta;   /* Actually negotiated capabilities */
+};
+
 virPCIDevicePtr virPCIDeviceNew(unsigned int domain,
                                 unsigned int bus,
                                 unsigned int slot,
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]