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

[libvirt] [PATCH 16/17] conf: separate PTY chardev source parsing



There is no reason why to share the same code for PTY and other file
based chardev source types.

Signed-off-by: Pavel Hrdina <phrdina redhat com>
---
 src/conf/domain_conf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1baf6b9174..3e20b22799 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11121,14 +11121,16 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
                 break;
 
             case VIR_DOMAIN_CHR_TYPE_PTY:
-            case VIR_DOMAIN_CHR_TYPE_DEV:
-            case VIR_DOMAIN_CHR_TYPE_PIPE:
                 /* PTY path is only parsed from live xml.  */
-                if (def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
-                    !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
+                if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
                     def->data.file.path = virXMLPropString(cur, "path");
                 break;
 
+            case VIR_DOMAIN_CHR_TYPE_DEV:
+            case VIR_DOMAIN_CHR_TYPE_PIPE:
+                def->data.file.path = virXMLPropString(cur, "path");
+                break;
+
             case VIR_DOMAIN_CHR_TYPE_UNIX:
                 if (virDomainChrSourceDefParseUnix(def, cur) < 0)
                     goto error;
@@ -11201,6 +11203,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
 
     switch ((virDomainChrType) def->type) {
     case VIR_DOMAIN_CHR_TYPE_NULL:
+    case VIR_DOMAIN_CHR_TYPE_PTY:
     case VIR_DOMAIN_CHR_TYPE_VC:
     case VIR_DOMAIN_CHR_TYPE_STDIO:
     case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
@@ -11208,11 +11211,9 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
         break;
 
     case VIR_DOMAIN_CHR_TYPE_FILE:
-    case VIR_DOMAIN_CHR_TYPE_PTY:
     case VIR_DOMAIN_CHR_TYPE_DEV:
     case VIR_DOMAIN_CHR_TYPE_PIPE:
-        if (!def->data.file.path &&
-            def->type != VIR_DOMAIN_CHR_TYPE_PTY) {
+        if (!def->data.file.path) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Missing source path attribute for char device"));
             goto error;
-- 
2.13.5


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