mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
qemuProcessSetupRawIO: Refactor return value and remove useless #ifdef
The function can return directly rather than setting 'ret' as there's no cleanup. It also doesn't make sense to conditionally compile out the 'break' statement when checking whether a disk has rawio enabled if 'CAP_SYS_RAWIO' is _not_ defined as the function will still behave the same. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
d02a77c2ff
commit
61c8a7180e
@ -5183,7 +5183,6 @@ qemuProcessSetupRawIO(virDomainObj *vm,
|
|||||||
{
|
{
|
||||||
bool rawio = false;
|
bool rawio = false;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
/* in case a certain disk is desirous of CAP_SYS_RAWIO, add this */
|
/* in case a certain disk is desirous of CAP_SYS_RAWIO, add this */
|
||||||
for (i = 0; i < vm->def->ndisks; i++) {
|
for (i = 0; i < vm->def->ndisks; i++) {
|
||||||
@ -5191,9 +5190,7 @@ qemuProcessSetupRawIO(virDomainObj *vm,
|
|||||||
|
|
||||||
if (disk->rawio == VIR_TRISTATE_BOOL_YES) {
|
if (disk->rawio == VIR_TRISTATE_BOOL_YES) {
|
||||||
rawio = true;
|
rawio = true;
|
||||||
#ifndef CAP_SYS_RAWIO
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5213,18 +5210,16 @@ qemuProcessSetupRawIO(virDomainObj *vm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
if (rawio) {
|
if (rawio) {
|
||||||
#ifdef CAP_SYS_RAWIO
|
#ifdef CAP_SYS_RAWIO
|
||||||
virCommandAllowCap(cmd, CAP_SYS_RAWIO);
|
virCommandAllowCap(cmd, CAP_SYS_RAWIO);
|
||||||
#else
|
#else
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Raw I/O is not supported on this platform"));
|
_("Raw I/O is not supported on this platform"));
|
||||||
ret = -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user