From patchwork Mon May 11 11:14:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11540435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 174A815AB for ; Mon, 11 May 2020 11:24:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD70820736 for ; Mon, 11 May 2020 11:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=web.de header.i=@web.de header.b="OnZ4+5Zq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD70820736 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY6YC-0008E1-QQ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 May 2020 07:24:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY6Od-0000i3-G9; Mon, 11 May 2020 07:14:55 -0400 Received: from mout.web.de ([212.227.15.14]:37697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jY6Oc-0006ti-Hw; Mon, 11 May 2020 07:14:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1589195688; bh=ox7FrQlIDpodo9cR+t+IPZpwtzB7Qs5pOwi+y4G35M0=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=OnZ4+5ZqLtFFJ9bQcOkXe6xYdkNM80rywQvGir9YO9Loqjn4fjAxKzlX+IEPs/O3j mt9kflmw8Bjwd6J2IXAdrdh7jIQQgiVkKswvdtDzlyZHTTMpvZ5XECcM5//a6FN+Iu 1UhJklww41YGWfyadW7u851Jczij1bqbWYOhqo7E= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([89.247.255.192]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LfzcB-1ijs4B3Adv-00pgGC; Mon, 11 May 2020 13:14:48 +0200 Date: Mon, 11 May 2020 13:14:47 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH 4/5] chardev/char-socket.c: Add yank feature Message-ID: <7f87fcd9be3cedfe0410c151de2bf4e5d907b1e2.1589193717.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:0wT0tdxCVau8z0N6eYdSpqwC5zAcYrOZroPKp2QhXq3kpCeF8cG oGhyLcx4nw0trtcn43p7I5gR8QvRsspNvDE264Y2USE8upIFEvOpyP7u+wXw7x5J9q/7Okc Oqc+jMRUYoKc/pYBAZhW1rpH1lh5LfpBthTy4M+cg9soqaD3bTjjg0tmSqWn4bIOw6L+5nS j3JAMN+2Tks7+aeXoC+0w== X-UI-Out-Filterresults: notjunk:1;V03:K0:u/mYSBWGa1A=:V866AMqLzcEYkIHs2en4Yj UIEiw7bxXvUgPvL4Tzl9n7T7elfb30P9gs2GVxPJllz9UxalZIsqmc5pFkp5N9iMqORiwBInF FTrYLyfWqLm1RHBNQsjMGDRW9Rku9lDkAnqdTeth7TyyypL/XoEsV5OdSM0Mn6lmZPP+QI1pT TRoSwiKjKJvT6DO7M9TpM57P7EuM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prt+ry Received-SPF: pass client-ip=212.227.15.14; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/11 07:10:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. =?utf-8?b?QmVycmFuZ8Op?= " , qemu-block , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Add yank option which is passed to the socket-channel. Signed-off-by: Lukas Straub --- chardev/char-socket.c | 8 ++++++++ chardev/char.c | 3 +++ qapi/char.json | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 185fe38dda..e476358941 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -65,6 +65,7 @@ typedef struct { int max_size; int do_telnetopt; int do_nodelay; + int do_yank; int *read_msgfds; size_t read_msgfds_num; int *write_msgfds; @@ -877,6 +878,9 @@ static int tcp_chr_new_client(Chardev *chr, QIOChannelSocket *sioc) if (s->do_nodelay) { qio_channel_set_delay(s->ioc, false); } + if (s->do_yank) { + qio_channel_set_yank(s->ioc, true); + } if (s->listener) { qio_net_listener_set_client_func_full(s->listener, NULL, NULL, NULL, chr->gcontext); @@ -1297,6 +1301,7 @@ static void qmp_chardev_open_socket(Chardev *chr, SocketChardev *s = SOCKET_CHARDEV(chr); ChardevSocket *sock = backend->u.socket.data; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; + bool do_yank = sock->has_yank ? sock->yank : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_tn3270 = sock->has_tn3270 ? sock->tn3270 : false; @@ -1310,6 +1315,7 @@ static void qmp_chardev_open_socket(Chardev *chr, s->is_tn3270 = is_tn3270; s->is_websock = is_websock; s->do_nodelay = do_nodelay; + s->do_yank = do_yank; if (sock->tls_creds) { Object *creds; creds = object_resolve_path_component( @@ -1400,6 +1406,8 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, sock->has_nodelay = qemu_opt_get(opts, "delay"); sock->nodelay = !qemu_opt_get_bool(opts, "delay", true); + sock->has_yank = qemu_opt_get(opts, "yank"); + sock->yank = qemu_opt_get_bool(opts, "yank", false); /* * We have different default to QMP for 'server', hence * we can't just check for existence of 'server' diff --git a/chardev/char.c b/chardev/char.c index e77564060d..04075389bf 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -939,6 +939,9 @@ QemuOptsList qemu_chardev_opts = { },{ .name = "logappend", .type = QEMU_OPT_BOOL, + },{ + .name = "yank", + .type = QEMU_OPT_BOOL, }, { /* end of list */ } }, diff --git a/qapi/char.json b/qapi/char.json index daceb20f84..f9c04e720c 100644 --- a/qapi/char.json +++ b/qapi/char.json @@ -270,6 +270,8 @@ # then attempt a reconnect after the given number of seconds. # Setting this to zero disables this function. (default: 0) # (Since: 2.2) +# @yank: Shutdown the socket when the 'yank' qmp command is executed. +# (Since: 5.1) # # Since: 1.4 ## @@ -283,7 +285,8 @@ '*telnet': 'bool', '*tn3270': 'bool', '*websocket': 'bool', - '*reconnect': 'int' }, + '*reconnect': 'int', + '*yank': 'bool' }, 'base': 'ChardevCommon' } ##