libxl/xl: rename id to unique-id in vdispl xen store
authorOleksandr Grytsov <oleksandr_grytsov@epam.com>
Tue, 12 Jun 2018 15:40:46 +0000 (18:40 +0300)
committerWei Liu <wei.liu2@citrix.com>
Tue, 10 Jul 2018 07:46:10 +0000 (08:46 +0100)
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_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
docs/man/xl.cfg.pod.5.in
tools/libxl/libxl_types.idl
tools/libxl/libxl_vdispl.c
tools/xl/xl_parse.c
tools/xl/xl_vdispl.c

index 47d88243b11c710e1eea21527938d3bac993ba36..ea66d867daab04e84a080214e0d4867e62fabfce 100644 (file)
@@ -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>
 
index 01ec1d1afaaaf00d0afe1c352cac995ee3825240..9a9d0ed52dcb3e2073cf86d03501db5da493a775 100644 (file)
@@ -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),
index 55dfac3e71cbad349310647c1feea1240bb17053..351f6beccb836ea86a913e3d6bb3de7873c9d312 100644 (file)
@@ -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);
index e6c54483e0bf477b51efca4d62073e54bebeb41b..db48f992533a286b6cc6db1971f6f252d295efe5 100644 (file)
@@ -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,
index e4ed572a0b32db385b9591282b06f8544f331b52..67af15d11fd24de06794029a86cacd666342db68 100644 (file)
@@ -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,