Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 59 +++++++++++++++++++++++------------------------
1 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 76e3978..cdad2db 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -305,8 +305,8 @@ cleanup:
static int
-qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev,
- char **sysfs_path)
+virHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev,
+ char **sysfs_path)
{
virPCIDeviceAddress config_address;
@@ -320,12 +320,12 @@ qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev,
static int
-qemuDomainHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
+virHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
{
char *sysfs_path = NULL;
int ret = -1;
- if (qemuDomainHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
+ if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
return ret;
ret = virPCIIsVirtualFunction(sysfs_path);
@@ -337,13 +337,13 @@ qemuDomainHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
static int
-qemuDomainHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev,
- int *vf)
+virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev,
+ int *vf)
{
int ret = -1;
char *sysfs_path = NULL;
- if (qemuDomainHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
+ if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0)
return ret;
if (virPCIIsVirtualFunction(sysfs_path) == 1) {
@@ -366,11 +366,11 @@ cleanup:
static int
-qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
- virNetDevVPortProfilePtr virtPort,
- const virMacAddr *macaddr,
- const unsigned char *uuid,
- bool associate)
+virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
+ virNetDevVPortProfilePtr virtPort,
+ const virMacAddr *macaddr,
+ const unsigned char *uuid,
+ bool associate)
{
int ret = -1;
@@ -406,9 +406,9 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int
vf,
static int
-qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
- const unsigned char *uuid,
- char *stateDir)
+virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
+ const unsigned char *uuid,
+ char *stateDir)
{
char *linkdev = NULL;
virNetDevVlanPtr vlan;
@@ -419,7 +419,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
bool port_profile_associate = true;
int isvf;
- isvf = qemuDomainHostdevIsVirtualFunction(hostdev);
+ isvf = virHostdevIsVirtualFunction(hostdev);
if (isvf <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Interface type hostdev is currently supported on"
@@ -427,7 +427,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
return ret;
}
- if (qemuDomainHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
+ if (virHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
return ret;
vlan = virDomainNetGetActualVlan(hostdev->parent.data.net);
@@ -441,7 +441,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
virNetDevVPortTypeToString(virtPort->virtPortType));
goto cleanup;
}
- ret = qemuDomainHostdevNetConfigVirtPortProfile(linkdev, vf,
+ ret = virHostdevNetConfigVirtPortProfile(linkdev, vf,
virtPort, &hostdev->parent.data.net->mac, uuid,
port_profile_associate);
} else {
@@ -481,9 +481,9 @@ cleanup:
* case, try to find in the old state dir.
*/
static int
-qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
- char *stateDir,
- char *oldStateDir)
+virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
+ char *stateDir,
+ char *oldStateDir)
{
char *linkdev = NULL;
virNetDevVPortProfilePtr virtPort;
@@ -501,7 +501,7 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
!hostdev->parent.data.net)
return 0;
- isvf = qemuDomainHostdevIsVirtualFunction(hostdev);
+ isvf = virHostdevIsVirtualFunction(hostdev);
if (isvf <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Interface type hostdev is currently supported on"
@@ -509,13 +509,13 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
return ret;
}
- if (qemuDomainHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
+ if (virHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
return ret;
virtPort = virDomainNetGetActualVirtPortProfile(
hostdev->parent.data.net);
if (virtPort)
- ret = qemuDomainHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort,
+ ret = virHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort,
&hostdev->parent.data.net->mac,
NULL,
port_profile_associate);
else {
@@ -754,8 +754,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
continue;
if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
hostdev->parent.data.net) {
- if (qemuDomainHostdevNetConfigReplace(hostdev, uuid,
- hostdev_mgr->stateDir) < 0) {
+ if (virHostdevNetConfigReplace(hostdev, uuid,
+ hostdev_mgr->stateDir) < 0) {
goto resetvfnetconfig;
}
}
@@ -839,8 +839,7 @@ inactivedevs:
resetvfnetconfig:
for (i = 0;
last_processed_hostdev_vf != -1 && i < last_processed_hostdev_vf;
i++)
- qemuDomainHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir,
- NULL);
+ virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, NULL);
reattachdevs:
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
@@ -1363,8 +1362,8 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
* reset and reattach device
*/
for (i = 0; i < nhostdevs; i++)
- qemuDomainHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir,
- oldStateDir);
+ virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir,
+ oldStateDir);
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
--
1.6.0.2