Re: [Xen-devel] [PATCH 1/1] libxl/xl: rename id to unique-id in vdispl xen store

2018-07-05 Thread Wei Liu
On Tue, Jun 12, 2018 at 06:40:46PM +0300, Oleksandr Grytsov wrote:
> From: Oleksandr Grytsov 
> 
> 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 

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

Acked-by: Wei Liu 

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

[Xen-devel] [PATCH 1/1] libxl/xl: rename id to unique-id in vdispl xen store

2018-06-12 Thread Oleksandr Grytsov
From: Oleksandr Grytsov 

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 
---
 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
 
-String connector ID. Space, comma symbols are not allowed.
+String connector unique id. Space, comma symbols are not allowed.
 
 =item C
 
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 
+
 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", >connectors[i].width,
+rc = sscanf(value, "%u"XENDISPL_RESOLUTION_SEPARATOR"%u", 
>connectors[i].width,
 >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);
+