All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] libxl: fixes for JSON infrastructure
@ 2014-04-10 15:26 Wei Liu
  2014-04-10 15:26 ` [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s) Wei Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Wei Liu @ 2014-04-10 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, ian.jackson, ian.campbell

This small series contains three fixes to libxl JSON infrasturcture.

Changes in V2:
* generate empty map for None field in keyed-union
* replace empty Struct with None for libxl_event

Wei.

Wei Liu (4):
  libxl/gentypes.py: don't generate JSON for private type(s)
  libxl_json: fix JSON parser debug code
  libxl/gentypes.py: generate empty map for None field in keyed-union
  libxl_types.idl: replace empty Struct with None for libxl_event

 tools/libxl/gentypes.py     |    9 ++++++++-
 tools/libxl/libxl_json.c    |   17 +++++++++++++----
 tools/libxl/libxl_types.idl |    2 +-
 3 files changed, 22 insertions(+), 6 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s)
  2014-04-10 15:26 [PATCH V2 0/4] libxl: fixes for JSON infrastructure Wei Liu
@ 2014-04-10 15:26 ` Wei Liu
  2014-04-14 16:46   ` Ian Campbell
  2014-04-10 15:26 ` [PATCH V2 2/4] libxl_json: fix JSON parser debug code Wei Liu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-10 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, ian.jackson, ian.campbell

Private types are only useful inside libxl. They don't have a valid JSON
generation function by default.

Currently there's only one private type, that's libxl_ev_link. Not
skipping this field causes testidl to fail as the code generated for
this type is NULL.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/gentypes.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index be06257..1a3b91c 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -226,7 +226,7 @@ def libxl_C_type_gen_json(ty, v, indent = "    ", parent = None):
         s += "s = yajl_gen_map_open(hand);\n"
         s += "if (s != yajl_gen_status_ok)\n"
         s += "    goto out;\n"
