[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[RFCv2 26/46] conf: Generate format functions for virDomainGraphicsAuthDef



Signed-off-by: Shi Lei <shi_lei massclouds com>
---
 src/conf/domain_conf.c | 30 ++----------------------------
 src/conf/domain_conf.h |  4 ++--
 2 files changed, 4 insertions(+), 30 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1fd2a06..be07b40 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28000,32 +28000,6 @@ virDomainTimerDefFormat(virBufferPtr buf,
     return 0;
 }
 
-static void
-virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf,
-                                   virDomainGraphicsAuthDefPtr def,
-                                   unsigned int flags)
-{
-    if (!def->passwd)
-        return;
-
-    if (flags & VIR_DOMAIN_DEF_FORMAT_SECURE)
-        virBufferEscapeString(buf, " passwd='%s'",
-                              def->passwd);
-
-    if (def->expires) {
-        g_autoptr(GDateTime) then = NULL;
-        g_autofree char *thenstr = NULL;
-
-        then = g_date_time_new_from_unix_utc(def->validTo);
-        thenstr = g_date_time_format(then, "%Y-%m-%dT%H:%M:%S");
-        virBufferAsprintf(buf, " passwdValidTo='%s'", thenstr);
-    }
-
-    if (def->connected)
-        virBufferEscapeString(buf, " connected='%s'",
-                              virDomainGraphicsAuthConnectedTypeToString(def->connected));
-}
-
 
 static void
 virDomainGraphicsListenDefFormat(virBufferPtr buf,
@@ -28190,7 +28164,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
                               virDomainGraphicsVNCSharePolicyTypeToString(
                               def->data.vnc.sharePolicy));
 
-        virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, flags);
+        virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, def, &flags);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
@@ -28292,7 +28266,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
             virBufferAsprintf(buf, " defaultMode='%s'",
               virDomainGraphicsSpiceChannelModeTypeToString(def->data.spice.defaultMode));
 
-        virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags);
+        virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, def, &flags);
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 616cbf4..9724b02 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1573,8 +1573,8 @@ typedef enum {
     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST
 } virDomainGraphicsAuthConnectedType;
 
-struct _virDomainGraphicsAuthDef {  /* genparse */
-    char *passwd;                   /* xmlattr */
+struct _virDomainGraphicsAuthDef {  /* genparse, genformat:separate */
+    char *passwd;                   /* xmlattr, formatflag:VIR_DOMAIN_DEF_FORMAT_SECURE */
     /* Whether there is an expiry time set */
     bool expires;
     /* seconds since epoch */
-- 
2.25.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]