Drop needless typecast to virDomainLaunchSecurity

The sectype member of _virDomainSecDef struct is already declared
as of virDomainLaunchSecurity type. There's no need to typecast
it to the very same type when passing it to switch().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2024-06-12 10:06:57 +02:00
parent faa3548ed5
commit a44a43361f
6 changed files with 9 additions and 9 deletions

View File

@ -3830,7 +3830,7 @@ virDomainSecDefFree(virDomainSecDef *def)
if (!def) if (!def)
return; return;
switch ((virDomainLaunchSecurity) def->sectype) { switch (def->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
g_free(def->data.sev.dh_cert); g_free(def->data.sev.dh_cert);
g_free(def->data.sev.session); g_free(def->data.sev.session);
@ -13690,7 +13690,7 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode,
&sec->sectype) < 0) &sec->sectype) < 0)
return NULL; return NULL;
switch ((virDomainLaunchSecurity) sec->sectype) { switch (sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
if (virDomainSEVDefParseXML(&sec->data.sev, ctxt) < 0) if (virDomainSEVDefParseXML(&sec->data.sev, ctxt) < 0)
return NULL; return NULL;
@ -26695,7 +26695,7 @@ virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec)
virBufferAsprintf(&attrBuf, " type='%s'", virBufferAsprintf(&attrBuf, " type='%s'",
virDomainLaunchSecurityTypeToString(sec->sectype)); virDomainLaunchSecurityTypeToString(sec->sectype));
switch ((virDomainLaunchSecurity) sec->sectype) { switch (sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
virDomainSEVDefFormat(&attrBuf, &childBuf, &sec->data.sev); virDomainSEVDefFormat(&attrBuf, &childBuf, &sec->data.sev);
break; break;

View File

@ -7054,7 +7054,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
qemuAppendLoadparmMachineParm(&buf, def); qemuAppendLoadparmMachineParm(&buf, def);
if (def->sec) { if (def->sec) {
switch ((virDomainLaunchSecurity) def->sec->sectype) { switch (def->sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)) {
virBufferAddLit(&buf, ",confidential-guest-support=lsec0"); virBufferAddLit(&buf, ",confidential-guest-support=lsec0");
@ -9777,7 +9777,7 @@ qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd,
if (!sec) if (!sec)
return 0; return 0;
switch ((virDomainLaunchSecurity) sec->sectype) { switch (sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
return qemuBuildSEVCommandLine(vm, cmd, &sec->data.sev); return qemuBuildSEVCommandLine(vm, cmd, &sec->data.sev);
break; break;

View File

@ -1323,7 +1323,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
} }
if (def->sec) { if (def->sec) {
switch ((virDomainLaunchSecurity) def->sec->sectype) { switch (def->sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
if (!supportsSEV) { if (!supportsSEV) {
VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support it", VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support it",

View File

@ -651,7 +651,7 @@ qemuDomainSetupLaunchSecurity(virDomainObj *vm,
if (!sec) if (!sec)
return 0; return 0;
switch ((virDomainLaunchSecurity) sec->sectype) { switch (sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
VIR_DEBUG("Setting up launch security for SEV"); VIR_DEBUG("Setting up launch security for SEV");

View File

@ -6806,7 +6806,7 @@ qemuProcessPrepareLaunchSecurityGuestInput(virDomainObj *vm)
if (!sec) if (!sec)
return 0; return 0;
switch ((virDomainLaunchSecurity) sec->sectype) { switch (sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
return qemuProcessPrepareSEVGuestInput(vm); return qemuProcessPrepareSEVGuestInput(vm);
case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_PV:

View File

@ -1310,7 +1310,7 @@ qemuValidateDomainDef(const virDomainDef *def,
return -1; return -1;
if (def->sec) { if (def->sec) {
switch ((virDomainLaunchSecurity) def->sec->sectype) { switch (def->sec->sectype) {
case VIR_DOMAIN_LAUNCH_SECURITY_SEV: case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",