From patchwork Fri Jan 29 13:48:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 8163451 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 322C09F440 for ; Fri, 29 Jan 2016 13:57:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0FFB620131 for ; Fri, 29 Jan 2016 13:57:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4AFE2024F for ; Fri, 29 Jan 2016 13:56:59 +0000 (UTC) Received: from localhost ([::1]:34292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP9Xn-0000wt-2x for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Jan 2016 08:56:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP9QQ-0003sG-Ff for qemu-devel@nongnu.org; Fri, 29 Jan 2016 08:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aP9QO-0001MB-Bs for qemu-devel@nongnu.org; Fri, 29 Jan 2016 08:49:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP9QO-0001Ly-2a; Fri, 29 Jan 2016 08:49:20 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 8D0F8C06C9CA; Fri, 29 Jan 2016 13:49:19 +0000 (UTC) Received: from red.redhat.com (ovpn-113-130.phx2.redhat.com [10.3.113.130]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0TDn5FV019157; Fri, 29 Jan 2016 08:49:18 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 29 Jan 2016 06:48:57 -0700 Message-Id: <1454075341-13658-22-git-send-email-eblake@redhat.com> In-Reply-To: <1454075341-13658-1-git-send-email-eblake@redhat.com> References: <1454075341-13658-1-git-send-email-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Michael Roth , "Michael S. Tsirkin" , Alexander Graf , armbru@redhat.com, "open list:sPAPR" , Paolo Bonzini , marcandre.lureau@redhat.com, Luiz Capitulino , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson Subject: [Qemu-devel] [PATCH v10 21/25] qapi: Drop unused 'kind' for struct/enum visit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP visit_start_struct() and visit_type_enum() had a 'kind' argument that was usually set to either the stringized version of the corresponding qapi type name, or to NULL (although some clients didn't even get that right). But nothing ever used the argument. It's even hard to argue that it would be useful in a debugger, as a stack backtrace also tells which type is being visited. Therefore, drop the 'kind' argument as dead. Signed-off-by: Eric Blake Reviewed-by: Marc-André Lureau --- v10: rebase to earlier changes, tweak copyright v9: no change v8: rebase to 'name' motion v7: new patch --- include/qapi/visitor.h | 5 ++--- include/qapi/visitor-impl.h | 11 ++++------- scripts/qapi-event.py | 2 +- scripts/qapi-visit.py | 12 ++++++------ qapi/qapi-visit-core.c | 16 +++++++--------- hmp.c | 2 +- hw/core/qdev-properties.c | 6 ++---- hw/ppc/spapr_drc.c | 4 ++-- hw/virtio/virtio-balloon.c | 4 ++-- qapi/opts-visitor.c | 2 +- qapi/qapi-dealloc-visitor.c | 6 ++---- qapi/qmp-input-visitor.c | 2 +- qapi/qmp-output-visitor.c | 3 +-- qom/object.c | 8 ++++---- vl.c | 2 +- 15 files changed, 37 insertions(+), 48 deletions(-) diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 0b5cd41..997555d 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -28,7 +28,7 @@ typedef struct GenericList } GenericList; void visit_start_struct(Visitor *v, const char *name, void **obj, - const char *kind, size_t size, Error **errp); + size_t size, Error **errp); void visit_end_struct(Visitor *v, Error **errp); void visit_start_implicit_struct(Visitor *v, void **obj, size_t size, Error **errp); @@ -54,8 +54,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present); void visit_get_next_type(Visitor *v, const char *name, QType *type, bool promote_int, Error **errp); void visit_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp); + const char *const strings[], Error **errp); void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp); void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj, Error **errp); diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 734cc13..337f999 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -19,7 +19,7 @@ struct Visitor { /* Must be set */ void (*start_struct)(Visitor *v, const char *name, void **obj, - const char *kind, size_t size, Error **errp); + size_t size, Error **errp); void (*end_struct)(Visitor *v, Error **errp); void (*start_implicit_struct)(Visitor *v, void **obj, size_t size, @@ -31,8 +31,7 @@ struct Visitor void (*end_list)(Visitor *v, Error **errp); void (*type_enum)(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp); + const char *const strings[], Error **errp); /* May be NULL; only needed for input visitors. */ void (*get_next_type)(Visitor *v, const char *name, QType *type, bool promote_int, Error **errp); @@ -61,10 +60,8 @@ struct Visitor }; void input_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp); + const char *const strings[], Error **errp); void output_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp); + const char *const strings[], Error **errp); #endif diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index edd446b..07bcb73 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -63,7 +63,7 @@ def gen_event_send(name, arg_type): qov = qmp_output_visitor_new(); v = qmp_output_get_visitor(qov); - visit_start_struct(v, "%(name)s", NULL, NULL, 0, &err); + visit_start_struct(v, "%(name)s", NULL, 0, &err); ''', name=name) ret += gen_err_check() diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 35505ac..308000f 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -122,7 +122,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error { Error *err = NULL; - visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err); + visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err); if (err) { goto out; } @@ -138,7 +138,7 @@ out: error_propagate(errp, err); } ''', - name=name, c_name=c_name(name)) + c_name=c_name(name)) return ret @@ -183,11 +183,11 @@ def gen_visit_enum(name): void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error **errp) { int value = *obj; - visit_type_enum(v, name, &value, %(c_name)s_lookup, "%(name)s", errp); + visit_type_enum(v, name, &value, %(c_name)s_lookup, errp); *obj = value; } ''', - c_name=c_name(name), name=name) + c_name=c_name(name)) def gen_visit_alternate(name, variants): @@ -259,7 +259,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error { Error *err = NULL; - visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err); + visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err); if (err) { goto out; } @@ -267,7 +267,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error goto out_obj; } ''', - c_name=c_name(name), name=name) + c_name=c_name(name)) if base: ret += mcgen(''' diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 23ff6a9..2999995 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -3,6 +3,7 @@ * * Copyright (C) 2012-2016 Red Hat, Inc. * Copyright IBM, Corp. 2011 + * Copyright (C) 2015 Red Hat, Inc. * * Authors: * Anthony Liguori @@ -19,9 +20,9 @@ #include "qapi/visitor-impl.h" void visit_start_struct(Visitor *v, const char *name, void **obj, - const char *kind, size_t size, Error **errp) + size_t size, Error **errp) { - v->start_struct(v, name, obj, kind, size, errp); + v->start_struct(v, name, obj, size, errp); } void visit_end_struct(Visitor *v, Error **errp) @@ -84,10 +85,9 @@ void visit_get_next_type(Visitor *v, const char *name, QType *type, } void visit_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp) + const char *const strings[], Error **errp) { - v->type_enum(v, name, obj, strings, kind, errp); + v->type_enum(v, name, obj, strings, errp); } void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp) @@ -221,8 +221,7 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp) } void output_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp) + const char *const strings[], Error **errp) { int i = 0; int value = *obj; @@ -240,8 +239,7 @@ void output_type_enum(Visitor *v, const char *name, int *obj, } void input_type_enum(Visitor *v, const char *name, int *obj, - const char *const strings[], const char *kind, - Error **errp) + const char *const strings[], Error **errp) { Error *local_err = NULL; int64_t value = 0; diff --git a/hmp.c b/hmp.c index 3beea3a..a4b74df 100644 --- a/hmp.c +++ b/hmp.c @@ -1669,7 +1669,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict) pdict = qdict_clone_shallow(qdict); v = opts_get_visitor(ov); - visit_start_struct(v, NULL, NULL, NULL, 0, &err); + visit_start_struct(v, NULL, NULL, 0, &err); if (err) { goto out_clean; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 9104645..49cf568 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -48,8 +48,7 @@ static void get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Property *prop = opaque; int *ptr = qdev_get_prop_ptr(dev, prop); - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, - prop->info->name, errp); + visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque, @@ -64,8 +63,7 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, - prop->info->name, errp); + visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } /* Bit */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 9ef603b..78d71e2 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -259,7 +259,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name, void *fdt; if (!drc->fdt) { - visit_start_struct(v, name, NULL, NULL, 0, &err); + visit_start_struct(v, name, NULL, 0, &err); if (!err) { visit_end_struct(v, &err); } @@ -282,7 +282,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name, case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); - visit_start_struct(v, name, NULL, NULL, 0, &err); + visit_start_struct(v, name, NULL, 0, &err); if (err) { error_propagate(errp, err); return; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index c8a104e..5f01dda 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -117,7 +117,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name, VirtIOBalloon *s = opaque; int i; - visit_start_struct(v, name, NULL, "guest-stats", 0, &err); + visit_start_struct(v, name, NULL, 0, &err); if (err) { goto out; } @@ -126,7 +126,7 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name, goto out_end; } - visit_start_struct(v, "stats", NULL, NULL, 0, &err); + visit_start_struct(v, "stats", NULL, 0, &err); if (err) { goto out_end; } diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index b1c8e50..6d4a91e 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -124,7 +124,7 @@ opts_visitor_insert(GHashTable *unprocessed_opts, const QemuOpt *opt) static void -opts_start_struct(Visitor *v, const char *name, void **obj, const char *kind, +opts_start_struct(Visitor *v, const char *name, void **obj, size_t size, Error **errp) { OptsVisitor *ov = to_ov(v); diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index b521f7c..49e7cf0 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -59,8 +59,7 @@ static void *qapi_dealloc_pop(QapiDeallocVisitor *qov) } static void qapi_dealloc_start_struct(Visitor *v, const char *name, void **obj, - const char *kind, size_t unused, - Error **errp) + size_t unused, Error **errp) { QapiDeallocVisitor *qov = to_qov(v); qapi_dealloc_push(qov, obj); @@ -164,8 +163,7 @@ static void qapi_dealloc_type_anything(Visitor *v, const char *name, } static void qapi_dealloc_type_enum(Visitor *v, const char *name, int *obj, - const char * const strings[], - const char *kind, Error **errp) + const char * const strings[], Error **errp) { } diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index de77740..bf25249 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -115,7 +115,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp) } static void qmp_input_start_struct(Visitor *v, const char *name, void **obj, - const char *kind, size_t size, Error **errp) + size_t size, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c index af600a9..db5e618 100644 --- a/qapi/qmp-output-visitor.c +++ b/qapi/qmp-output-visitor.c @@ -111,8 +111,7 @@ static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name, } static void qmp_output_start_struct(Visitor *v, const char *name, void **obj, - const char *kind, size_t unused, - Error **errp) + size_t unused, Error **errp) { QmpOutputVisitor *qov = to_qov(v); QDict *dict = qdict_new(); diff --git a/qom/object.c b/qom/object.c index 55b3955..e5b0566 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1244,7 +1244,7 @@ int object_property_get_enum(Object *obj, const char *name, siv = string_input_visitor_new(str); string_output_visitor_cleanup(sov); visit_type_enum(string_input_get_visitor(siv), name, &ret, - enumprop->strings, NULL, errp); + enumprop->strings, errp); g_free(str); string_input_visitor_cleanup(siv); @@ -1915,7 +1915,7 @@ static void property_get_enum(Object *obj, Visitor *v, const char *name, return; } - visit_type_enum(v, name, &value, prop->strings, NULL, errp); + visit_type_enum(v, name, &value, prop->strings, errp); } static void property_set_enum(Object *obj, Visitor *v, const char *name, @@ -1925,7 +1925,7 @@ static void property_set_enum(Object *obj, Visitor *v, const char *name, int value; Error *err = NULL; - visit_type_enum(v, name, &value, prop->strings, NULL, &err); + visit_type_enum(v, name, &value, prop->strings, &err); if (err) { error_propagate(errp, err); return; @@ -2006,7 +2006,7 @@ static void property_get_tm(Object *obj, Visitor *v, const char *name, goto out; } - visit_start_struct(v, name, NULL, "struct tm", 0, &err); + visit_start_struct(v, name, NULL, 0, &err); if (err) { goto out; } diff --git a/vl.c b/vl.c index 49ec0de..22062b5 100644 --- a/vl.c +++ b/vl.c @@ -2834,7 +2834,7 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp) pdict = qemu_opts_to_qdict(opts, NULL); v = opts_get_visitor(ov); - visit_start_struct(v, NULL, NULL, NULL, 0, &err); + visit_start_struct(v, NULL, NULL, 0, &err); if (err) { goto out; }