From ff5397bc72a1716bb34302dd470343ebee7d6bf2 Mon Sep 17 00:00:00 2001 From: Martin Cerveny Date: Wed, 13 May 2015 14:14:54 +0200 Subject: scripts: Add support for path as argument of qom-tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add processing of optional argument path as "tree base". Signed-off-by: Martin Cerveny Signed-off-by: Andreas Färber --- scripts/qmp/qom-tree | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree index aea11d4..906fcd2 100755 --- a/scripts/qmp/qom-tree +++ b/scripts/qmp/qom-tree @@ -65,6 +65,11 @@ def list_node(path): print '' for item in items: if item['type'].startswith('child<'): - list_node(path + '/' + item['name']) + list_node((path if (path != '/') else '') + '/' + item['name']) -list_node('/machine') +if len(args) == 0: + path = '/' +else: + path = args[0] + +list_node(path) -- cgit v1.1 From 2e4450ff432daef524cb3557fca68a3b7b5c7823 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 13 May 2015 17:14:07 +0100 Subject: qom: Make enum string tables const-correct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The enum string table parameters in various QOM/QAPI methods are declared 'const char *strings[]'. This results in const warnings if passed a variable that was declared as static const char * const strings[] = { .... }; Add the extra const annotation to the parameters, since neither the string elements, nor the array itself should ever be modified. Signed-off-by: Daniel P. Berrange Reviewed-by: Eric Blake Signed-off-by: Andreas Färber --- scripts/qapi-types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index d28a6b0..e6eb4b6 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -105,7 +105,7 @@ struct %(name)s def generate_enum_lookup(name, values): ret = mcgen(''' -const char *%(name)s_lookup[] = { +const char * const %(name)s_lookup[] = { ''', name=c_name(name)) i = 0 @@ -128,7 +128,7 @@ const char *%(name)s_lookup[] = { def generate_enum(name, values): name = c_name(name) lookup_decl = mcgen(''' -extern const char *%(name)s_lookup[]; +extern const char * const %(name)s_lookup[]; ''', name=name) -- cgit v1.1