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; virNetDevMacVLanCreate;
virNetDevMacVLanDelete; virNetDevMacVLanDelete;
ifaceMacvtapLinkDump; ifaceMacvtapLinkDump;
ifaceReplaceMacAddress; virNetDevReplaceMacAddress;
ifaceRestoreMacAddress; virNetDevRestoreMacAddress;
# interface_conf.h # interface_conf.h

View File

@ -554,7 +554,7 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
#endif #endif
/** /**
* ifaceReplaceMacAddress: * virNetDevReplaceMacAddress:
* @macaddress: new MAC address for interface * @macaddress: new MAC address for interface
* @linkdev: name of interface * @linkdev: name of interface
* @stateDir: directory to store old MAC address * @stateDir: directory to store old MAC address
@ -563,9 +563,9 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
* *
*/ */
int int
ifaceReplaceMacAddress(const unsigned char *macaddress, virNetDevReplaceMacAddress(const char *linkdev,
const char *linkdev, const unsigned char *macaddress,
const char *stateDir) const char *stateDir)
{ {
unsigned char oldmac[6]; unsigned char oldmac[6];
char *path = NULL; char *path = NULL;
@ -595,7 +595,7 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
} }
/** /**
* ifaceRestoreMacAddress: * virNetDevRestoreMacAddress:
* @linkdev: name of interface * @linkdev: name of interface
* @stateDir: directory containing old MAC address * @stateDir: directory containing old MAC address
* *
@ -603,8 +603,8 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
* *
*/ */
int int
ifaceRestoreMacAddress(const char *linkdev, virNetDevRestoreMacAddress(const char *linkdev,
const char *stateDir) const char *stateDir)
{ {
int rc; int rc;
char *oldmacname = NULL; 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(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(6); ATTRIBUTE_NONNULL(6);
int ifaceReplaceMacAddress(const unsigned char *macaddress, int virNetDevReplaceMacAddress(const char *linkdev,
const char *linkdev, const unsigned char *macaddress,
const char *stateDir); const char *stateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
int ifaceRestoreMacAddress(const char *linkdev, int virNetDevRestoreMacAddress(const char *linkdev,
const char *stateDir); const char *stateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int ifaceIsVirtualFunction(const char *ifname); int ifaceIsVirtualFunction(const char *ifname);

View File

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