You need to sign in or sign up before continuing.
提交 228a9ec3 编写于 作者: R Roopa Prabhu 提交者: Eric Blake

macvtap: Fix error return value convention/inconsistencies

- changed some return 1's to return -1
- changed if (rc) error checks to if (rc < 0)
- fixed some other minor convention violations

I might have missed some. Can fix in another patch or can respin
Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
Reported-by: NEric Blake <eblake@redhat.com>
Reported-by: NLaine Stump <laine@laine.org>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 7e020766
...@@ -2527,7 +2527,7 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) { ...@@ -2527,7 +2527,7 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) {
virDomainNetGetActualDirectDev(net), virDomainNetGetActualDirectDev(net),
virDomainNetGetActualDirectVirtPortProfile(net), virDomainNetGetActualDirectVirtPortProfile(net),
def->uuid, def->uuid,
VIR_VM_OP_MIGRATE_IN_FINISH) != 0) VIR_VM_OP_MIGRATE_IN_FINISH) < 0)
goto err_exit; goto err_exit;
} }
last_good_net = i; last_good_net = i;
......
...@@ -1016,7 +1016,7 @@ ifaceMacvtapLinkDump(bool nltarget_kernel ATTRIBUTE_UNUSED, ...@@ -1016,7 +1016,7 @@ ifaceMacvtapLinkDump(bool nltarget_kernel ATTRIBUTE_UNUSED,
* Get the nth parent interface of the given interface. 0 is the interface * Get the nth parent interface of the given interface. 0 is the interface
* itself. * itself.
* *
* Return 0 on success, != 0 otherwise * Return 0 on success, < 0 otherwise
*/ */
#if defined(__linux__) && WITH_MACVTAP #if defined(__linux__) && WITH_MACVTAP
int int
...@@ -1037,7 +1037,7 @@ ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent, ...@@ -1037,7 +1037,7 @@ ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent,
while (!end && i <= nthParent) { while (!end && i <= nthParent) {
rc = ifaceMacvtapLinkDump(true, ifname, ifindex, tb, &recvbuf, NULL); rc = ifaceMacvtapLinkDump(true, ifname, ifindex, tb, &recvbuf, NULL);
if (rc) if (rc < 0)
break; break;
if (tb[IFLA_IFNAME]) { if (tb[IFLA_IFNAME]) {
...@@ -1244,7 +1244,7 @@ ifaceIsVirtualFunction(const char *ifname) ...@@ -1244,7 +1244,7 @@ ifaceIsVirtualFunction(const char *ifname)
char *if_sysfs_device_link = NULL; char *if_sysfs_device_link = NULL;
int ret = -1; int ret = -1;
if (ifaceSysfsFile(&if_sysfs_device_link, ifname, "device")) if (ifaceSysfsFile(&if_sysfs_device_link, ifname, "device") < 0)
return ret; return ret;
ret = pciDeviceIsVirtualFunction(if_sysfs_device_link); ret = pciDeviceIsVirtualFunction(if_sysfs_device_link);
...@@ -1272,10 +1272,10 @@ ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname, ...@@ -1272,10 +1272,10 @@ ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname,
char *pf_sysfs_device_link = NULL, *vf_sysfs_device_link = NULL; char *pf_sysfs_device_link = NULL, *vf_sysfs_device_link = NULL;
int ret = -1; int ret = -1;
if (ifaceSysfsFile(&pf_sysfs_device_link, pfname, "device")) if (ifaceSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0)
return ret; return ret;
if (ifaceSysfsFile(&vf_sysfs_device_link, vfname, "device")) { if (ifaceSysfsFile(&vf_sysfs_device_link, vfname, "device") < 0) {
VIR_FREE(pf_sysfs_device_link); VIR_FREE(pf_sysfs_device_link);
return ret; return ret;
} }
...@@ -1306,7 +1306,7 @@ ifaceGetPhysicalFunction(const char *ifname, char **pfname) ...@@ -1306,7 +1306,7 @@ ifaceGetPhysicalFunction(const char *ifname, char **pfname)
char *physfn_sysfs_path = NULL; char *physfn_sysfs_path = NULL;
int ret = -1; int ret = -1;
if (ifaceSysfsDeviceFile(&physfn_sysfs_path, ifname, "physfn")) if (ifaceSysfsDeviceFile(&physfn_sysfs_path, ifname, "physfn") < 0)
return ret; return ret;
ret = pciDeviceNetName(physfn_sysfs_path, pfname); ret = pciDeviceNetName(physfn_sysfs_path, pfname);
......
...@@ -210,8 +210,11 @@ configMacvtapTap(int tapfd, int vnet_hdr) ...@@ -210,8 +210,11 @@ configMacvtapTap(int tapfd, int vnet_hdr)
rc_on_fail = -1; rc_on_fail = -1;
errmsg = _("cannot clean IFF_VNET_HDR flag on macvtap tap"); errmsg = _("cannot clean IFF_VNET_HDR flag on macvtap tap");
} else if ((ifreq.ifr_flags & IFF_VNET_HDR) == 0 && vnet_hdr) { } else if ((ifreq.ifr_flags & IFF_VNET_HDR) == 0 && vnet_hdr) {
if (ioctl(tapfd, TUNGETFEATURES, &features) != 0) if (ioctl(tapfd, TUNGETFEATURES, &features) < 0) {
return errno; virReportSystemError(errno, "%s",
_("cannot get feature flags on macvtap tap"));
return -1;
}
if ((features & IFF_VNET_HDR)) { if ((features & IFF_VNET_HDR)) {
new_flags = ifreq.ifr_flags | IFF_VNET_HDR; new_flags = ifreq.ifr_flags | IFF_VNET_HDR;
errmsg = _("cannot set IFF_VNET_HDR flag on macvtap tap"); errmsg = _("cannot set IFF_VNET_HDR flag on macvtap tap");
...@@ -292,7 +295,7 @@ openMacvtapTap(const char *tgifname, ...@@ -292,7 +295,7 @@ openMacvtapTap(const char *tgifname,
* emulate their switch in firmware. * emulate their switch in firmware.
*/ */
if (mode == VIR_MACVTAP_MODE_PASSTHRU) { if (mode == VIR_MACVTAP_MODE_PASSTHRU) {
if (ifaceReplaceMacAddress(macaddress, linkdev, stateDir) != 0) { if (ifaceReplaceMacAddress(macaddress, linkdev, stateDir) < 0) {
return -1; return -1;
} }
} }
...@@ -335,7 +338,7 @@ create_name: ...@@ -335,7 +338,7 @@ create_name:
macaddress, macaddress,
linkdev, linkdev,
virtPortProfile, virtPortProfile,
vmuuid, vmOp) != 0) { vmuuid, vmOp) < 0) {
rc = -1; rc = -1;
goto link_del_exit; goto link_del_exit;
} }
...@@ -352,7 +355,6 @@ create_name: ...@@ -352,7 +355,6 @@ create_name:
} }
rc = openTap(cr_ifname, 10); rc = openTap(cr_ifname, 10);
if (rc >= 0) { if (rc >= 0) {
if (configMacvtapTap(rc, vnet_hdr) < 0) { if (configMacvtapTap(rc, vnet_hdr) < 0) {
VIR_FORCE_CLOSE(rc); /* sets rc to -1 */ VIR_FORCE_CLOSE(rc); /* sets rc to -1 */
...@@ -471,7 +473,7 @@ getLldpadPid(void) { ...@@ -471,7 +473,7 @@ getLldpadPid(void) {
* status: pointer to a uint16 where the status will be written into * status: pointer to a uint16 where the status will be written into
* *
* Get the status from the IFLA_PORT_RESPONSE field; Returns 0 in * Get the status from the IFLA_PORT_RESPONSE field; Returns 0 in
* case of success, != 0 otherwise with error having been reported * case of success, < 0 otherwise with error having been reported
*/ */
static int static int
getPortProfileStatus(struct nlattr **tb, int32_t vf, getPortProfileStatus(struct nlattr **tb, int32_t vf,
...@@ -480,7 +482,7 @@ getPortProfileStatus(struct nlattr **tb, int32_t vf, ...@@ -480,7 +482,7 @@ getPortProfileStatus(struct nlattr **tb, int32_t vf,
bool is8021Qbg, bool is8021Qbg,
uint16_t *status) uint16_t *status)
{ {
int rc = 1; int rc = -1;
const char *msg = NULL; const char *msg = NULL;
struct nlattr *tb_port[IFLA_PORT_MAX + 1] = { NULL, }; struct nlattr *tb_port[IFLA_PORT_MAX + 1] = { NULL, };
...@@ -572,7 +574,7 @@ doPortProfileOpSetLink(bool nltarget_kernel, ...@@ -572,7 +574,7 @@ doPortProfileOpSetLink(bool nltarget_kernel,
int32_t vf, int32_t vf,
uint8_t op) uint8_t op)
{ {
int rc = 0; int rc = -1;
struct nlmsghdr *resp; struct nlmsghdr *resp;
struct nlmsgerr *err; struct nlmsgerr *err;
struct ifinfomsg ifinfo = { struct ifinfomsg ifinfo = {
...@@ -588,7 +590,7 @@ doPortProfileOpSetLink(bool nltarget_kernel, ...@@ -588,7 +590,7 @@ doPortProfileOpSetLink(bool nltarget_kernel,
nl_msg = nlmsg_alloc_simple(RTM_SETLINK, NLM_F_REQUEST); nl_msg = nlmsg_alloc_simple(RTM_SETLINK, NLM_F_REQUEST);
if (!nl_msg) { if (!nl_msg) {
virReportOOMError(); virReportOOMError();
return -1; return rc;
} }
if (nlmsg_append(nl_msg, &ifinfo, sizeof(ifinfo), NLMSG_ALIGNTO) < 0) if (nlmsg_append(nl_msg, &ifinfo, sizeof(ifinfo), NLMSG_ALIGNTO) < 0)
...@@ -690,16 +692,12 @@ doPortProfileOpSetLink(bool nltarget_kernel, ...@@ -690,16 +692,12 @@ doPortProfileOpSetLink(bool nltarget_kernel,
if (!nltarget_kernel) { if (!nltarget_kernel) {
pid = getLldpadPid(); pid = getLldpadPid();
if (pid == 0) { if (pid == 0)
rc = -1;
goto err_exit; goto err_exit;
} }
}
if (nlComm(nl_msg, &recvbuf, &recvbuflen, pid) < 0) { if (nlComm(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
rc = -1;
goto err_exit; goto err_exit;
}
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL) if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
goto malformed_resp; goto malformed_resp;
...@@ -716,7 +714,7 @@ doPortProfileOpSetLink(bool nltarget_kernel, ...@@ -716,7 +714,7 @@ doPortProfileOpSetLink(bool nltarget_kernel,
virReportSystemError(-err->error, virReportSystemError(-err->error,
_("error during virtual port configuration of ifindex %d"), _("error during virtual port configuration of ifindex %d"),
ifindex); ifindex);
rc = -1; goto err_exit;
} }
break; break;
...@@ -727,6 +725,8 @@ doPortProfileOpSetLink(bool nltarget_kernel, ...@@ -727,6 +725,8 @@ doPortProfileOpSetLink(bool nltarget_kernel,
goto malformed_resp; goto malformed_resp;
} }
rc = 0;
err_exit: err_exit:
nlmsg_free(nl_msg); nlmsg_free(nl_msg);
...@@ -740,17 +740,18 @@ malformed_resp: ...@@ -740,17 +740,18 @@ malformed_resp:
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message")); _("malformed netlink response message"));
VIR_FREE(recvbuf); VIR_FREE(recvbuf);
return -1; return rc;
buffer_too_small: buffer_too_small:
nlmsg_free(nl_msg); nlmsg_free(nl_msg);
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small")); _("allocated netlink buffer is too small"));
return -1; return rc;
} }
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int static int
doPortProfileOpCommon(bool nltarget_kernel, doPortProfileOpCommon(bool nltarget_kernel,
const char *ifname, int ifindex, const char *ifname, int ifindex,
...@@ -780,8 +781,7 @@ doPortProfileOpCommon(bool nltarget_kernel, ...@@ -780,8 +781,7 @@ doPortProfileOpCommon(bool nltarget_kernel,
hostUUID, hostUUID,
vf, vf,
op); op);
if (rc < 0) {
if (rc) {
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("sending of PortProfileRequest failed.")); _("sending of PortProfileRequest failed."));
return rc; return rc;
...@@ -790,11 +790,12 @@ doPortProfileOpCommon(bool nltarget_kernel, ...@@ -790,11 +790,12 @@ doPortProfileOpCommon(bool nltarget_kernel,
while (--repeats >= 0) { while (--repeats >= 0) {
rc = ifaceMacvtapLinkDump(nltarget_kernel, NULL, ifindex, tb, rc = ifaceMacvtapLinkDump(nltarget_kernel, NULL, ifindex, tb,
&recvbuf, getLldpadPid); &recvbuf, getLldpadPid);
if (rc) if (rc < 0)
goto err_exit; goto err_exit;
rc = getPortProfileStatus(tb, vf, instanceId, nltarget_kernel, rc = getPortProfileStatus(tb, vf, instanceId, nltarget_kernel,
is8021Qbg, &status); is8021Qbg, &status);
if (rc) if (rc < 0)
goto err_exit; goto err_exit;
if (status == PORT_PROFILE_RESPONSE_SUCCESS || if (status == PORT_PROFILE_RESPONSE_SUCCESS ||
status == PORT_VDP_RESPONSE_SUCCESS) { status == PORT_VDP_RESPONSE_SUCCESS) {
...@@ -806,7 +807,7 @@ doPortProfileOpCommon(bool nltarget_kernel, ...@@ -806,7 +807,7 @@ doPortProfileOpCommon(bool nltarget_kernel,
_("error %d during port-profile setlink on " _("error %d during port-profile setlink on "
"interface %s (%d)"), "interface %s (%d)"),
status, ifname, ifindex); status, ifname, ifindex);
rc = 1; rc = -1;
break; break;
} }
...@@ -818,7 +819,7 @@ doPortProfileOpCommon(bool nltarget_kernel, ...@@ -818,7 +819,7 @@ doPortProfileOpCommon(bool nltarget_kernel,
if (status == PORT_PROFILE_RESPONSE_INPROGRESS) { if (status == PORT_PROFILE_RESPONSE_INPROGRESS) {
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("port-profile setlink timed out")); _("port-profile setlink timed out"));
rc = -ETIMEDOUT; rc = -2;
} }
err_exit: err_exit:
...@@ -843,7 +844,7 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname, ...@@ -843,7 +844,7 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname,
*vlanid = -1; *vlanid = -1;
while (1) { while (1) {
if ((ret = ifaceGetNthParent(ifindex, ifname, 1, if ((ret = ifaceGetNthParent(ifindex, ifname, 1,
root_ifindex, root_ifname, &nth))) root_ifindex, root_ifname, &nth)) < 0)
return ret; return ret;
if (nth == 0) if (nth == 0)
break; break;
...@@ -861,13 +862,14 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname, ...@@ -861,13 +862,14 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname,
# endif # endif
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int static int
doPortProfileOp8021Qbg(const char *ifname, doPortProfileOp8021Qbg(const char *ifname,
const unsigned char *macaddr, const unsigned char *macaddr,
const virVirtualPortProfileParamsPtr virtPort, const virVirtualPortProfileParamsPtr virtPort,
enum virVirtualPortOp virtPortOp) enum virVirtualPortOp virtPortOp)
{ {
int rc; int rc = 0;
# ifndef IFLA_VF_PORT_MAX # ifndef IFLA_VF_PORT_MAX
...@@ -877,7 +879,7 @@ doPortProfileOp8021Qbg(const char *ifname, ...@@ -877,7 +879,7 @@ doPortProfileOp8021Qbg(const char *ifname,
(void)virtPortOp; (void)virtPortOp;
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Kernel VF Port support was missing at compile time.")); _("Kernel VF Port support was missing at compile time."));
rc = 1; rc = -1;
# else /* IFLA_VF_PORT_MAX */ # else /* IFLA_VF_PORT_MAX */
...@@ -893,8 +895,8 @@ doPortProfileOp8021Qbg(const char *ifname, ...@@ -893,8 +895,8 @@ doPortProfileOp8021Qbg(const char *ifname,
int vf = PORT_SELF_VF; int vf = PORT_SELF_VF;
if (getPhysdevAndVlan(ifname, &physdev_ifindex, physdev_ifname, if (getPhysdevAndVlan(ifname, &physdev_ifindex, physdev_ifname,
&vlanid) != 0) { &vlanid) < 0) {
rc = 1; rc = -1;
goto err_exit; goto err_exit;
} }
...@@ -918,7 +920,7 @@ doPortProfileOp8021Qbg(const char *ifname, ...@@ -918,7 +920,7 @@ doPortProfileOp8021Qbg(const char *ifname,
default: default:
macvtapError(VIR_ERR_INTERNAL_ERROR, macvtapError(VIR_ERR_INTERNAL_ERROR,
_("operation type %d not supported"), virtPortOp); _("operation type %d not supported"), virtPortOp);
rc = 1; rc = -1;
goto err_exit; goto err_exit;
} }
...@@ -947,10 +949,9 @@ getPhysfnDev(const char *linkdev, ...@@ -947,10 +949,9 @@ getPhysfnDev(const char *linkdev,
int32_t *vf, int32_t *vf,
char **physfndev) char **physfndev)
{ {
int rc = 0; int rc = -1;
if (ifaceIsVirtualFunction(linkdev)) {
if (ifaceIsVirtualFunction(linkdev) == 1) {
/* if linkdev is SR-IOV VF, then set vf = VF index */ /* if linkdev is SR-IOV VF, then set vf = VF index */
/* and set linkdev = PF device */ /* and set linkdev = PF device */
...@@ -967,14 +968,18 @@ getPhysfnDev(const char *linkdev, ...@@ -967,14 +968,18 @@ getPhysfnDev(const char *linkdev,
*physfndev = strdup(linkdev); *physfndev = strdup(linkdev);
if (!*physfndev) { if (!*physfndev) {
virReportOOMError(); virReportOOMError();
rc = -1; goto err_exit;
} }
rc = 0;
} }
err_exit:
return rc; return rc;
} }
# endif /* IFLA_VF_PORT_MAX */ # endif /* IFLA_VF_PORT_MAX */
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int static int
doPortProfileOp8021Qbh(const char *ifname, doPortProfileOp8021Qbh(const char *ifname,
const unsigned char *macaddr, const unsigned char *macaddr,
...@@ -982,7 +987,7 @@ doPortProfileOp8021Qbh(const char *ifname, ...@@ -982,7 +987,7 @@ doPortProfileOp8021Qbh(const char *ifname,
const unsigned char *vm_uuid, const unsigned char *vm_uuid,
enum virVirtualPortOp virtPortOp) enum virVirtualPortOp virtPortOp)
{ {
int rc; int rc = 0;
# ifndef IFLA_VF_PORT_MAX # ifndef IFLA_VF_PORT_MAX
...@@ -993,7 +998,7 @@ doPortProfileOp8021Qbh(const char *ifname, ...@@ -993,7 +998,7 @@ doPortProfileOp8021Qbh(const char *ifname,
(void)virtPortOp; (void)virtPortOp;
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s", macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Kernel VF Port support was missing at compile time.")); _("Kernel VF Port support was missing at compile time."));
rc = 1; rc = -1;
# else /* IFLA_VF_PORT_MAX */ # else /* IFLA_VF_PORT_MAX */
...@@ -1005,20 +1010,21 @@ doPortProfileOp8021Qbh(const char *ifname, ...@@ -1005,20 +1010,21 @@ doPortProfileOp8021Qbh(const char *ifname,
int vlanid = -1; int vlanid = -1;
rc = getPhysfnDev(ifname, &vf, &physfndev); rc = getPhysfnDev(ifname, &vf, &physfndev);
if (rc) if (rc < 0)
goto err_exit; goto err_exit;
if (ifaceGetIndex(true, physfndev, &ifindex) < 0) { rc = ifaceGetIndex(true, physfndev, &ifindex);
rc = 1; if (rc < 0)
goto err_exit; goto err_exit;
}
switch (virtPortOp) { switch (virtPortOp) {
case PREASSOCIATE_RR: case PREASSOCIATE_RR:
case ASSOCIATE: case ASSOCIATE:
rc = virGetHostUUID(hostuuid); errno = virGetHostUUID(hostuuid);
if (rc) if (errno) {
rc = -1;
goto err_exit; goto err_exit;
}
rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex, rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
macaddr, macaddr,
...@@ -1031,7 +1037,7 @@ doPortProfileOp8021Qbh(const char *ifname, ...@@ -1031,7 +1037,7 @@ doPortProfileOp8021Qbh(const char *ifname,
(virtPortOp == PREASSOCIATE_RR) ? (virtPortOp == PREASSOCIATE_RR) ?
PORT_REQUEST_PREASSOCIATE_RR PORT_REQUEST_PREASSOCIATE_RR
: PORT_REQUEST_ASSOCIATE); : PORT_REQUEST_ASSOCIATE);
if (rc == -ETIMEDOUT) if (rc == -2)
/* Association timed out, disassociate */ /* Association timed out, disassociate */
doPortProfileOpCommon(nltarget_kernel, NULL, ifindex, doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
NULL, NULL,
...@@ -1059,7 +1065,7 @@ doPortProfileOp8021Qbh(const char *ifname, ...@@ -1059,7 +1065,7 @@ doPortProfileOp8021Qbh(const char *ifname,
default: default:
macvtapError(VIR_ERR_INTERNAL_ERROR, macvtapError(VIR_ERR_INTERNAL_ERROR,
_("operation type %d not supported"), virtPortOp); _("operation type %d not supported"), virtPortOp);
rc = 1; rc = -1;
} }
err_exit: err_exit:
...@@ -1084,7 +1090,7 @@ err_exit: ...@@ -1084,7 +1090,7 @@ err_exit:
* by the user, then this function returns without doing * by the user, then this function returns without doing
* anything. * anything.
* *
* Returns 0 in case of success, != 0 otherwise with error * Returns 0 in case of success, < 0 otherwise with error
* having been reported. * having been reported.
*/ */
int int
......
...@@ -1707,9 +1707,9 @@ int pciDeviceIsAssignable(pciDevice *dev, ...@@ -1707,9 +1707,9 @@ int pciDeviceIsAssignable(pciDevice *dev,
#ifdef __linux__ #ifdef __linux__
/* /*
* returns 1 if equal and 0 if not * returns true if equal
*/ */
static int static bool
pciConfigAddressEqual(struct pci_config_address *bdf1, pciConfigAddressEqual(struct pci_config_address *bdf1,
struct pci_config_address *bdf2) struct pci_config_address *bdf2)
{ {
...@@ -1959,11 +1959,11 @@ pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link, ...@@ -1959,11 +1959,11 @@ pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
struct pci_config_address **virt_fns = NULL; struct pci_config_address **virt_fns = NULL;
if (pciGetPciConfigAddressFromSysfsDeviceLink(vf_sysfs_device_link, if (pciGetPciConfigAddressFromSysfsDeviceLink(vf_sysfs_device_link,
&vf_bdf)) &vf_bdf) < 0)
return ret; return ret;
if (pciGetVirtualFunctions(pf_sysfs_device_link, &virt_fns, if (pciGetVirtualFunctions(pf_sysfs_device_link, &virt_fns,
&num_virt_fns)) { &num_virt_fns) < 0) {
pciReportError(VIR_ERR_INTERNAL_ERROR, pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Error getting physical function's '%s' " _("Error getting physical function's '%s' "
"virtual_functions"), pf_sysfs_device_link); "virtual_functions"), pf_sysfs_device_link);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册