From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjNOt-0001tK-Gi for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjNOr-0002oa-Jq for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjNOr-0002oT-ER for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:37 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B3F8C0096E5 for ; Mon, 12 Sep 2016 09:19:37 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 12 Sep 2016 13:19:01 +0400 Message-Id: <20160912091913.15831-7-marcandre.lureau@redhat.com> In-Reply-To: <20160912091913.15831-1-marcandre.lureau@redhat.com> References: <20160912091913.15831-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v6 06/18] qapi: Support unregistering QMP commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, armbru@redhat.com From: Markus Armbruster Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- qapi/qmp-registry.c | 8 ++++++++ include/qapi/qmp/dispatch.h | 1 + 2 files changed, 9 insertions(+) diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 68b24c9..e805368 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -30,6 +30,14 @@ void qmp_register_command(const char *name, QmpCommand= Func *fn, QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node); } =20 +void qmp_unregister_command(const char *name) +{ + QmpCommand *cmd =3D qmp_find_command(name); + + QTAILQ_REMOVE(&qmp_commands, cmd, node); + g_free(cmd); +} + QmpCommand *qmp_find_command(const char *name) { QmpCommand *cmd; diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 48c11b6..57651ea 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -36,6 +36,7 @@ typedef struct QmpCommand =20 void qmp_register_command(const char *name, QmpCommandFunc *fn, QmpCommandOptions options); +void qmp_unregister_command(const char *name); QmpCommand *qmp_find_command(const char *name); QObject *qmp_dispatch(QObject *request); void qmp_disable_command(const char *name); --=20 2.10.0