From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> Rename ifaceIsVirtualFunction to virNetDevIsVirtualFunction, ifaceGetVirtualFunctionIndex to virNetDevGetVirtualFunctionIndex and ifaceGetPhysicalFunction to virNetDevGetPhysicalFunction * src/util/interface.c, src/util/interface.h: Rename APIs * src/util/virnetdevvportprofile.c: Update for API rename --- src/libvirt_private.syms | 6 ++-- src/util/interface.c | 54 +++++++++++++++++-------------------- src/util/interface.h | 12 +++++--- src/util/virnetdevvportprofile.c | 6 ++-- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6b7e231..8f58105 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -579,10 +579,10 @@ virNetDevValidateConfig; virNetDevGetIndex; virNetDevGetIPv4Address; ifaceGetNthParent; -ifaceGetPhysicalFunction; -ifaceGetVirtualFunctionIndex; +virNetDevGetPhysicalFunction; +virNetDevGetVirtualFunctionIndex; virNetDevGetVLanID; -ifaceIsVirtualFunction; +virNetDevIsVirtualFunction; virNetDevMacVLanCreate; virNetDevMacVLanDelete; ifaceMacvtapLinkDump; diff --git a/src/util/interface.c b/src/util/interface.c index 8264e7c..2882511 100644 --- a/src/util/interface.c +++ b/src/util/interface.c @@ -299,7 +299,7 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED, #ifdef __linux__ static int -ifaceSysfsFile(char **pf_sysfs_device_link, const char *ifname, +virNetDevSysfsFile(char **pf_sysfs_device_link, const char *ifname, const char *file) { @@ -313,7 +313,7 @@ ifaceSysfsFile(char **pf_sysfs_device_link, const char *ifname, } static int -ifaceSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname, +virNetDevSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname, const char *file) { @@ -327,8 +327,7 @@ ifaceSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname, } /** - * ifaceIsVirtualFunction - * + * virNetDevIsVirtualFunction: * @ifname : name of the interface * * Checks if an interface is a SRIOV virtual function. @@ -337,12 +336,12 @@ ifaceSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname, * */ int -ifaceIsVirtualFunction(const char *ifname) +virNetDevIsVirtualFunction(const char *ifname) { char *if_sysfs_device_link = NULL; int ret = -1; - if (ifaceSysfsFile(&if_sysfs_device_link, ifname, "device") < 0) + if (virNetDevSysfsFile(&if_sysfs_device_link, ifname, "device") < 0) return ret; ret = pciDeviceIsVirtualFunction(if_sysfs_device_link); @@ -353,7 +352,7 @@ ifaceIsVirtualFunction(const char *ifname) } /** - * ifaceGetVirtualFunctionIndex + * virNetDevGetVirtualFunctionIndex * * @pfname : name of the physical function interface name * @vfname : name of the virtual function interface name @@ -364,16 +363,16 @@ ifaceIsVirtualFunction(const char *ifname) * */ int -ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname, - int *vf_index) +virNetDevGetVirtualFunctionIndex(const char *pfname, const char *vfname, + int *vf_index) { char *pf_sysfs_device_link = NULL, *vf_sysfs_device_link = NULL; int ret = -1; - if (ifaceSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) + if (virNetDevSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) return ret; - if (ifaceSysfsFile(&vf_sysfs_device_link, vfname, "device") < 0) { + if (virNetDevSysfsFile(&vf_sysfs_device_link, vfname, "device") < 0) { VIR_FREE(pf_sysfs_device_link); return ret; } @@ -389,7 +388,7 @@ ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname, } /** - * ifaceGetPhysicalFunction + * virNetDevGetPhysicalFunction * * @ifname : name of the physical function interface name * @pfname : Contains sriov physical function for interface ifname @@ -399,12 +398,12 @@ ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname, * */ int -ifaceGetPhysicalFunction(const char *ifname, char **pfname) +virNetDevGetPhysicalFunction(const char *ifname, char **pfname) { char *physfn_sysfs_path = NULL; int ret = -1; - if (ifaceSysfsDeviceFile(&physfn_sysfs_path, ifname, "physfn") < 0) + if (virNetDevSysfsDeviceFile(&physfn_sysfs_path, ifname, "physfn") < 0) return ret; ret = pciDeviceNetName(physfn_sysfs_path, pfname); @@ -413,34 +412,31 @@ ifaceGetPhysicalFunction(const char *ifname, char **pfname) return ret; } -#else +#else /* !__linux__ */ int -ifaceIsVirtualFunction(const char *ifname ATTRIBUTE_UNUSED) +virNetDevIsVirtualFunction(const char *ifname ATTRIBUTE_UNUSED) { - ifaceError(VIR_ERR_INTERNAL_ERROR, "%s", - _("ifaceIsVirtualFunction is not supported on non-linux " - "platforms")); + virReportSystemError(ENOSYS, "%s", + _("Unable to check virtual function status on this platfornm")); return -1; } int -ifaceGetVirtualFunctionIndex(const char *pfname ATTRIBUTE_UNUSED, +virNetDevGetVirtualFunctionIndex(const char *pfname ATTRIBUTE_UNUSED, const char *vfname ATTRIBUTE_UNUSED, int *vf_index ATTRIBUTE_UNUSED) { - ifaceError(VIR_ERR_INTERNAL_ERROR, "%s", - _("ifaceGetVirtualFunctionIndex is not supported on non-linux " - "platforms")); + virReportSystemError(ENOSYS, "%s", + _("Unable to get virtual function index on this platfornm")); return -1; } int -ifaceGetPhysicalFunction(const char *ifname ATTRIBUTE_UNUSED, - char **pfname ATTRIBUTE_UNUSED) +virNetDevGetPhysicalFunction(const char *ifname ATTRIBUTE_UNUSED, + char **pfname ATTRIBUTE_UNUSED) { - ifaceError(VIR_ERR_INTERNAL_ERROR, "%s", - _("ifaceGetPhysicalFunction is not supported on non-linux " - "platforms")); + virReportSystemError(ENOSYS, "%s", + _("Unable to get physical function status on this platfornm")); return -1; } -#endif /* __linux__ */ +#endif /* !__linux__ */ diff --git a/src/util/interface.h b/src/util/interface.h index 4256f29..86f9aac 100644 --- a/src/util/interface.h +++ b/src/util/interface.h @@ -40,11 +40,15 @@ int ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent, ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6); -int ifaceIsVirtualFunction(const char *ifname); +int virNetDevIsVirtualFunction(const char *ifname) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; -int ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname, - int *vf_index); +int virNetDevGetVirtualFunctionIndex(const char *pfname, const char *vfname, + int *vf_index) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) + ATTRIBUTE_RETURN_CHECK; -int ifaceGetPhysicalFunction(const char *ifname, char **pfname); +int virNetDevGetPhysicalFunction(const char *ifname, char **pfname) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; #endif /* __VIR_INTERFACE_H__ */ diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index 3649033..dbf1cf4 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -630,13 +630,13 @@ virNetDevVPortProfileGetPhysfnDev(const char *linkdev, { int rc = -1; - if (ifaceIsVirtualFunction(linkdev) == 1) { + if (virNetDevIsVirtualFunction(linkdev) == 1) { /* if linkdev is SR-IOV VF, then set vf = VF index */ /* and set linkdev = PF device */ - rc = ifaceGetPhysicalFunction(linkdev, physfndev); + rc = virNetDevGetPhysicalFunction(linkdev, physfndev); if (!rc) - rc = ifaceGetVirtualFunctionIndex(*physfndev, linkdev, vf); + rc = virNetDevGetVirtualFunctionIndex(*physfndev, linkdev, vf); } else { /* Not SR-IOV VF: physfndev is linkdev and VF index -- 1.7.6.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list