Rename interface MAC address replacement APIs

Rename ifaceReplaceMacAddress to virNetDevReplaceMacAddress
and ifaceRestoreMacAddress to virNetDevRestoreMacAddress.

* util/interface.c, util/interface.h, util/virnetdevmacvlan.c:
  Rename APIs
This commit is contained in:
Daniel P. Berrange 2011-11-02 17:38:26 +00:00
parent d2fed854c0
commit 10462d5c78
4 changed files with 19 additions and 17 deletions

View File

@ -586,8 +586,8 @@ ifaceIsVirtualFunction;
virNetDevMacVLanCreate;
virNetDevMacVLanDelete;
ifaceMacvtapLinkDump;
ifaceReplaceMacAddress;
ifaceRestoreMacAddress;
virNetDevReplaceMacAddress;
virNetDevRestoreMacAddress;
# interface_conf.h

View File

@ -554,7 +554,7 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
#endif
/**
* ifaceReplaceMacAddress:
* virNetDevReplaceMacAddress:
* @macaddress: new MAC address for interface
* @linkdev: name of interface
* @stateDir: directory to store old MAC address
@ -563,9 +563,9 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
*
*/
int
ifaceReplaceMacAddress(const unsigned char *macaddress,
const char *linkdev,
const char *stateDir)
virNetDevReplaceMacAddress(const char *linkdev,
const unsigned char *macaddress,
const char *stateDir)
{
unsigned char oldmac[6];
char *path = NULL;
@ -595,7 +595,7 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
}
/**
* ifaceRestoreMacAddress:
* virNetDevRestoreMacAddress:
* @linkdev: name of interface
* @stateDir: directory containing old MAC address
*
@ -603,8 +603,8 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
*
*/
int
ifaceRestoreMacAddress(const char *linkdev,
const char *stateDir)
virNetDevRestoreMacAddress(const char *linkdev,
const char *stateDir)
{
int rc;
char *oldmacname = NULL;

View File

@ -49,12 +49,15 @@ int ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent,
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(6);
int ifaceReplaceMacAddress(const unsigned char *macaddress,
const char *linkdev,
const char *stateDir);
int virNetDevReplaceMacAddress(const char *linkdev,
const unsigned char *macaddress,
const char *stateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
int ifaceRestoreMacAddress(const char *linkdev,
const char *stateDir);
int virNetDevRestoreMacAddress(const char *linkdev,
const char *stateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int ifaceIsVirtualFunction(const char *ifname);

View File

@ -497,9 +497,8 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
* emulate their switch in firmware.
*/
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
if (ifaceReplaceMacAddress(macaddress, linkdev, stateDir) < 0) {
if (virNetDevReplaceMacAddress(linkdev, macaddress, stateDir) < 0)
return -1;
}
}
if (tgifname) {
@ -604,7 +603,7 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
{
int ret = 0;
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
ifaceRestoreMacAddress(linkdev, stateDir);
ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir));
}
if (ifname) {