mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
Remove redundant two-state integers
This commit is contained in:
parent
e557766c3b
commit
85f9178160
@ -4198,7 +4198,6 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
bool check_active)
|
bool check_active)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int dupVM = 0;
|
|
||||||
virNetworkObjPtr vm = NULL;
|
virNetworkObjPtr vm = NULL;
|
||||||
|
|
||||||
/* See if a VM with matching UUID already exists */
|
/* See if a VM with matching UUID already exists */
|
||||||
@ -4224,7 +4223,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dupVM = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
/* UUID does not match, but if a name matches, refuse it */
|
/* UUID does not match, but if a name matches, refuse it */
|
||||||
vm = virNetworkFindByName(doms, def->name);
|
vm = virNetworkFindByName(doms, def->name);
|
||||||
@ -4236,9 +4235,9 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
def->name, uuidstr);
|
def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dupVM;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virNetworkObjUnlock(vm);
|
virNetworkObjUnlock(vm);
|
||||||
|
@ -1922,7 +1922,6 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
unsigned int check_active)
|
unsigned int check_active)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int dupPool = 0;
|
|
||||||
virStoragePoolObjPtr pool = NULL;
|
virStoragePoolObjPtr pool = NULL;
|
||||||
|
|
||||||
/* See if a Pool with matching UUID already exists */
|
/* See if a Pool with matching UUID already exists */
|
||||||
@ -1948,7 +1947,7 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dupPool = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
/* UUID does not match, but if a name matches, refuse it */
|
/* UUID does not match, but if a name matches, refuse it */
|
||||||
pool = virStoragePoolObjFindByName(pools, def->name);
|
pool = virStoragePoolObjFindByName(pools, def->name);
|
||||||
@ -1960,9 +1959,9 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
def->name, uuidstr);
|
def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dupPool;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (pool)
|
if (pool)
|
||||||
virStoragePoolObjUnlock(pool);
|
virStoragePoolObjUnlock(pool);
|
||||||
|
@ -913,7 +913,6 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
|||||||
uint8_t *pmtype, uint32_t *pleasetime)
|
uint8_t *pmtype, uint32_t *pleasetime)
|
||||||
{
|
{
|
||||||
int oind, olen;
|
int oind, olen;
|
||||||
int oend;
|
|
||||||
uint32_t nwint;
|
uint32_t nwint;
|
||||||
|
|
||||||
olen = len - sizeof(*pd);
|
olen = len - sizeof(*pd);
|
||||||
@ -927,8 +926,6 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
|||||||
|
|
||||||
oind += sizeof(dhcp_magic);
|
oind += sizeof(dhcp_magic);
|
||||||
|
|
||||||
oend = 0;
|
|
||||||
|
|
||||||
*pmtype = 0;
|
*pmtype = 0;
|
||||||
*pleasetime = 0;
|
*pleasetime = 0;
|
||||||
|
|
||||||
@ -953,14 +950,11 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
|||||||
oind++;
|
oind++;
|
||||||
continue;
|
continue;
|
||||||
case DHCPO_END:
|
case DHCPO_END:
|
||||||
oend = 1;
|
return 0;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (olen - oind < 2)
|
if (olen - oind < 2)
|
||||||
goto malformed;
|
goto malformed;
|
||||||
}
|
}
|
||||||
if (oend)
|
|
||||||
break;
|
|
||||||
oind += pd->d_opts[oind + 1] + 2;
|
oind += pd->d_opts[oind + 1] + 2;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2622,7 +2622,6 @@ static int
|
|||||||
qemuProcessFiltersInstantiate(virConnectPtr conn,
|
qemuProcessFiltersInstantiate(virConnectPtr conn,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
int err = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!conn)
|
if (!conn)
|
||||||
@ -2631,14 +2630,12 @@ qemuProcessFiltersInstantiate(virConnectPtr conn,
|
|||||||
for (i = 0; i < def->nnets; i++) {
|
for (i = 0; i < def->nnets; i++) {
|
||||||
virDomainNetDefPtr net = def->nets[i];
|
virDomainNetDefPtr net = def->nets[i];
|
||||||
if ((net->filter) && (net->ifname)) {
|
if ((net->filter) && (net->ifname)) {
|
||||||
if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0) {
|
if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0)
|
||||||
err = 1;
|
return 1;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1564,7 +1564,6 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
|||||||
struct ifla_vf_vlan *vf_vlan;
|
struct ifla_vf_vlan *vf_vlan;
|
||||||
struct nlattr *tb_vf_info = {NULL, };
|
struct nlattr *tb_vf_info = {NULL, };
|
||||||
struct nlattr *tb_vf[IFLA_VF_MAX+1];
|
struct nlattr *tb_vf[IFLA_VF_MAX+1];
|
||||||
int found = 0;
|
|
||||||
int rem;
|
int rem;
|
||||||
|
|
||||||
if (!tb[IFLA_VFINFO_LIST]) {
|
if (!tb[IFLA_VFINFO_LIST]) {
|
||||||
@ -1588,7 +1587,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
|||||||
vf_mac = RTA_DATA(tb_vf[IFLA_VF_MAC]);
|
vf_mac = RTA_DATA(tb_vf[IFLA_VF_MAC]);
|
||||||
if (vf_mac && vf_mac->vf == vf) {
|
if (vf_mac && vf_mac->vf == vf) {
|
||||||
virMacAddrSetRaw(mac, vf_mac->mac);
|
virMacAddrSetRaw(mac, vf_mac->mac);
|
||||||
found = 1;
|
rc = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1596,17 +1595,17 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
|||||||
vf_vlan = RTA_DATA(tb_vf[IFLA_VF_VLAN]);
|
vf_vlan = RTA_DATA(tb_vf[IFLA_VF_VLAN]);
|
||||||
if (vf_vlan && vf_vlan->vf == vf) {
|
if (vf_vlan && vf_vlan->vf == vf) {
|
||||||
*vlanid = vf_vlan->vlan;
|
*vlanid = vf_vlan->vlan;
|
||||||
found = 1;
|
rc = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) {
|
|
||||||
rc = 0;
|
if (rc == 0)
|
||||||
goto cleanup;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
if (rc < 0)
|
||||||
_("couldn't find IFLA_VF_INFO for VF %d "
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"in netlink response"), vf);
|
_("couldn't find IFLA_VF_INFO for VF %d "
|
||||||
|
"in netlink response"), vf);
|
||||||
cleanup:
|
cleanup:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user