[libvirt PATCH 07/10] conf: rename struct field for NVRAM template

Daniel P. Berrangé berrange at redhat.com
Tue Feb 15 18:54:35 UTC 2022


This is to make it explicit that the template only applies to the NVRAM
store, not the main loader binary, even if the loader is writable.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/conf/domain_conf.c   | 10 +++++-----
 src/conf/domain_conf.h   |  2 +-
 src/qemu/qemu_firmware.c |  8 ++++----
 src/qemu/qemu_process.c  |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 946a80c239..13ec64c19f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3528,7 +3528,7 @@ virDomainLoaderDefFree(virDomainLoaderDef *loader)
 
     g_free(loader->path);
     g_free(loader->nvram);
-    g_free(loader->templt);
+    g_free(loader->nvramTemplate);
     g_free(loader);
 }
 
@@ -4821,7 +4821,7 @@ virDomainDefPostParseOs(virDomainDef *def)
     }
 
     if (def->os.loader->readonly != VIR_TRISTATE_BOOL_YES &&
-        def->os.loader->templt && !def->os.loader->nvram) {
+        def->os.loader->nvramTemplate && !def->os.loader->nvram) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("NVRAM template without VARs path not permitted with writable loader"));
         return -1;
@@ -18243,7 +18243,7 @@ virDomainDefParseBootLoaderOptions(virDomainDef *def,
 
     def->os.loader->nvram = virXPathString("string(./os/nvram[1])", ctxt);
     if (!fwAutoSelect)
-        def->os.loader->templt = virXPathString("string(./os/nvram[1]/@template)", ctxt);
+        def->os.loader->nvramTemplate = virXPathString("string(./os/nvram[1]/@template)", ctxt);
 
     return 0;
 }
@@ -26930,9 +26930,9 @@ virDomainLoaderDefFormat(virBuffer *buf,
     else
         virBufferAddLit(buf, "/>\n");
 
-    if (loader->nvram || loader->templt) {
+    if (loader->nvram || loader->nvramTemplate) {
         virBufferAddLit(buf, "<nvram");
-        virBufferEscapeString(buf, " template='%s'", loader->templt);
+        virBufferEscapeString(buf, " template='%s'", loader->nvramTemplate);
         if (loader->nvram)
             virBufferEscapeString(buf, ">%s</nvram>\n", loader->nvram);
         else
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b2922e8cff..9fcf842ee7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2220,7 +2220,7 @@ struct _virDomainLoaderDef {
     virDomainLoader type;
     virTristateBool secure;
     char *nvram;    /* path to non-volatile RAM */
-    char *templt;   /* user override of path to master nvram */
+    char *nvramTemplate;   /* user override of path to master nvram */
 };
 
 void virDomainLoaderDefFree(virDomainLoaderDef *loader);
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index a7373e3026..9ef4399838 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1136,14 +1136,14 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver,
             return -1;
         }
 
-        VIR_FREE(def->os.loader->templt);
-        def->os.loader->templt = g_strdup(flash->nvram_template.filename);
+        VIR_FREE(def->os.loader->nvramTemplate);
+        def->os.loader->nvramTemplate = g_strdup(flash->nvram_template.filename);
 
         qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram);
 
         VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'",
                   def->os.loader->path,
-                  def->os.loader->templt,
+                  def->os.loader->nvramTemplate,
                   def->os.loader->nvram);
         break;
 
@@ -1309,7 +1309,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
          * its path in domain XML) but no template for NVRAM was
          * specified and the varstore doesn't exist ... */
         if (!virDomainDefHasOldStyleROUEFI(def) ||
-            def->os.loader->templt ||
+            def->os.loader->nvramTemplate ||
             virFileExists(def->os.loader->nvram))
             return 0;
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7066696f31..6057e25717 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4440,8 +4440,8 @@ qemuPrepareNVRAM(virQEMUDriver *driver,
         (virFileExists(loader->nvram) && !reset_nvram))
         return 0;
 
-    master_nvram_path = loader->templt;
-    if (!loader->templt) {
+    master_nvram_path = loader->nvramTemplate;
+    if (!loader->nvramTemplate) {
         size_t i;
         for (i = 0; i < cfg->nfirmwares; i++) {
             if (STREQ(cfg->firmwares[i]->name, loader->path)) {
-- 
2.34.1




More information about the libvir-list mailing list