-        for f in [f for f in ty.fields if not f.const]:
+        for f in [f for f in ty.fields if not f.const and not f.type.private]:
             (nparent,fexpr) = ty.member(v, f, parent is None)
             s += "s = yajl_gen_string(hand, (const unsigned char *)\"%s\", sizeof(\"%s\")-1);\n" % (f.name, f.name)
             s += "if (s != yajl_gen_status_ok)\n"
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 2/4] libxl_json: fix JSON parser debug code
  2014-04-10 15:26 [PATCH V2 0/4] libxl: fixes for JSON infrastructure Wei Liu
  2014-04-10 15:26 ` [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s) Wei Liu
@ 2014-04-10 15:26 ` Wei Liu
  2014-04-14 16:47   ` Ian Campbell
  2014-04-10 15:26 ` [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Wei Liu
  2014-04-10 15:26 ` [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event Wei Liu
  3 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-10 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, ian.jackson, ian.campbell

Two changes included:
1. implement DEBUG_GEN_ALLOC for YAJL2
2. use size_t for variable "len"

without these two fixes it fails to compile when DEBUG_ANSWER is
defined.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_json.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index 989ac3f..3ea56a4 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -34,11 +34,20 @@ struct libxl__yajl_ctx {
 };
 
 #ifdef DEBUG_ANSWER
-#  define DEBUG_GEN_ALLOC(ctx) \
-    if ((ctx)->g == NULL) { \
-        yajl_gen_config conf = { 1, "  " }; \
+#if YAJL_VERSION < 20000
+#  define DEBUG_GEN_ALLOC(ctx)                  \
+    if ((ctx)->g == NULL) {                     \
+        yajl_gen_config conf = { 1, "  " };     \
         (ctx)->g = yajl_gen_alloc(&conf, NULL); \
     }
+#else  /* YAJL2 */
+#  define DEBUG_GEN_ALLOC(ctx)                                    \
+    if ((ctx)->g == NULL) {                                       \
+        (ctx)->g = yajl_gen_alloc(NULL);                          \
+        yajl_gen_config((ctx)->g, yajl_gen_beautify, 1);          \
+        yajl_gen_config((ctx)->g, yajl_gen_indent_string, "  ");  \
+    }
+#endif
 #  define DEBUG_GEN_FREE(ctx) \
     if ((ctx)->g) yajl_gen_free((ctx)->g)
 #  define DEBUG_GEN(ctx, type)              yajl_gen_##type(ctx->g)
@@ -48,7 +57,7 @@ struct libxl__yajl_ctx {
 #  define DEBUG_GEN_REPORT(yajl_ctx) \
     do { \
         const unsigned char *buf = NULL; \
-        unsigned int len = 0; \
+        size_t len = 0; \
         yajl_gen_get_buf((yajl_ctx)->g, &buf, &len); \
         LIBXL__LOG(libxl__gc_owner((yajl_ctx)->gc), \
                    LIBXL__LOG_DEBUG, "response:\n%s", buf); \
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-10 15:26 [PATCH V2 0/4] libxl: fixes for JSON infrastructure Wei Liu
  2014-04-10 15:26 ` [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s) Wei Liu
  2014-04-10 15:26 ` [PATCH V2 2/4] libxl_json: fix JSON parser debug code Wei Liu
@ 2014-04-10 15:26 ` Wei Liu
  2014-04-14 16:47   ` Ian Campbell
  2014-04-14 16:53   ` Ian Campbell
  2014-04-10 15:26 ` [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event Wei Liu
  3 siblings, 2 replies; 20+ messages in thread
From: Wei Liu @ 2014-04-10 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, ian.jackson, ian.campbell

Without this the generated JSON is malformed.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/gentypes.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 1a3b91c..bfb95e2 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -220,6 +220,13 @@ def libxl_C_type_gen_json(ty, v, indent = "    ", parent = None):
             s += "case %s:\n" % f.enumname
             if f.type is not None:
                 s += libxl_C_type_gen_json(f.type, fexpr, indent + "    ", nparent)
+            else:
+                s += "    yajl_gen_map_open(hand);\n"
+                s += "    if (s != yajl_gen_status_ok)\n"
+                s += "        goto out;\n"
+                s += "    yajl_gen_map_close(hand);\n"
+                s += "    if (s != yajl_gen_status_ok)\n"
+                s += "        goto out;\n"
             s += "    break;\n"
         s += "}\n"
     elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None):
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event
  2014-04-10 15:26 [PATCH V2 0/4] libxl: fixes for JSON infrastructure Wei Liu
                   ` (2 preceding siblings ...)
  2014-04-10 15:26 ` [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Wei Liu
@ 2014-04-10 15:26 ` Wei Liu
  2014-04-14 16:49   ` Ian Campbell
  3 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-10 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, ian.jackson, ian.campbell

Now we generate empty map for None, the empty Struct trick is not
necessary anymore.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_types.idl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 612645c..d0b9ff0 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -596,5 +596,5 @@ libxl_event = Struct("event",[
            ("operation_complete", Struct(None, [
                                         ("rc", integer),
                                  ])),
-           ("domain_create_console_available", Struct(None, [])),
+           ("domain_create_console_available", None),
            ]))])
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s)
  2014-04-10 15:26 ` [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s) Wei Liu
@ 2014-04-14 16:46   ` Ian Campbell
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 16:46 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> Private types are only useful inside libxl. They don't have a valid JSON
> generation function by default.
> 
> Currently there's only one private type, that's libxl_ev_link. Not
> skipping this field causes testidl to fail as the code generated for
> this type is NULL.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 2/4] libxl_json: fix JSON parser debug code
  2014-04-10 15:26 ` [PATCH V2 2/4] libxl_json: fix JSON parser debug code Wei Liu
@ 2014-04-14 16:47   ` Ian Campbell
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 16:47 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> Two changes included:
> 1. implement DEBUG_GEN_ALLOC for YAJL2
> 2. use size_t for variable "len"
> 
> without these two fixes it fails to compile when DEBUG_ANSWER is
> defined.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-10 15:26 ` [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Wei Liu
@ 2014-04-14 16:47   ` Ian Campbell
  2014-04-14 16:53   ` Ian Campbell
  1 sibling, 0 replies; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 16:47 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> Without this the generated JSON is malformed.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event
  2014-04-10 15:26 ` [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event Wei Liu
@ 2014-04-14 16:49   ` Ian Campbell
  2014-04-14 16:54     ` Wei Liu
  0 siblings, 1 reply; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 16:49 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> Now we generate empty map for None, the empty Struct trick is not
> necessary anymore.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

But you've missed
            ("domain_death", Struct(None, [])),
in the same struct.

Arguably this is an API change -- but since the struct was 
        struct {
                } domain_create_console_available;

I don't think it is material enough to warrant a #define etc.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-10 15:26 ` [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Wei Liu
  2014-04-14 16:47   ` Ian Campbell
@ 2014-04-14 16:53   ` Ian Campbell
  2014-04-14 16:59     ` Wei Liu
  1 sibling, 1 reply; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 16:53 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> Without this the generated JSON is malformed.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Hold on the Ack...

> +            else:
> +                s += "    yajl_gen_map_open(hand);\n"

ITHM s =...

> +                s += "    if (s != yajl_gen_status_ok)\n"
> +                s += "        goto out;\n"
> +                s += "    yajl_gen_map_close(hand);\n"

and again.

Spotted because the diff of the generated code across the entire series
was as below, the spurious change is pretty obvious in the third hunk.

Ian.


--- tools/libxl/_libxl_BACKUP_types.c	2014-04-14 17:51:03.000000000 +0100
+++ tools/libxl/_libxl_types.c	2014-04-14 17:51:11.000000000 +0100
@@ -2523,6 +2523,12 @@ yajl_gen_status libxl_domain_build_info_
             goto out;
         break;
     case LIBXL_DOMAIN_TYPE_INVALID:
+        yajl_gen_map_open(hand);
+        if (s != yajl_gen_status_ok)
+            goto out;
+        yajl_gen_map_close(hand);
+        if (s != yajl_gen_status_ok)
+            goto out;
         break;
     }
     s = yajl_gen_map_close(hand);
@@ -3631,9 +3637,6 @@ yajl_gen_status libxl_event_gen_json(yaj
     s = yajl_gen_map_open(hand);
     if (s != yajl_gen_status_ok)
         goto out;
-    s = yajl_gen_string(hand, (const unsigned char *)"link", sizeof("link")-1);
-    if (s != yajl_gen_status_ok)
-        goto out;
     s = yajl_gen_string(hand, (const unsigned char *)"domid", sizeof("domid")-1);
     if (s != yajl_gen_status_ok)
         goto out;
@@ -3713,10 +3716,10 @@ yajl_gen_status libxl_event_gen_json(yaj
             goto out;
         break;
     case LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE:
-        s = yajl_gen_map_open(hand);
+        yajl_gen_map_open(hand);
         if (s != yajl_gen_status_ok)
             goto out;
-        s = yajl_gen_map_close(hand);
+        yajl_gen_map_close(hand);
         if (s != yajl_gen_status_ok)
             goto out;
         break;
--- tools/libxl/_libxl_BACKUP_types.h	2014-04-14 17:51:03.000000000 +0100
+++ tools/libxl/_libxl_types.h	2014-04-14 17:51:11.000000000 +0100
@@ -694,8 +694,6 @@ typedef struct libxl_event {
         struct {
             int rc;
         } operation_complete;
-        struct {
-        } domain_create_console_available;
     } u;
 } libxl_event;
 void libxl_event_dispose(libxl_event *p);

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event
  2014-04-14 16:49   ` Ian Campbell
@ 2014-04-14 16:54     ` Wei Liu
  2014-04-14 17:09       ` Ian Campbell
  0 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-14 16:54 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Wei Liu, xen-devel

On Mon, Apr 14, 2014 at 05:49:35PM +0100, Ian Campbell wrote:
> On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > Now we generate empty map for None, the empty Struct trick is not
> > necessary anymore.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> But you've missed
>             ("domain_death", Struct(None, [])),
> in the same struct.

Oops. My fault.

> 
> Arguably this is an API change -- but since the struct was 
>         struct {
>                 } domain_create_console_available;
> 
> I don't think it is material enough to warrant a #define etc.


---8<---
>From 2cfa7a3623847a431c0bf662a19e9eb2d9c79254 Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@citrix.com>
Date: Thu, 10 Apr 2014 16:20:22 +0100
Subject: [PATCH] libxl_types.idl: replace empty Struct with None for
 libxl_event

Now we generate empty map for None, the empty Struct trick is not
necessary anymore.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_types.idl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 612645c..0f7bbf8 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -588,7 +588,7 @@ libxl_event = Struct("event",[
           [("domain_shutdown", Struct(None, [
                                              ("shutdown_reason", uint8),
                                       ])),
-           ("domain_death", Struct(None, [])),
+           ("domain_death", None),
            ("disk_eject", Struct(None, [
                                         ("vdev", string),
                                         ("disk", libxl_device_disk),
@@ -596,5 +596,5 @@ libxl_event = Struct("event",[
            ("operation_complete", Struct(None, [
                                         ("rc", integer),
                                  ])),
-           ("domain_create_console_available", Struct(None, [])),
+           ("domain_create_console_available", None),
            ]))])
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-14 16:53   ` Ian Campbell
@ 2014-04-14 16:59     ` Wei Liu
  2014-04-14 17:08       ` Ian Campbell
  0 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-14 16:59 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Wei Liu, xen-devel

On Mon, Apr 14, 2014 at 05:53:11PM +0100, Ian Campbell wrote:
> On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > Without this the generated JSON is malformed.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Hold on the Ack...
> 
> > +            else:
> > +                s += "    yajl_gen_map_open(hand);\n"
> 
> ITHM s =...
> 
> > +                s += "    if (s != yajl_gen_status_ok)\n"
> > +                s += "        goto out;\n"
> > +                s += "    yajl_gen_map_close(hand);\n"
> 
> and again.
> 
> Spotted because the diff of the generated code across the entire series
> was as below, the spurious change is pretty obvious in the third hunk.
> 

I should've stolen your handy script earlier!

This one should be correct.

---8<---
>From eda04499a0b15d0a7549206834112823b59cf6f9 Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@citrix.com>
Date: Thu, 10 Apr 2014 16:18:00 +0100
Subject: [PATCH] libxl/gentypes.py: generate empty map for None field in
 keyed-union

Without this the generated JSON is malformed.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/gentypes.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 1a3b91c..917e2c2 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -220,6 +220,13 @@ def libxl_C_type_gen_json(ty, v, indent = "    ", parent = None):
             s += "case %s:\n" % f.enumname
             if f.type is not None:
                 s += libxl_C_type_gen_json(f.type, fexpr, indent + "    ", nparent)
+            else:
+                s += "    s = yajl_gen_map_open(hand);\n"
+                s += "    if (s != yajl_gen_status_ok)\n"
+                s += "        goto out;\n"
+                s += "    s = yajl_gen_map_close(hand);\n"
+                s += "    if (s != yajl_gen_status_ok)\n"
+                s += "        goto out;\n"
             s += "    break;\n"
         s += "}\n"
     elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None):
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-14 16:59     ` Wei Liu
@ 2014-04-14 17:08       ` Ian Campbell
  2014-04-14 17:11         ` Wei Liu
  2014-04-15 10:29         ` Ian Jackson
  0 siblings, 2 replies; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 17:08 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Mon, 2014-04-14 at 17:59 +0100, Wei Liu wrote:
> On Mon, Apr 14, 2014 at 05:53:11PM +0100, Ian Campbell wrote:
> > On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > > Without this the generated JSON is malformed.
> > > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > Hold on the Ack...
> > 
> > > +            else:
> > > +                s += "    yajl_gen_map_open(hand);\n"
> > 
> > ITHM s =...
> > 
> > > +                s += "    if (s != yajl_gen_status_ok)\n"
> > > +                s += "        goto out;\n"
> > > +                s += "    yajl_gen_map_close(hand);\n"
> > 
> > and again.
> > 
> > Spotted because the diff of the generated code across the entire series
> > was as below, the spurious change is pretty obvious in the third hunk.
> > 
> 
> I should've stolen your handy script earlier!

~ianc/xen-build-tools/libxl-idl-* if you still want to...

> This one should be correct.

Agreed, you can have that Ack back ;-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event
  2014-04-14 16:54     ` Wei Liu
@ 2014-04-14 17:09       ` Ian Campbell
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Campbell @ 2014-04-14 17:09 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Mon, 2014-04-14 at 17:54 +0100, Wei Liu wrote:
> On Mon, Apr 14, 2014 at 05:49:35PM +0100, Ian Campbell wrote:
> > On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > > Now we generate empty map for None, the empty Struct trick is not
> > > necessary anymore.
> > > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > 
> > But you've missed
> >             ("domain_death", Struct(None, [])),
> > in the same struct.
> 
> Oops. My fault.

No worries, you can keep the ack on the new version too.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-14 17:08       ` Ian Campbell
@ 2014-04-14 17:11         ` Wei Liu
  2014-04-16 16:30           ` Ian Campbell
  2014-04-15 10:29         ` Ian Jackson
  1 sibling, 1 reply; 20+ messages in thread
From: Wei Liu @ 2014-04-14 17:11 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Wei Liu, xen-devel

On Mon, Apr 14, 2014 at 06:08:50PM +0100, Ian Campbell wrote:
> On Mon, 2014-04-14 at 17:59 +0100, Wei Liu wrote:
> > On Mon, Apr 14, 2014 at 05:53:11PM +0100, Ian Campbell wrote:
> > > On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > > > Without this the generated JSON is malformed.
> > > > 
> > > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > 
> > > Hold on the Ack...
> > > 
> > > > +            else:
> > > > +                s += "    yajl_gen_map_open(hand);\n"
> > > 
> > > ITHM s =...
> > > 
> > > > +                s += "    if (s != yajl_gen_status_ok)\n"
> > > > +                s += "        goto out;\n"
> > > > +                s += "    yajl_gen_map_close(hand);\n"
> > > 
> > > and again.
> > > 
> > > Spotted because the diff of the generated code across the entire series
> > > was as below, the spurious change is pretty obvious in the third hunk.
> > > 
> > 
> > I should've stolen your handy script earlier!
> 
> ~ianc/xen-build-tools/libxl-idl-* if you still want to...
> 
> > This one should be correct.
> 
> Agreed, you can have that Ack back ;-)
> 

Do you want me to resend the whole series with all Acks folded in?

Wei.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-14 17:08       ` Ian Campbell
  2014-04-14 17:11         ` Wei Liu
@ 2014-04-15 10:29         ` Ian Jackson
  2014-04-15 10:32           ` Ian Campbell
  1 sibling, 1 reply; 20+ messages in thread
From: Ian Jackson @ 2014-04-15 10:29 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Wei Liu, xen-devel

Ian Campbell writes ("Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union"):
> On Mon, 2014-04-14 at 17:59 +0100, Wei Liu wrote:
> > I should've stolen your handy script earlier!
> 
> ~ianc/xen-build-tools/libxl-idl-* if you still want to...

Can we check this into the tree ?

Ian.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-15 10:29         ` Ian Jackson
@ 2014-04-15 10:32           ` Ian Campbell
  2014-04-15 11:29             ` Ian Jackson
  0 siblings, 1 reply; 20+ messages in thread
From: Ian Campbell @ 2014-04-15 10:32 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Wei Liu, xen-devel

On Tue, 2014-04-15 at 11:29 +0100, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union"):
> > On Mon, 2014-04-14 at 17:59 +0100, Wei Liu wrote:
> > > I should've stolen your handy script earlier!
> > 
> > ~ianc/xen-build-tools/libxl-idl-* if you still want to...
> 
> Can we check this into the tree ?

They are pretty dumb, but we can if you like. Here they are for
prejudgement...


----- libxl-idl-save-baseline ------
#!/bin/bash

set -e

for i in tools/libxl/_libxl_types.c tools/libxl/_libxl_types.h tools/libxl/_libxl_types_json.h \
         tools/libxl/_libxl_types_internal.c tools/libxl/_libxl_types_internal.h tools/libxl/_libxl_types_internal_json.h \
         tools/python/xen/lowlevel/xl/_pyxl_types.h tools/python/xen/lowlevel/xl/_pyxl_types.c \
         tools/ocaml/libs/xl/_libxl_types.inc  tools/ocaml/libs/xl/_libxl_types.mli.in  tools/ocaml/libs/xl/_libxl_types.ml.in \
         tools/libxl/testidl.c \
tools/libxl/_libxl_save_msgs_callout.c tools/libxl/_libxl_save_msgs_callout.h tools/libxl/_libxl_save_msgs_helper.c tools/libxl/_libxl_save_msgs_helper.h ; do

    bak=$(echo $i | sed -e 's,[^/]*/\(_libxl\|_pyxl\|testidl\),&_BACKUP,g')
    if [ -e "$i" ] ; then
	cp -v "$i" "$bak"
    else
	rm -f "$bak"
	echo touch "$bak"
	touch "$bak"
    fi
done

----- libxl-idl-compare-baseline -----
#!/bin/bash

set -e

for i in tools/libxl/_libxl_types.c tools/libxl/_libxl_types.h tools/libxl/_libxl_types_json.h \
         tools/libxl/_libxl_types_internal.c tools/libxl/_libxl_types_internal.h tools/libxl/_libxl_types_internal_json.h \
         tools/python/xen/lowlevel/xl/_pyxl_types.h tools/python/xen/lowlevel/xl/_pyxl_types.c \
         tools/ocaml/libs/xl/_libxl_types.inc  tools/ocaml/libs/xl/_libxl_types.mli.in  tools/ocaml/libs/xl/_libxl_types.ml.in \
         tools/libxl/testidl.c \
tools/libxl/_libxl_save_msgs_callout.c tools/libxl/_libxl_save_msgs_callout.h tools/libxl/_libxl_save_msgs_helper.c tools/libxl/_libxl_save_msgs_helper.h ; do

    bak=$(echo $i | sed -e 's,[^/]*/\(_libxl\|_pyxl\|testidl\),&_BACKUP,g')

    diff -puN $bak $i || true
done

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-15 10:32           ` Ian Campbell
@ 2014-04-15 11:29             ` Ian Jackson
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Jackson @ 2014-04-15 11:29 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Wei Liu, xen-devel

Ian Campbell writes ("Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union"):
> They are pretty dumb, but we can if you like. Here they are for
> prejudgement...

Quite ugly, I agree.  But I think it's better to have them in-tree
where they can be shared and improved, than floating about on some NFS
filer in the Citrix Cambridge office.

TBH it might be possible to do in the Makefile but I think that's a
task for another day.

Ian.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-14 17:11         ` Wei Liu
@ 2014-04-16 16:30           ` Ian Campbell
  2014-04-16 16:36             ` Wei Liu
  0 siblings, 1 reply; 20+ messages in thread
From: Ian Campbell @ 2014-04-16 16:30 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, xen-devel

On Mon, 2014-04-14 at 18:11 +0100, Wei Liu wrote:
> On Mon, Apr 14, 2014 at 06:08:50PM +0100, Ian Campbell wrote:
> > On Mon, 2014-04-14 at 17:59 +0100, Wei Liu wrote:
> > > On Mon, Apr 14, 2014 at 05:53:11PM +0100, Ian Campbell wrote:
> > > > On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote:
> > > > > Without this the generated JSON is malformed.
> > > > > 
> > > > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > > 
> > > > Hold on the Ack...
> > > > 
> > > > > +            else:
> > > > > +                s += "    yajl_gen_map_open(hand);\n"
> > > > 
> > > > ITHM s =...
> > > > 
> > > > > +                s += "    if (s != yajl_gen_status_ok)\n"
> > > > > +                s += "        goto out;\n"
> > > > > +                s += "    yajl_gen_map_close(hand);\n"
> > > > 
> > > > and again.
> > > > 
> > > > Spotted because the diff of the generated code across the entire series
> > > > was as below, the spurious change is pretty obvious in the third hunk.
> > > > 
> > > 
> > > I should've stolen your handy script earlier!
> > 
> > ~ianc/xen-build-tools/libxl-idl-* if you still want to...
> > 
> > > This one should be correct.
> > 
> > Agreed, you can have that Ack back ;-)
> > 
> 
> Do you want me to resend the whole series with all Acks folded in?

No need, I've applied. Please check I got the right versions of
everything!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
  2014-04-16 16:30           ` Ian Campbell
@ 2014-04-16 16:36             ` Wei Liu
  0 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2014-04-16 16:36 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Wei Liu, xen-devel

On Wed, Apr 16, 2014 at 05:30:21PM +0100, Ian Campbell wrote:
[...]
> No need, I've applied. Please check I got the right versions of
> everything!
> 

I've checked. You checked in the correct version. Thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-04-16 16:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 15:26 [PATCH V2 0/4] libxl: fixes for JSON infrastructure Wei Liu
2014-04-10 15:26 ` [PATCH V2 1/4] libxl/gentypes.py: don't generate JSON for private type(s) Wei Liu
2014-04-14 16:46   ` Ian Campbell
2014-04-10 15:26 ` [PATCH V2 2/4] libxl_json: fix JSON parser debug code Wei Liu
2014-04-14 16:47   ` Ian Campbell
2014-04-10 15:26 ` [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Wei Liu
2014-04-14 16:47   ` Ian Campbell
2014-04-14 16:53   ` Ian Campbell
2014-04-14 16:59     ` Wei Liu
2014-04-14 17:08       ` Ian Campbell
2014-04-14 17:11         ` Wei Liu
2014-04-16 16:30           ` Ian Campbell
2014-04-16 16:36             ` Wei Liu
2014-04-15 10:29         ` Ian Jackson
2014-04-15 10:32           ` Ian Campbell
2014-04-15 11:29             ` Ian Jackson
2014-04-10 15:26 ` [PATCH V2 4/4] libxl_types.idl: replace empty Struct with None for libxl_event Wei Liu
2014-04-14 16:49   ` Ian Campbell
2014-04-14 16:54     ` Wei Liu
2014-04-14 17:09       ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.