From: Oleksandr Grytsov <oleksandr_gryt...@epam.com>

In the display protocol connector's id is named as unique-id. This patch renames
it in the libxl/xl code and uses XENDISPL_FIELD... definitions from the protocol
header.

Signed-off-by: Oleksandr Grytsov <oleksandr_gryt...@epam.com>
---
 docs/man/xl.cfg.pod.5.in    |  2 +-
 tools/libxl/libxl_types.idl |  4 ++--
 tools/libxl/libxl_vdispl.c  | 32 +++++++++++++++++---------------
 tools/xl/xl_parse.c         |  2 +-
 tools/xl/xl_vdispl.c        |  2 +-
 5 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index 47d88243b1..ea66d867da 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -1288,7 +1288,7 @@ Specifies virtual connectors for the device in following 
format
 
 =item C<id>
 
-String connector ID. Space, comma symbols are not allowed.
+String connector unique id. Space, comma symbols are not allowed.
 
 =item C<W>
 
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 01ec1d1afa..9a9d0ed52d 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -809,7 +809,7 @@ libxl_device_channel = Struct("device_channel", [
 ])
 
 libxl_connector_param = Struct("connector_param", [
-    ("id", string),
+    ("unique_id", string),
     ("width", uint32),
     ("height", uint32)
     ])
@@ -935,7 +935,7 @@ libxl_physinfo = Struct("physinfo", [
     ], dir=DIR_OUT)
 
 libxl_connectorinfo = Struct("connectorinfo", [
-    ("id", string),
+    ("unique_id", string),
     ("width", uint32),
     ("height", uint32),
     ("req_evtch", integer),
diff --git a/tools/libxl/libxl_vdispl.c b/tools/libxl/libxl_vdispl.c
index 55dfac3e71..351f6beccb 100644
--- a/tools/libxl/libxl_vdispl.c
+++ b/tools/libxl/libxl_vdispl.c
@@ -14,6 +14,8 @@
 
 #include "libxl_internal.h"
 
+#include <xen/io/displif.h>
+
 static int libxl__device_vdispl_setdefault(libxl__gc *gc, uint32_t domid,
                                            libxl_device_vdispl *vdispl,
                                            bool hotplug)
@@ -66,15 +68,15 @@ static int libxl__set_xenstore_vdispl(libxl__gc *gc, 
uint32_t domid,
 {
     int i;
 
-    flexarray_append_pair(ro_front, "be-alloc",
+    flexarray_append_pair(ro_front, XENDISPL_FIELD_BE_ALLOC,
                           GCSPRINTF("%d", vdispl->be_alloc));
 
     for (i = 0; i < vdispl->num_connectors; i++) {
-        flexarray_append_pair(ro_front, GCSPRINTF("%d/resolution", i),
-                              GCSPRINTF("%dx%d", vdispl->connectors[i].width,
+        flexarray_append_pair(ro_front, 
GCSPRINTF("%d/"XENDISPL_FIELD_RESOLUTION, i),
+                              GCSPRINTF("%d"XENDISPL_RESOLUTION_SEPARATOR"%d", 
vdispl->connectors[i].width,
                                                  
vdispl->connectors[i].height));
-        flexarray_append_pair(ro_front, GCSPRINTF("%d/id", i),
-                              vdispl->connectors[i].id);
+        flexarray_append_pair(ro_front, 
GCSPRINTF("%d/"XENDISPL_FIELD_UNIQUE_ID, i),
+                              vdispl->connectors[i].unique_id);
     }
 
     return 0;
@@ -106,15 +108,15 @@ static int libxl__device_vdispl_getconnectors(libxl_ctx 
*ctx,
         char *value;
         char *value_path;
 
-        value_path = GCSPRINTF("%s/%d/id", path, i);
-        info->connectors[i].id = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
-        if (info->connectors[i].id == NULL) { rc = ERROR_FAIL; goto out; }
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_UNIQUE_ID, path, i);
+        info->connectors[i].unique_id = xs_read(ctx->xsh, XBT_NULL, 
value_path, NULL);
+        if (info->connectors[i].unique_id == NULL) { rc = ERROR_FAIL; goto 
out; }
 
-        value_path = GCSPRINTF("%s/%d/resolution", path, i);
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_RESOLUTION, path, i);
         value = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
         if (value == NULL) { rc = ERROR_FAIL; goto out; }
 
-        rc = sscanf(value, "%ux%u", &info->connectors[i].width,
+        rc = sscanf(value, "%u"XENDISPL_RESOLUTION_SEPARATOR"%u", 
&info->connectors[i].width,
                     &info->connectors[i].height);
         free(value);
 
@@ -122,22 +124,22 @@ static int libxl__device_vdispl_getconnectors(libxl_ctx 
*ctx,
             rc = ERROR_FAIL; goto out;
         }
 
-        value_path = GCSPRINTF("%s/%d/req-ring-ref", path, i);
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_REQ_RING_REF, path, i);
         value = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
         info->connectors[i].req_rref = value ? strtoul(value, NULL, 10) : -1;
         free(value);
 
-        value_path = GCSPRINTF("%s/%d/req-event-channel", path, i);
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_REQ_CHANNEL, path, i);
         value = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
         info->connectors[i].req_evtch = value ? strtoul(value, NULL, 10) : -1;
         free(value);
 
-        value_path = GCSPRINTF("%s/%d/evt-ring-ref", path, i);
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_EVT_RING_REF, path, i);
         value = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
         info->connectors[i].evt_rref = value ? strtoul(value, NULL, 10) : -1;
         free(value);
 
-        value_path = GCSPRINTF("%s/%d/evt-event-channel", path, i);
+        value_path = GCSPRINTF("%s/%d/"XENDISPL_FIELD_EVT_CHANNEL, path, i);
         value = xs_read(ctx->xsh, XBT_NULL, value_path, NULL);
         info->connectors[i].evt_evtch = value ? strtoul(value, NULL, 10) : -1;
         free(value);
@@ -182,7 +184,7 @@ int libxl_device_vdispl_getinfo(libxl_ctx *ctx, uint32_t 
domid,
                              NULL);
     info->frontend_id = domid;
 
-    val = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/be-alloc", devpath));
+    val = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/"XENDISPL_FIELD_BE_ALLOC, 
devpath));
     info->be_alloc = val ? strtoul(val, NULL, 10) : 0;
 
     rc = libxl__device_vdispl_getconnectors(ctx, devpath, info);
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e6c54483e0..db48f99253 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -827,7 +827,7 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char 
*token)
             char *resolution;
 
             rc = split_string_into_pair(connectors[i], ":",
-                                        &vdispl->connectors[i].id,
+                                        &vdispl->connectors[i].unique_id,
                                         &resolution);
 
             rc= sscanf(resolution, "%ux%u", &vdispl->connectors[i].width,
diff --git a/tools/xl/xl_vdispl.c b/tools/xl/xl_vdispl.c
index e4ed572a0b..67af15d11f 100644
--- a/tools/xl/xl_vdispl.c
+++ b/tools/xl/xl_vdispl.c
@@ -104,7 +104,7 @@ int main_vdispllist(int argc, char **argv)
                    printf("\tConnector: %d, id: %s, width: %d, height: %d, "
                           "req-rref: %d, req-evtch: %d, "
                           "evt-rref: %d, evt-evtch: %d\n",
-                          j, vdisplinfo.connectors[j].id,
+                          j, vdisplinfo.connectors[j].unique_id,
                           vdisplinfo.connectors[j].width,
                           vdisplinfo.connectors[j].height,
                           vdisplinfo.connectors[j].req_rref,
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to