]> xenbits.xensource.com Git - libvirt.git/commitdiff
Drop needless typecast to virDomainLaunchSecurity
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Jun 2024 08:06:57 +0000 (10:06 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 21 Jun 2024 07:31:33 +0000 (09:31 +0200)
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>
src/conf/domain_conf.c
src/qemu/qemu_command.c
src/qemu/qemu_firmware.c
src/qemu/qemu_namespace.c
src/qemu/qemu_process.c
src/qemu/qemu_validate.c

index 264f182d059bd07638e0d6d6c878cb3fa0a8c55d..102a011be862a20f11c03a09d17fe9452ed3d530 100644 (file)
@@ -3830,7 +3830,7 @@ virDomainSecDefFree(virDomainSecDef *def)
     if (!def)
         return;
 
-    switch ((virDomainLaunchSecurity) def->sectype) {
+    switch (def->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         g_free(def->data.sev.dh_cert);
         g_free(def->data.sev.session);
@@ -13690,7 +13690,7 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode,
                        &sec->sectype) < 0)
         return NULL;
 
-    switch ((virDomainLaunchSecurity) sec->sectype) {
+    switch (sec->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         if (virDomainSEVDefParseXML(&sec->data.sev, ctxt) < 0)
             return NULL;
@@ -26695,7 +26695,7 @@ virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec)
     virBufferAsprintf(&attrBuf, " type='%s'",
                       virDomainLaunchSecurityTypeToString(sec->sectype));
 
-    switch ((virDomainLaunchSecurity) sec->sectype) {
+    switch (sec->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         virDomainSEVDefFormat(&attrBuf, &childBuf, &sec->data.sev);
         break;
index a32cb8f8e9217311442c2dc571fe1e852c60a526..1879fa608cc22eff79a269290073e84bbc4f7c25 100644 (file)
@@ -7054,7 +7054,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
     qemuAppendLoadparmMachineParm(&buf, def);
 
     if (def->sec) {
-        switch ((virDomainLaunchSecurity) def->sec->sectype) {
+        switch (def->sec->sectype) {
         case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)) {
                 virBufferAddLit(&buf, ",confidential-guest-support=lsec0");
@@ -9777,7 +9777,7 @@ qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd,
     if (!sec)
         return 0;
 
-    switch ((virDomainLaunchSecurity) sec->sectype) {
+    switch (sec->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         return qemuBuildSEVCommandLine(vm, cmd, &sec->data.sev);
         break;
index 78844e30663e1eedc032bf1b9dd7d6a64228b729..8946dc1aa577848fd4bebcfb6ead273988f03589 100644 (file)
@@ -1323,7 +1323,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
     }
 
     if (def->sec) {
-        switch ((virDomainLaunchSecurity) def->sec->sectype) {
+        switch (def->sec->sectype) {
         case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
             if (!supportsSEV) {
                 VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support it",
index 915d44310f3f967284cb963054172c126a956725..fb7c9329ddd3260c11fbbcbf4226427ad2c52f18 100644 (file)
@@ -651,7 +651,7 @@ qemuDomainSetupLaunchSecurity(virDomainObj *vm,
     if (!sec)
         return 0;
 
-    switch ((virDomainLaunchSecurity) sec->sectype) {
+    switch (sec->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         VIR_DEBUG("Setting up launch security for SEV");
 
index 9886a11245f2b414859b4d17cbfffc18c68b4792..f730cd182816d35c4ded7a424c8303b7b8d750b1 100644 (file)
@@ -6806,7 +6806,7 @@ qemuProcessPrepareLaunchSecurityGuestInput(virDomainObj *vm)
     if (!sec)
         return 0;
 
-    switch ((virDomainLaunchSecurity) sec->sectype) {
+    switch (sec->sectype) {
     case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
         return qemuProcessPrepareSEVGuestInput(vm);
     case VIR_DOMAIN_LAUNCH_SECURITY_PV:
index a00ec8e940d065e464e262739f0cb6e146c72134..05ee477456a9e58c1bb01978a034814fb36de969 100644 (file)
@@ -1310,7 +1310,7 @@ qemuValidateDomainDef(const virDomainDef *def,
         return -1;
 
     if (def->sec) {
-        switch ((virDomainLaunchSecurity) def->sec->sectype) {
+        switch (def->sec->sectype) {
         case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",