Skip to contentSkip to conversation

libxl/xl: rename id to unique-id in vdispl xen store

PATCH In review Oleksandr Grytsov 2 participants 4 messages Jun 12, 2018 – Jul 5, 2018

lore
Share & tools
lore
#0 lore raw

cover libxl/xl: rename id to unique-id in vdispl xen store

From: Oleksandr Grytsov <[email protected]>

As new version of the display protocol introduces unique-id variable, it needs to be changed in libxl/xl. This patchset renames it in the xen store and in display device structures. Also it uses XENDISPL_FIELD_... defines instead of inline names.

Oleksandr Grytsov (1):
libxl/xl: rename id to unique-id in vdispl xen store

 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(-)
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/1 libxl/xl: rename id to unique-id in vdispl xen store

From: Oleksandr Grytsov <[email protected]>

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.

---
 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(-)
docs/man/xl.cfg.pod.5.in +1 -1
index 47d88243b1..ea66d867da 100644
@@ -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>
 
tools/libxl/libxl_types.idl +2 -2
index 01ec1d1afa..9a9d0ed52d 100644
@@ -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),
tools/libxl/libxl_vdispl.c +17 -15
index 55dfac3e71..351f6beccb 100644
@@ -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);
tools/xl/xl_parse.c +1 -1
index e6c54483e0..db48f99253 100644
@@ -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,
tools/xl/xl_vdispl.c +1 -1
index e4ed572a0b..67af15d11f 100644
@@ -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,
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
In reply to Oleksandr Grytsov
Quoted 19 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

As new version of the display protocol introduces unique-id variable, it needs
to be changed in libxl/xl. This patchset renames it in the xen store and in display device structures. Also it uses XENDISPL_FIELD_... defines instead of
inline names.

Oleksandr Grytsov (1):
libxl/xl: rename id to unique-id in vdispl xen store

 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(-)
Quoted 4 lines

--
2.17.1

ping

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Oleksandr Grytsov
Quoted 7 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

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.

I guess it should be OK because this feature is considered experimental.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel