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

[RFCv2 31/46] conf: Replace virDomainGraphicsDefParseXMLRDP(hardcoded) with virDomainGraphicsRDPDefParseXML(generated)



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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8842f2a..14bb4d3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14401,7 +14401,7 @@ virDomainGraphicsVNCDefParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
+int
 virDomainGraphicsRDPDefParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
                                     virDomainGraphicsRDPDefPtr def,
                                     const char *instname G_GNUC_UNUSED,
@@ -14431,43 +14431,6 @@ virDomainGraphicsRDPDefParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
-virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDefPtr def,
-                                xmlNodePtr node,
-                                xmlXPathContextPtr ctxt G_GNUC_UNUSED,
-                                unsigned int flags)
-{
-    g_autofree char *port = virXMLPropString(node, "port");
-    g_autofree char *autoport = virXMLPropString(node, "autoport");
-    g_autofree char *replaceUser = virXMLPropString(node, "replaceUser");
-    g_autofree char *multiUser = virXMLPropString(node, "multiUser");
-
-    if (port) {
-        if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("cannot parse rdp port %s"), port);
-            return -1;
-        }
-    }
-
-    if (STREQ_NULLABLE(autoport, "yes"))
-        def->data.rdp.autoport = true;
-
-    if (STREQ_NULLABLE(replaceUser, "yes"))
-        def->data.rdp.replaceUser = true;
-
-    if (STREQ_NULLABLE(multiUser, "yes"))
-        def->data.rdp.multiUser = true;
-
-    if (virDomainGraphicsRDPDefParseXMLHook(node, &def->data.rdp,
-                                            NULL, def, &flags, port, autoport,
-                                            replaceUser, multiUser) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 static int
 virDomainGraphicsDefParseXMLDesktop(virDomainGraphicsDefPtr def,
                                     xmlNodePtr node)
@@ -14859,7 +14822,7 @@ virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
     case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
         if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
             goto error;
-        if (virDomainGraphicsDefParseXMLRDP(def, node, ctxt, flags) < 0)
+        if (virDomainGraphicsRDPDefParseXML(node, &def->data.rdp, NULL, def, &flags) < 0)
             goto error;
         break;
     case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f4cc504..3cdb5f8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1695,11 +1695,11 @@ struct _virDomainGraphicsVNCDef {   /* genparse:withhook, genformat:separate */
     virDomainGraphicsAuthDef auth;                  /* xmlgroup */
 };
 
-struct _virDomainGraphicsRDPDef {
-    int port;
-    bool autoport;
-    bool replaceUser;
-    bool multiUser;
+struct _virDomainGraphicsRDPDef {   /* genparse:withhook */
+    int port;                       /* xmlattr */
+    bool autoport;                  /* xmlattr */
+    bool replaceUser;               /* xmlattr */
+    bool multiUser;                 /* xmlattr */
 };
 
 struct _virDomainGraphicsDesktopDef {
-- 
2.25.1



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