From patchwork Tue May 30 13:58:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9754649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23899602B9 for ; Tue, 30 May 2017 14:09:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1582E1FE76 for ; Tue, 30 May 2017 14:09:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A3CC1FFAD; Tue, 30 May 2017 14:09:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C0611FE76 for ; Tue, 30 May 2017 14:09:06 +0000 (UTC) Received: from localhost ([::1]:54034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhpZ-0004UH-W8 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 May 2017 10:09:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhfc-0005G7-Gf for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFhfX-0007IH-Vu for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:48 -0400 Received: from mail-he1eur01on0136.outbound.protection.outlook.com ([104.47.0.136]:15171 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFhfX-0007GL-Ny for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fHOsjtbbexUTRvtXIXTVqutddpuFaCRmst3ZdrqFH1s=; b=DbThBst6Jup4ilk8hHJaIezpQ3htizEiduZmW4xIINxCz75pyn1xtele+rrh0RmfBQQC8qw1B4rqSwrK01qnnJbpXTl4MU28txvGUjHt/KQ3RaxHRgoJSJCXeN0qVwRkOVfNC4FMsmBlXEG9bZu9Y6jhzARYLURHjoNx27zC+Do= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Tue, 30 May 2017 13:58:34 +0000 From: Anton Nefedov To: Date: Tue, 30 May 2017 16:58:00 +0300 Message-ID: <1496152683-102751-11-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496152683-102751-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1496152683-102751-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR02CA0033.eurprd02.prod.outlook.com (2603:10a6:6:15::46) To HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1993: X-MS-Office365-Filtering-Correlation-Id: db2c20f0-6c0d-4caf-ff7b-08d4a763f70a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 3:WFjJqJl94udLoOecbuzKW/KBqtCFROxwGfIVoIIfy52kXwaUk9XyGiFoZeg4yEUBYFNXwtdt43L9JZV++HZXfRDXP1vWiAQfE1AUPb+EuRGZqfXdA1sTLVnOmY1OXIwYsc1iYH6PzYQqoJusjwyDwSbXTxnXKwxzgDXUdeFUGFwPmXGHJqokv99/WTmpCGbrwt4kMlZrzeq23u3KmMtc3LaxG5ZRir6c+RT509ExkPeU47L2qGY7SLp3awKX0qZIWWEdbfcKxHG7RRtO5RuxajTDejrarih135o7E6jEbMmUMoyvzwme6j0SomN1i8XSDsmY/3/SjC7RsugQILaf/g==; 25:VaC8A++ltbSlw5CIAanG/9OKFLj/0rsizDq0kPlFE4rhTW42w3hPNuLyy7K9MSbLJRWuVDfOnCfxSPuhop870EL8oXklj1YrVJ+RPgOkULKkWEEDhl6VhAF/Hlt1Sxq5yu4/WE19R1adwxf62mamDK7CP/+EEiYssTbyaxts4pkpa+0KNQK/7+XpFIcSYsOkWsadtSEeIeKuFnK02AeTBwaMMlGcetg5rL60AmPAkKk79VMss6VRzz97JgVYe4bjX3D1e+d9w209mBuPoJQafPDt7ln+7GtJeA8dzlVMnXlmwV2p9/3Zw6L/pPAxufjKn7a6cQq27eVvx563XrdKVVUJt7c80UqqGAppEuODEwQkoYqdPzLYhg+XKMekkDPaDu1wfv1vlDgNitLpt3dAaSoaxsl0cz2z5ouXDDE0wwdXGBHP/yWQunMRmeksusQVtTPKv7Kts2CGZ0dZXI8FE9ZnvDJUiLHeC4hgiODPFMk= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 31:3oL8KsznKodLWBjP0eqagCPdqw2OfeagWpE1gxDOYlxHh2M9qjyATCLLIudRC4SHmzbhmBCtLMHdPUIyRZ6CLIal/5RE5tZoaJVbqUoyJpXjzoXRm4m+qr/dJFZkf1Zo+GomhAvaoRemwSNPm6O99hBP5sg8D6UEa6szX+owc6wJiOq3ADH3Ih2bNfpi9yDE2gYs5sN8Dl+Jsi2INVRloTQX4ApYDypjKgGDD7fAom8=; 20:fQKrPq7VJ/d/fY8ORoRH/fhW56kxaHgjzsiJYTRVIadcfWBq+8d1zi8sZg6AZ01btfKAqkqGgux/QziBMtJP7A6FoXqMJPK7yLTwUDWPxphSnqOQ2ORGmTDMCnFfoVJK5atHQQutUGymSReXtk/B0q4cB4WyDW9WX/uPf5f8/IoHlL//5wQ6NGi/QnwG9I5vrCdoH1Mvdhdu0QLf+2Dtif0SAsjR/HmAUTwr7oTfmXmsBFZXvD8dsK4uNWRxVApPY3Oz36F7if7lFFVL8TCpeAAPyJHsn7gjo+hjWSB2ZuAHIoBOCU53LqPBkCOMDFdYlOK2tZvFjANyxc99/4GJZUPUX5gpCkUpMrQhYovnCsik85d0uayQVv0lz6/09XbA2mCb5JvbyHSFilMP7ucHyH6+ZFsS6c4jtQydFq6SOU4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700073)(100105000095)(100000701073)(100105300095)(100000702073)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703073)(100105400095)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123558100)(20161123555025)(6072148)(100000704073)(100105200095)(100000705073)(100105500095); SRVR:HE1PR0801MB1993; BCL:0; PCL:0; RULEID:(100000800073)(100110000095)(100000801073)(100110300095)(100000802073)(100110100095)(100000803073)(100110400095)(100000804073)(100110200095)(100000805073)(100110500095); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1993; 4:GX3VB3YnFcUOi/ndK/B0f6WV6/RGieeki423O832?= =?us-ascii?Q?HKHED5oF0R5mo8XqqDnhWRJytJn9UCo6jV42upVEgVcRsa18cTp67OxM1a0Z?= =?us-ascii?Q?yBb4lWQyvrgfJwT8o3eG/C6CjWx8uvYIK5cUmOYREbaaymyiwRPMeke3bpsQ?= =?us-ascii?Q?i27PhwPZSCWmB+VUcF7bedJvPzthXkCW+4dB7yp1foewfoCzKCz9Xey/38RT?= =?us-ascii?Q?X3Z1M1x9H136R4/hEFe28dWSvM6Lo3dYcspXLqpKMD0Gh9GgGLWlSF5jTX3e?= =?us-ascii?Q?f1ZG6gWR9SPOELDkcNaHFrQDj+kXVZimjTFWm2dA0r3FbWYwK0ZTNOQhIRPR?= =?us-ascii?Q?b48LMp59+LAqlk7SDiT00qTX5FIY8tRzZtXpP/pkbDL5fpeHBQFINxNzEOoZ?= =?us-ascii?Q?SV774XLDPz7hksJz3Cgvv0ZWod5izSaUxcdbtSGs+PGQCCsjJbc16D+h1unl?= =?us-ascii?Q?ddzDg5VQNYmp4gdO1hSNeQWgjFkeW1sB4/ffOCRth95bMGiyZ+WxcYeE6bRi?= =?us-ascii?Q?2vAlkTyz3vg2lM9VV9JgirunBHSfYBIViDoc1y7nxQOd+5+QaO1du4pDHWCa?= =?us-ascii?Q?9NPkEr4gQGSrOeVgGuv1wozeLIs3MpqkQKDBD8z0QAUDchWg1b7RGTswTqO9?= =?us-ascii?Q?MhYD9AXEIt50ntU/AAFWddz+IP3cNxCL/wEtUwA/Zun7w6eHQ4HcoxbSiR5K?= =?us-ascii?Q?2dXBeR+IptkfmjP6HvvfqRl3zdZgOm+Ld2R/ZKNDvDM42i7+kxf97LmJ4dxw?= =?us-ascii?Q?Ry1siPLMsJWTFCBdYUHh5PBpt+0i3mW/eIEZM+dZ8X8NgGlCbjV4HWM12kLX?= =?us-ascii?Q?JsraDRctd+utCyZSu9FqJxJp1iHq6I3l5/8NG+wQ3U+Yr0zAVOIwOuHKSLnF?= =?us-ascii?Q?E1PtOSLwfnGqjXO5hSSFnwqX2YntvbJmq0TkcDie4Bn5WEZrG/AURSXNJ1d7?= =?us-ascii?Q?+i0LQJiRwaOJ61cU6UaN7Mnd7nEigR7VrnXk1fOreGu4PMUDgGRuyqmxvRRE?= =?us-ascii?Q?N4LTxNafi6LnP8R3px7stNHLaYb28b85kVNqTc1K+ZaGzJiVcKEeb1QWnn53?= =?us-ascii?Q?P5QnOgYWEZqcj2+ULCdDWpeiwggX4xaiBq2Lzh1DTmyW/m/Flf1y7bWZopMX?= =?us-ascii?Q?/jeNw6pITAWu+N+aOh5jXfOFwI3BFaCi?= X-Forefront-PRVS: 032334F434 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39830400002)(39450400003)(39410400002)(39400400002)(6506006)(6486002)(86362001)(230783001)(6916009)(2950100002)(6666003)(54906002)(38730400002)(53936002)(6512007)(25786009)(478600001)(5660300001)(47776003)(305945005)(7736002)(66066001)(5003940100001)(110136004)(189998001)(2906002)(4326008)(50226002)(3846002)(8676002)(81166006)(6116002)(53416004)(50466002)(2351001)(48376002)(76176999)(42186005)(50986999)(33646002)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1993; H:xantnef-ws.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1993; 23:Bh/qoytFE2aZpMfYnwE3xg2hhLyU9L1zcOsrBbs?= =?us-ascii?Q?CHBuSELctBrRiBG7GJ68UAd9TLwj7xsAszAM/otBrE9YHIT4RQNPGA1ZEzUn?= =?us-ascii?Q?izEcut6j4nlCEaHv4nlT9QQ2sPbeq2v1pPyue0MXLM+ZhLqe8mkz7sNsmhrG?= =?us-ascii?Q?O3yKvDQEZ2a2NpLIRPKURoVSYY+F9GWgAJ+/A8Qhr6Q+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EJlWli4M7fDtTx4YcR1QvKkq/K/3zoKmMlzJWkFrT1Ifjt1DVBbIPeKk6SE+RR8seP; 24:66yXW0SwH/w8k0WbLJ+KzOjsg7voKdIl9wbtLgoUj6f3Bds3srD7abgd4q4An0qzai/Wtrs2d8VZOPaqVopmkOFqCQjPGiWdK74SA6/LS7Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 7:Pjr/XzuTjW+lcDA8prPG0QLhEcs+iYpZDnLIY0XPJbsYFUtvFNARnfQITmHjDnj+d6kcPUQ3DFJyE6fsnkEPpLu55VpKr0AocDM5yrTGoa/GlesOALVNrR4quWiN03zfMe3/t9QJ/GH+ZRyG49Q60Wo4xL9gnGQXk8tzbXxw2zrDA2AJo8DCgqmTsK+BT0vD5V9ypaHmnxo7YDRUDR3QNRvLwiiYeaXIGvPmzKUgBz8DE9rmD1prQZ8pqu8PEZberu7khZqCMtOM+UIWdK2Rcfr85+HqNZdb4ntFYfZ7X50JBlkXMLXnJMMmfbjQ33FM7s8yuLYdbFJWZY2KW00oSg==; 20:CnaIHcPT52B8WGZOwqJe2oNOk4k0jPzKO7m+pTcjuPOA9bfZZgi9EHQQZeB4ALWgsvbewH2ZoJKfANo5Jw0g42s78694FZFIFfppdbpP5l1ll2UKXqOjqu/goRD1fm6sZFQB9i/GLnL9hmobIArWRW4MSP//K40cm3peeCGhIh8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2017 13:58:34.5489 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1993 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.136 Subject: [Qemu-devel] [PATCH v3 10/13] hmp: add hmp analogue for qmp-chardev-change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Anton Nefedov , den@virtuozzo.com, "Dr . David Alan Gilbert" , marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy CC: Dr. David Alan Gilbert --- chardev/char.c | 2 +- hmp-commands.hx | 16 ++++++++++++++++ hmp.c | 34 ++++++++++++++++++++++++++++++++++ hmp.h | 1 + include/sysemu/char.h | 12 ++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/chardev/char.c b/chardev/char.c index 2d6e204..1e2a2dd 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -888,7 +888,7 @@ help_string_append(const char *name, void *opaque) g_string_append_printf(str, "\n%s", name); } -static ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp) +ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp) { Error *local_err = NULL; const ChardevClass *cc; diff --git a/hmp-commands.hx b/hmp-commands.hx index baeac47..19bfddd 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1727,6 +1727,22 @@ chardev_add accepts the same parameters as the -chardev command line switch. ETEXI { + .name = "chardev-change", + .args_type = "id:s,args:s", + .params = "id args", + .help = "change chardev", + .cmd = hmp_chardev_change, + }, + +STEXI +@item chardev-change args +@findex chardev-change +chardev_change accepts existing chardev @var{id} and then the same arguments +as the -chardev command line switch (except for "id"). + +ETEXI + + { .name = "chardev-remove", .args_type = "id:s", .params = "id", diff --git a/hmp.c b/hmp.c index 20f5dab..7660495 100644 --- a/hmp.c +++ b/hmp.c @@ -2224,6 +2224,40 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } +void hmp_chardev_change(Monitor *mon, const QDict *qdict) +{ + const char *args = qdict_get_str(qdict, "args"); + const char *id; + Error *err = NULL; + ChardevBackend *backend = NULL; + ChardevReturn *ret = NULL; + QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args, + true); + if (!opts) { + error_setg(&err, "Parsing chardev args failed"); + goto end; + } + + id = qdict_get_str(qdict, "id"); + if (qemu_opts_id(opts)) { + error_setg(&err, "Unexpected 'id' parameter"); + goto end; + } + + backend = qemu_chr_parse_opts(opts, &err); + if (!backend) { + goto end; + } + + ret = qmp_chardev_change(id, backend, &err); + +end: + qapi_free_ChardevReturn(ret); + qapi_free_ChardevBackend(backend); + qemu_opts_del(opts); + hmp_handle_error(mon, &err); +} + void hmp_chardev_remove(Monitor *mon, const QDict *qdict) { Error *local_err = NULL; diff --git a/hmp.h b/hmp.h index d8b94ce..23e035c 100644 --- a/hmp.h +++ b/hmp.h @@ -102,6 +102,7 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict); void hmp_nbd_server_add(Monitor *mon, const QDict *qdict); void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); void hmp_chardev_add(Monitor *mon, const QDict *qdict); +void hmp_chardev_change(Monitor *mon, const QDict *qdict); void hmp_chardev_remove(Monitor *mon, const QDict *qdict); void hmp_qemu_io(Monitor *mon, const QDict *qdict); void hmp_cpu_add(Monitor *mon, const QDict *qdict); diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 342f531..18fcd26 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -131,6 +131,18 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend); /** + * @qemu_chr_parse_opts: + * + * Parse the options to the ChardevBackend struct. + * + * @opts + * + * Returns: a new backend + */ +ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, + Error **errp); + +/** * @qemu_chr_new: * * Create a new character backend from a URI.