From patchwork Fri May 19 12:47:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9737151 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 3AA5B6034C for ; Fri, 19 May 2017 12:52:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AE6E2654B for ; Fri, 19 May 2017 12:52:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D6BF26E54; Fri, 19 May 2017 12:52:25 +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 5666B2654B for ; Fri, 19 May 2017 12:52:23 +0000 (UTC) Received: from localhost ([::1]:58639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBhOI-0002xp-HQ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 May 2017 08:52:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBhK1-0000cd-8H for qemu-devel@nongnu.org; Fri, 19 May 2017 08:48:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBhJx-0004IS-RB for qemu-devel@nongnu.org; Fri, 19 May 2017 08:47:57 -0400 Received: from mail-eopbgr00136.outbound.protection.outlook.com ([40.107.0.136]:31167 helo=EUR02-AM5-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 1dBhJx-0004AG-Ek for qemu-devel@nongnu.org; Fri, 19 May 2017 08:47:53 -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=8X9ZfCu1PIT0ok8p56kxgS2Q6Te+4t9mMcuzp3Z6OTY=; b=ULOYZEjoNWOjEXQMlguw4w0O5HEiJjr3RqYyhFpWCYwo5UMstk4ErOIufYUY65yFMSN/sQMLx2oz3omMS7KDHOubg24jzSUHeR9TwMOvNcS75SXBaKuGyM62/HlEm8fWHaAN+EPGxBWcA0Cwc5CrlFNp7IBMBYMfknQR16FpfBs= 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 DB6PR0801MB1989.eurprd08.prod.outlook.com (10.168.85.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Fri, 19 May 2017 12:47:46 +0000 From: Anton Nefedov To: Date: Fri, 19 May 2017 15:47:15 +0300 Message-ID: <1495198042-124203-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495198042-124203-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1495198042-124203-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0002.EURPRD10.PROD.OUTLOOK.COM (10.171.79.12) To DB6PR0801MB1989.eurprd08.prod.outlook.com (10.168.85.150) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB6PR0801MB1989: X-MS-Office365-Filtering-Correlation-Id: 6a35470d-4adc-431e-fbac-08d49eb54022 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DB6PR0801MB1989; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 3:BBdK2n/rgTL5lh18t9k7/SJRXs/5lLX0Bs5eNqZ/MvMRSTbS9slZkEAfwPkSGosf9kwjmrfao5+cHyDVPLDO9xN0T/XIiEKG32qzvJtfZwgs4m3HCEFCo/3kFhcn8oVlaFB5/PbMrxvD2Gy216oWTl4O3vaFNqjMbdgfUdCkpXRxalxgXaFeUDgZzGEp2OE9TWXRk3ZJcbqeFjN3at4Yp9WkBhI04JOhxIwHuLhtPTYjAQ9iWPcPYRZh12MZrSVRJbAmKHyC3ksQPSPyUmM8BcVVNp9ZPa9rhOxp9WXhDTL+N2KuUpn6dwMurjqeJZ8hSYxObfggAl+voGouYNs2MA==; 25:982lDtX942+x+pG/qyEHpDN0A6ypLUbwKloN18Bz4ooUA8VbPFRlWc5xLpj+ofej/UH0Gi9Pg8tPT65Bnoq97FTbGgS2oPN4efaODajp+sCQE8UGQx90QxF4WdAw2mwbF1vFexHqxezdByXDPF/Nyoy0kAeWoGDPgGd0Ab2ZAq9S9MZLg/koGYFLK+ORt3sOLWz+89jCa6bkiUzSi5kL5bbezskwodCkuDH7gJCZXzpjywI4ADDtzWrp9+wcmUcCd2LVL6xZVBK6UUwUc7SkhTXyUJcGp9bwfKnPa1NIkp3lKtLkdpXbJBFmiRKXyzY/4jP8cLROfKMiMpZN3TQICelPJ1oVcHOu/JNAAmxZdJ+xkSiAxJ4Evbmq8iIMbZyaBvtXGYJAg5fOE5HH3pAn6v9hvNY5vth3206evm7vryqwq9DLnIRO41kGY0fgKP14IHIqYiIka+7WMIvlXevLEx345TysqSZ2f1Sinwn5lO0= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 31:LJUg83qCPVNvOiUIcY977R6oK1zSalUJJzDLTJT0pcpHEzpDDKzPBoeBbxJnlCr2rBK1GKd3nYgcYD6GYIjo3bHIgIOlvPoDSGBz/m0JXx94Sr4m0WCowwp9jUmr6sYzie4FJuGEb7KXlocs2z+0WIYop3eRcSw3jkbNlBe5zcM3NIHT2Zh588bd5BVTueQbDf9GsaRSpaP8H635zTMyr1e3WIin7ua44Teht+9hcxI=; 20:BUjBC4NzADYm9ubG/ItCbD3IxqZD2Sezjjh07kho4Dmq8hDyhannQuqY6/L2V1SuB3qzGVT9TPTPVYlCR8ejy/Gqlnc1ari6D5wwcBSkyy3kukZzAqo4SUZRmuKihtFz0CpvPKLfgKRMa52FBQanKG+vOVQ7BsskOG7AHB6b855EormpAoVaIlP4jxUybT3Pr094x9UgxwyR3yVcfzSd17c5SoSpvn6oqtcLwsmrIM/lNvA9EnXYU69lMsrmILjfE1stqLc4/FnBnm4XEJJuJJS3dkPT/NfxJWROny9FPeWxRk0Bqa9uI022tU/dppIiX/8nXui3cu/l5LfgAbbNYhviOr+Ux7TPNTGN0Jurl9aIpzzAEFXLIUeY/R3PREAGZQjnUuLmB3OnMV3ZXKlnA8a7nHtweXsL5dTN7YbZcY0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6041248)(20161123560025)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(201703131423075)(201703061421075)(6072148); SRVR:DB6PR0801MB1989; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1989; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 4:lMGoPa3G+CbtpNeEZPLnPFGWaIf026nGhRPAxMHQ89p7df8TIX67swHeE8/cXmgiiA4ksX4hnztKBao9XOn/6me1ek5VfA4TFduPodX2+ZQF1S9wjPENsIk5/1nV/9QR9tQFtykZyp2cndktix94306vpZXIlfCmY7DtpTmmBolHbCIVmGysebhVC19+qMSXYGAghFUqH4WAtHFdaV+P2woFekSzW3kvYlYa4yF6XqK6JJmgpai8EQpiVWFFSyNMmqs6h8YJzkJWpl5nhIO0tYPPNvfuY6XCwJvY8q39q2viGJfZxpSFXJ6ahzkzm4XsDIp2lI9nRmHx4bYf7vR/oVIy/hbPI+/CPfTDhK+Rpx9dfpVUzi6f8AXP8bcK1AwcSaK5+gWzQxb+686+F4dba7gZOWTpyKOf6qoW29KHzStUoTLWy7BuwBbReJPrd3gyMtUn/Ug8GzoFGNh2e5zSTWs4HNGPhxJhcy7gkW5lPsKAikSIsZfpIJEMtdTMr8H4jjsr4d6wTj/Zxal8opqvI+zx4dxz4Y3mPB3+FaDWKh+OAbvkySHhpwlzGkDC8TF7tXeHnewJEWXRSPI2WUVo0FJCF09AqKVzZfIIpkWNkGAGkDIUHYtLVOEBArSjPUo3E38ee464SGN28WNvE7SxrSmxgNU6pZvBu4nHzGYY5h4g8Vw1uXjn6RMhqYKOaru+tfE9X8ZfoHd8OPcNil9cMdacNPluuqTgdteDhMvZsX8oFoBAEJNPQSaH8mdTfLYv0LGmozO9XAjpfMq2192z4w== X-Forefront-PRVS: 031257FE13 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39400400002)(39450400003)(33646002)(48376002)(5003940100001)(53936002)(38730400002)(25786009)(2351001)(6506006)(6486002)(107886003)(4326008)(110136004)(5660300001)(36756003)(7736002)(6916009)(2950100002)(305945005)(6666003)(5890100001)(66066001)(2906002)(189998001)(50226002)(50466002)(53946003)(54906002)(508600001)(86362001)(6512007)(81166006)(8676002)(50986999)(53416004)(3846002)(76176999)(575784001)(42186005); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1989; H:xantnef-ws.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0801MB1989; 23:TDywV6aIxfHYqt5Qn5v2qXxiDzzx6J+5WOCGlH5?= =?us-ascii?Q?wegZomSNY0t6bV7QKLFp/tgc//igWYlnt2WhO/BNXYodlM4/z0bv9/iPkB4S?= =?us-ascii?Q?81KQriuUrrB/95pWbGZ/HpmlYmW/ITF7UVFlzu6r8wkxv0O0NlHItr2ofrlH?= =?us-ascii?Q?PKJz/2Uy+cDGfdT6uRgxW3szUC/TIrdixUTbFaE0u4LP+qilZmvYmlEdiXYy?= =?us-ascii?Q?upJOaKIp7Jy7RqXl+pf2sf3TGqcwQKjs65L++5vUy0IrdkWdlwTNYoDv3GMK?= =?us-ascii?Q?TzssOWgZtwOuhBcebAfIo/CIGwmF2II/CSMhMk31ZUM1MEShS3vr4hhwnekS?= =?us-ascii?Q?KA/FnMYUjioVQWti79HAmXFl8Ei6EUbuGUI+XJOq+anl7457VmsG/9li8Wpa?= =?us-ascii?Q?pOF2XetaEwDr6DcqPlEvRqc4LDX4+R1KHs5A8sdtv52Hee6U/IZYvXV3BinP?= =?us-ascii?Q?35t/Sm7NmeKhPPKl9RAtR5I2dE9ccajlzgUdmbuyBuLy0E5LrHMpp1LDUbZK?= =?us-ascii?Q?ve94AL1BOPYA8QwGa0CJ980UxzbcCBJCjHzCa+zAQ7RJGKEsoEQgq9huurnJ?= =?us-ascii?Q?wKz4nfKEQDhtdvCfXSVnDR5noy/+SHAM2zRpnPSm7yPYprfJlxdYtpeimaYc?= =?us-ascii?Q?rsr3s6BdRvwvQrP/mAXBUPGTwmMpaRc2LVcGmS8D6O+dS7iFY/4N7/nSU+6j?= =?us-ascii?Q?XFhfhhTU4NczoqkpV6Jlxu5qYOs73rvvnvo7R5i/Q5ohhRXC+aOhJwtWjxBz?= =?us-ascii?Q?gJtkyLhYjMHniDR4ZXB2T38cNh3neOzSKuiR12X/eWstqT1mZJQZmqJlbAM4?= =?us-ascii?Q?QlEQcJLPNWxqJPGRDfpVS55g50n9BbiJvIB/y0WpARF19+I9un3BM1q+Vt09?= =?us-ascii?Q?ViRyvbEQMNf/gHN4Nb5yKCCaISI/H34JR+A61j92Ef02NwVVKxTFEd2YTIyY?= =?us-ascii?Q?3D91uh5K6iUX077Ntl1ygH8pwtlSsK4kspfHakwjE5WeFGeFNvt1pMAGNfhT?= =?us-ascii?Q?X7ePClDOJST9dBhCRMOyIYGqb5fUThqEDQip4sbkj+zV5xCpb31Rrf/nDXYD?= =?us-ascii?Q?Oz3pfGi8=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 6:ouO6m+FocH9suRm/DehczRbKWNTNK3G24e6XimL9CtERHfsi7Sp3yEbiNC9rtpYOITVgDDBExISk3CnJ2rdHBDeHRPSVcb/m/9u2PC6GOqEqqLemN2Zodbt5P2fO2KbH9Yn5EZtpWRM+joBB7l5xnsyXbMhkx9okXJ0OesluAwZ5MSj/NkFnEy8LHVphS4fRg6b/LEBmSfs8/krv8y1iBXVWOlqXXWcIXjBlJ5k/lZxxCjMFg1HEVRyO6cqm0R/51REDzqDP1vOVUGqND5hrM6LIF1/0UdGatHwD9BcUPlwE/nmY5XOrqVLKC9dOx7ob3VSxlQwvpfEIkAN5Kb2ZqGcv79RNaY8UkC+zfY/rVDWzL8w+cuRou9310Y0FUaXVgqayHpk3etPgCy5NeXP7+DiihgetaJus6HV6G1rjD5qztJDU2APJmwl3nD9iShfBVN2oys4nlB/SQ9fBbOjKfCZtc1EWxfIUCo8M+Qk6DT39Zonvf7hoRJPsPrqJAgBZg3h26rd/PHUB/vXXxeSqRA==; 5:GRWNYr3Fbzt9ZqoYw3U0+Ts9yomOIt1iWSLwxu2b75sKCL80r6cDT5se8yE/Al9Lo17UEjYiKOsSLZCddkM5wiF60zNWOaKY9uTRXVP6xOFEktcMMUgm/7xFIYGD9isHk2ZuBmfkEOnjuRhAcFQmLw==; 24:jRkMUSxxNk62mkaYarkiZhf/fYulxHQZOA300RkR24+0XmxBoQPI6IgyNsrzCQAXobrzpYMddHJ0xhVjgOafw9W3CfSoyuzdcA6ucbm7Pxc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 7:VDdYrEzsExyPDImdWTI+eJciC16dVD7SOiNkPIYWESuB+Q0o+4bXIL/35pAk3/moPs0kTLkniEe4uQUuiubLrIvMhhi8Ye+l5LC4d8PcZbiKZMtuC2tExeGbWPqz3qz6GzaHq4voumvLGRtEtqU2ywrxejNbHvJU/jcS2QPblmtimIYp9Foj9M1ggBqg6FTvrw0cAtNs3ODnF6ZyTz0gm+IfHzjrZxlWUa/pXxosCiWhDxFJ1kBbzyJTdHpdG+7V73CshD9PruX352WK6+pdSMtoKuuRvthGm2vo9kKhMSfyKXl/VhP5C92Ri0C77zbAgfKXznemrMy0p7zEquZnqg==; 20:C0VWMpUXBPQCA9a9kXLsTIziWEyNCWhetVZ0QtD/3BipfwSJO2yOwPPGo2M++FY9ruazEXNj4YtWslABj9jvDZpet7FFLTOzGWeo4XeScZ3/QH73z+f+RcYzOh/DcUWsT/ZTFqu4qrbZu5zHaAYOhd1dsYSqqFfmxf+Kap+EX6Y= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2017 12:47:46.3912 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1989 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.136 Subject: [Qemu-devel] [PATCH v2 2/9] char: add backend hotswap handler 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, 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 Frontends should have an interface to setup the handler of a backend change. The interface will be used in the next commits Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Marc-André Lureau --- backends/rng-egd.c | 2 +- chardev/char-mux.c | 1 + chardev/char.c | 4 +++- gdbstub.c | 2 +- hw/arm/pxa2xx.c | 3 ++- hw/arm/strongarm.c | 2 +- hw/char/bcm2835_aux.c | 2 +- hw/char/cadence_uart.c | 2 +- hw/char/debugcon.c | 2 +- hw/char/digic-uart.c | 2 +- hw/char/escc.c | 2 +- hw/char/etraxfs_ser.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/char/imx_serial.c | 2 +- hw/char/ipoctal232.c | 2 +- hw/char/lm32_juart.c | 2 +- hw/char/lm32_uart.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/milkymist-uart.c | 2 +- hw/char/pl011.c | 2 +- hw/char/sclpconsole-lm.c | 2 +- hw/char/sclpconsole.c | 2 +- hw/char/serial.c | 2 +- hw/char/sh_serial.c | 2 +- hw/char/spapr_vty.c | 2 +- hw/char/stm32f2xx_usart.c | 3 ++- hw/char/terminal3270.c | 2 +- hw/char/virtio-console.c | 4 ++-- hw/char/xen_console.c | 2 +- hw/char/xilinx_uartlite.c | 2 +- hw/ipmi/ipmi_bmc_extern.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/misc/ivshmem.c | 2 +- hw/usb/ccid-card-passthru.c | 2 +- hw/usb/dev-serial.c | 2 +- hw/usb/redirect.c | 2 +- include/sysemu/char.h | 5 +++++ monitor.c | 4 ++-- net/colo-compare.c | 14 ++++++++------ net/filter-mirror.c | 6 +++--- net/slirp.c | 2 +- net/vhost-user.c | 7 ++++--- qtest.c | 2 +- tests/test-char.c | 14 ++++++++++---- tests/vhost-user-test.c | 2 +- 47 files changed, 78 insertions(+), 59 deletions(-) diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 380b19a..0b0e945 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -106,7 +106,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp) /* FIXME we should resubmit pending requests when the CDS reconnects. */ qemu_chr_fe_set_handlers(&s->chr, rng_egd_chr_can_read, - rng_egd_chr_read, NULL, s, NULL, true); + rng_egd_chr_read, NULL, NULL, s, NULL, true); } static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp) diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 37d42c6..5849ea5 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -278,6 +278,7 @@ void mux_chr_set_handlers(Chardev *chr, GMainContext *context) mux_chr_can_read, mux_chr_read, mux_chr_event, + NULL, chr, context, true); } diff --git a/chardev/char.c b/chardev/char.c index 684cccd..ae60950 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -522,7 +522,7 @@ void qemu_chr_fe_deinit(CharBackend *b) assert(b); if (b->chr) { - qemu_chr_fe_set_handlers(b, NULL, NULL, NULL, NULL, NULL, true); + qemu_chr_fe_set_handlers(b, NULL, NULL, NULL, NULL, NULL, NULL, true); if (b->chr->be == b) { b->chr->be = NULL; } @@ -538,6 +538,7 @@ void qemu_chr_fe_set_handlers(CharBackend *b, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, + BackendChangeHandler *be_change, void *opaque, GMainContext *context, bool set_open) @@ -561,6 +562,7 @@ void qemu_chr_fe_set_handlers(CharBackend *b, b->chr_can_read = fd_can_read; b->chr_read = fd_read; b->chr_event = fd_event; + b->chr_be_change = be_change; b->opaque = opaque; if (cc->chr_update_read_handler) { cc->chr_update_read_handler(s, context); diff --git a/gdbstub.c b/gdbstub.c index 86eed4f..1ac0489 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2013,7 +2013,7 @@ int gdbserver_start(const char *device) if (chr) { qemu_chr_fe_init(&s->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&s->chr, gdb_chr_can_receive, gdb_chr_receive, - gdb_chr_event, NULL, NULL, true); + gdb_chr_event, NULL, NULL, NULL, true); } s->state = chr ? RS_IDLE : RS_INACTIVE; s->mon_chr = mon_chr; diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index eea551d..3e51882 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -1970,7 +1970,8 @@ static void pxa2xx_fir_realize(DeviceState *dev, Error **errp) PXA2xxFIrState *s = PXA2XX_FIR(dev); qemu_chr_fe_set_handlers(&s->chr, pxa2xx_fir_is_empty, - pxa2xx_fir_rx, pxa2xx_fir_event, s, NULL, true); + pxa2xx_fir_rx, pxa2xx_fir_event, NULL, s, NULL, + true); } static bool pxa2xx_fir_vmstate_validate(void *opaque, int version_id) diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 3311cc3..bec093d 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -1246,7 +1246,7 @@ static void strongarm_uart_realize(DeviceState *dev, Error **errp) strongarm_uart_can_receive, strongarm_uart_receive, strongarm_uart_event, - s, NULL, true); + NULL, s, NULL, true); } static void strongarm_uart_reset(DeviceState *dev) diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index 4d46ad6..370dc7e 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -279,7 +279,7 @@ static void bcm2835_aux_realize(DeviceState *dev, Error **errp) BCM2835AuxState *s = BCM2835_AUX(dev); qemu_chr_fe_set_handlers(&s->chr, bcm2835_aux_can_receive, - bcm2835_aux_receive, NULL, s, NULL, true); + bcm2835_aux_receive, NULL, NULL, s, NULL, true); } static Property bcm2835_aux_props[] = { diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index 4dcee57..71867b3 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -484,7 +484,7 @@ static void cadence_uart_realize(DeviceState *dev, Error **errp) fifo_trigger_update, s); qemu_chr_fe_set_handlers(&s->chr, uart_can_receive, uart_receive, - uart_event, s, NULL, true); + uart_event, NULL, s, NULL, true); } static void cadence_uart_init(Object *obj) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 80dce07..6d95297 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -92,7 +92,7 @@ static void debugcon_realize_core(DebugconState *s, Error **errp) return; } - qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, s, NULL, true); + qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, s, NULL, true); } static void debugcon_isa_realizefn(DeviceState *dev, Error **errp) diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c index 029f5bb..2d373dc 100644 --- a/hw/char/digic-uart.c +++ b/hw/char/digic-uart.c @@ -146,7 +146,7 @@ static void digic_uart_realize(DeviceState *dev, Error **errp) DigicUartState *s = DIGIC_UART(dev); qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, - uart_event, s, NULL, true); + uart_event, NULL, s, NULL, true); } static void digic_uart_init(Object *obj) diff --git a/hw/char/escc.c b/hw/char/escc.c index 9228091..aa882b6 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -1015,7 +1015,7 @@ static void escc_realize(DeviceState *dev, Error **errp) if (qemu_chr_fe_get_driver(&s->chn[i].chr)) { s->chn[i].clock = s->frequency / 2; qemu_chr_fe_set_handlers(&s->chn[i].chr, serial_can_receive, - serial_receive1, serial_event, + serial_receive1, serial_event, NULL, &s->chn[i], NULL, true); } } diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index 5438387..4abd382 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -233,7 +233,7 @@ static void etraxfs_ser_realize(DeviceState *dev, Error **errp) qemu_chr_fe_set_handlers(&s->chr, serial_can_receive, serial_receive, - serial_event, s, NULL, true); + serial_event, NULL, s, NULL, true); } static void etraxfs_ser_class_init(ObjectClass *klass, void *data) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index bff706a..7ef4ea5 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -644,7 +644,7 @@ static void exynos4210_uart_realize(DeviceState *dev, Error **errp) qemu_chr_fe_set_handlers(&s->chr, exynos4210_uart_can_receive, exynos4210_uart_receive, exynos4210_uart_event, - s, NULL, true); + NULL, s, NULL, true); } static Property exynos4210_uart_properties[] = { diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index db686e6..610a317 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -247,7 +247,7 @@ static int grlib_apbuart_init(SysBusDevice *dev) grlib_apbuart_can_receive, grlib_apbuart_receive, grlib_apbuart_event, - uart, NULL, true); + NULL, uart, NULL, true); sysbus_init_irq(dev, &uart->irq); diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 52e67f8..b66396f 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -316,7 +316,7 @@ static void imx_serial_realize(DeviceState *dev, Error **errp) DPRINTF("char dev for uart: %p\n", qemu_chr_fe_get_driver(&s->chr)); qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive, - imx_event, s, NULL, true); + imx_event, NULL, s, NULL, true); } static void imx_serial_init(Object *obj) diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 93929c2..734e42c 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -545,7 +545,7 @@ static void ipoctal_realize(DeviceState *dev, Error **errp) if (qemu_chr_fe_get_driver(&ch->dev)) { qemu_chr_fe_set_handlers(&ch->dev, hostdev_can_receive, hostdev_receive, hostdev_event, - ch, NULL, true); + NULL, ch, NULL, true); DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label); } else { DPRINTF("Could not redirect channel %u, no chardev set\n", i); diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index f8c1e0d..b3a5351 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -119,7 +119,7 @@ static void lm32_juart_realize(DeviceState *dev, Error **errp) LM32JuartState *s = LM32_JUART(dev); qemu_chr_fe_set_handlers(&s->chr, juart_can_rx, juart_rx, - juart_event, s, NULL, true); + juart_event, NULL, s, NULL, true); } static const VMStateDescription vmstate_lm32_juart = { diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 7f3597c..3a6dbf8 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -266,7 +266,7 @@ static void lm32_uart_realize(DeviceState *dev, Error **errp) LM32UartState *s = LM32_UART(dev); qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, - uart_event, s, NULL, true); + uart_event, NULL, s, NULL, true); } static const VMStateDescription vmstate_lm32_uart = { diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index e69672f..7f3cd5a 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -305,7 +305,7 @@ static void mcf_uart_realize(DeviceState *dev, Error **errp) mcf_uart_state *s = MCF_UART(dev); qemu_chr_fe_set_handlers(&s->chr, mcf_uart_can_receive, mcf_uart_receive, - mcf_uart_event, s, NULL, true); + mcf_uart_event, NULL, s, NULL, true); } static Property mcf_uart_properties[] = { diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index ae8e2f3..523959a 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -199,7 +199,7 @@ static void milkymist_uart_realize(DeviceState *dev, Error **errp) MilkymistUartState *s = MILKYMIST_UART(dev); qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, - uart_event, s, NULL, true); + uart_event, NULL, s, NULL, true); } static void milkymist_uart_init(Object *obj) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 24ea973..c38f60a 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -329,7 +329,7 @@ static void pl011_realize(DeviceState *dev, Error **errp) PL011State *s = PL011(dev); qemu_chr_fe_set_handlers(&s->chr, pl011_can_receive, pl011_receive, - pl011_event, s, NULL, true); + pl011_event, NULL, s, NULL, true); } static void pl011_class_init(ObjectClass *oc, void *data) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 07d6ebd..ed1e2c5 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -313,7 +313,7 @@ static int console_init(SCLPEvent *event) console_available = true; qemu_chr_fe_set_handlers(&scon->chr, chr_can_read, - chr_read, NULL, scon, NULL, true); + chr_read, NULL, NULL, scon, NULL, true); return 0; } diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index b78f240..9a65010 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -228,7 +228,7 @@ static int console_init(SCLPEvent *event) } console_available = true; qemu_chr_fe_set_handlers(&scon->chr, chr_can_read, - chr_read, NULL, scon, NULL, true); + chr_read, NULL, NULL, scon, NULL, true); return 0; } diff --git a/hw/char/serial.c b/hw/char/serial.c index 03d890c..d8d34d0 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -897,7 +897,7 @@ void serial_realize_core(SerialState *s, Error **errp) qemu_register_reset(serial_reset, s); qemu_chr_fe_set_handlers(&s->chr, serial_can_receive1, serial_receive1, - serial_event, s, NULL, true); + serial_event, NULL, s, NULL, true); fifo8_create(&s->recv_fifo, UART_FIFO_LENGTH); fifo8_create(&s->xmit_fifo, UART_FIFO_LENGTH); serial_reset(s); diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 303eb0a..c352337 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -400,7 +400,7 @@ void sh_serial_init(MemoryRegion *sysmem, qemu_chr_fe_init(&s->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&s->chr, sh_serial_can_receive1, sh_serial_receive1, - sh_serial_event, s, NULL, true); + sh_serial_event, NULL, s, NULL, true); } s->eri = eri_source; diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index e30c8da..9cdc0e0 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -84,7 +84,7 @@ static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) } qemu_chr_fe_set_handlers(&dev->chardev, vty_can_receive, - vty_receive, NULL, dev, NULL, true); + vty_receive, NULL, NULL, dev, NULL, true); } /* Forward declaration */ diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 59872e6..268e435 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -207,7 +207,8 @@ static void stm32f2xx_usart_realize(DeviceState *dev, Error **errp) STM32F2XXUsartState *s = STM32F2XX_USART(dev); qemu_chr_fe_set_handlers(&s->chr, stm32f2xx_usart_can_receive, - stm32f2xx_usart_receive, NULL, s, NULL, true); + stm32f2xx_usart_receive, NULL, NULL, + s, NULL, true); } static void stm32f2xx_usart_class_init(ObjectClass *klass, void *data) diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index b2dda01..943a0f3 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -179,7 +179,7 @@ static void terminal_init(EmulatedCcw3270Device *dev, Error **errp) } terminal_available = true; qemu_chr_fe_set_handlers(&t->chr, terminal_can_read, - terminal_read, chr_event, t, NULL, true); + terminal_read, chr_event, NULL, t, NULL, true); } static int read_payload_3270(EmulatedCcw3270Device *dev, uint32_t cda, diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 798d9b6..cf7331d 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -188,11 +188,11 @@ static void virtconsole_realize(DeviceState *dev, Error **errp) */ if (k->is_console) { qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, - NULL, vcon, NULL, true); + NULL, NULL, vcon, NULL, true); virtio_serial_open(port); } else { qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, - chr_event, vcon, NULL, false); + chr_event, NULL, vcon, NULL, false); } } } diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index c01f410..cb7975f 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -246,7 +246,7 @@ static int con_initialise(struct XenDevice *xendev) xen_be_bind_evtchn(&con->xendev); qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive, - xencons_receive, NULL, con, NULL, true); + xencons_receive, NULL, NULL, con, NULL, true); xen_pv_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 37d313b..2568302 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -212,7 +212,7 @@ static void xilinx_uartlite_realize(DeviceState *dev, Error **errp) XilinxUARTLite *s = XILINX_UARTLITE(dev); qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, - uart_event, s, NULL, true); + uart_event, NULL, s, NULL, true); } static void xilinx_uartlite_init(Object *obj) diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index e8e3d25..6f2339d 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -453,7 +453,7 @@ static void ipmi_bmc_extern_realize(DeviceState *dev, Error **errp) } qemu_chr_fe_set_handlers(&ibe->chr, can_receive, receive, - chr_event, ibe, NULL, true); + chr_event, NULL, ibe, NULL, true); } static int ipmi_bmc_extern_post_migrate(void *opaque, int version_id) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 83f7b82..a57c860 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -533,7 +533,7 @@ static void boston_mach_init(MachineState *machine) chr = qemu_chr_new("lcd", "vc:320x240"); qemu_chr_fe_init(&s->lcd_display, chr, NULL); qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL, - boston_lcd_event, s, NULL, true); + boston_lcd_event, NULL, s, NULL, true); ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus, PCI_DEVFN(0, 0), diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5dd177e..96dce76 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -571,7 +571,7 @@ static MaltaFPGAState *malta_fpga_init(MemoryRegion *address_space, chr = qemu_chr_new("fpga", "vc:320x200"); qemu_chr_fe_init(&s->display, chr, NULL); qemu_chr_fe_set_handlers(&s->display, NULL, NULL, - malta_fgpa_display_event, s, NULL, true); + malta_fgpa_display_event, NULL, s, NULL, true); s->uart = serial_mm_init(address_space, base + 0x900, 3, uart_irq, 230400, uart_chr, DEVICE_NATIVE_ENDIAN); diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 475e36a..e2dece8 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -896,7 +896,7 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp) } qemu_chr_fe_set_handlers(&s->server_chr, ivshmem_can_receive, - ivshmem_read, NULL, s, NULL, true); + ivshmem_read, NULL, NULL, s, NULL, true); if (ivshmem_setup_interrupts(s, errp) < 0) { error_prepend(errp, "Failed to initialize interrupts: "); diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index a41b0d6..9ace5ac 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -351,7 +351,7 @@ static int passthru_initfn(CCIDCardState *base) qemu_chr_fe_set_handlers(&card->cs, ccid_card_vscard_can_read, ccid_card_vscard_read, - ccid_card_vscard_event, card, NULL, true); + ccid_card_vscard_event, NULL, card, NULL, true); ccid_card_vscard_send_init(card); } else { error_report("missing chardev"); diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 83a4f0e..e6b2c7c 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -501,7 +501,7 @@ static void usb_serial_realize(USBDevice *dev, Error **errp) } qemu_chr_fe_set_handlers(&s->cs, usb_serial_can_read, usb_serial_read, - usb_serial_event, s, NULL, true); + usb_serial_event, NULL, s, NULL, true); usb_serial_handle_reset(dev); if (chr->be_open && !dev->attached) { diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index ad5ef78..1e9bf69 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1399,7 +1399,7 @@ static void usbredir_realize(USBDevice *udev, Error **errp) /* Let the backend know we are ready */ qemu_chr_fe_set_handlers(&dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, - dev, NULL, true); + NULL, dev, NULL, true); dev->vmstate = qemu_add_vm_change_state_handler(usbredir_vm_state_change, dev); diff --git a/include/sysemu/char.h b/include/sysemu/char.h index fffc0f4..9f8df07 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -64,6 +64,7 @@ struct ParallelIOArg { #define CHR_TIOCM_RTS 0x004 typedef void IOEventHandler(void *opaque, int event); +typedef int BackendChangeHandler(void *opaque); typedef enum { /* Whether the chardev peer is able to close and @@ -87,6 +88,7 @@ typedef struct CharBackend { IOEventHandler *chr_event; IOCanReadHandler *chr_can_read; IOReadHandler *chr_read; + BackendChangeHandler *chr_be_change; void *opaque; int tag; int fe_open; @@ -399,6 +401,8 @@ void qemu_chr_fe_deinit(CharBackend *b); * receive * @fd_read: callback to receive data from char * @fd_event: event callback + * @be_change: backend change callback; passing NULL means hot backend change + * is not supported and will not be attempted * @opaque: an opaque pointer for the callbacks * @context: a main loop context or NULL for the default * @set_open: whether to call qemu_chr_fe_set_open() implicitely when @@ -413,6 +417,7 @@ void qemu_chr_fe_set_handlers(CharBackend *b, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, + BackendChangeHandler *be_change, void *opaque, GMainContext *context, bool set_open); diff --git a/monitor.c b/monitor.c index afbacfe..9057ad3 100644 --- a/monitor.c +++ b/monitor.c @@ -4088,12 +4088,12 @@ void monitor_init(Chardev *chr, int flags) if (monitor_is_qmp(mon)) { qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, monitor_qmp_read, - monitor_qmp_event, mon, NULL, true); + monitor_qmp_event, NULL, mon, NULL, true); qemu_chr_fe_set_echo(&mon->chr, true); json_message_parser_init(&mon->qmp.parser, handle_qmp_command); } else { qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, monitor_read, - monitor_event, mon, NULL, true); + monitor_event, NULL, mon, NULL, true); } qemu_mutex_lock(&monitor_lock); diff --git a/net/colo-compare.c b/net/colo-compare.c index 4ab80b1..f672f4f 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -532,7 +532,7 @@ static void compare_pri_chr_in(void *opaque, const uint8_t *buf, int size) ret = net_fill_rstate(&s->pri_rs, buf, size); if (ret == -1) { - qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, NULL, NULL, NULL, true); error_report("colo-compare primary_in error"); } @@ -549,7 +549,7 @@ static void compare_sec_chr_in(void *opaque, const uint8_t *buf, int size) ret = net_fill_rstate(&s->sec_rs, buf, size); if (ret == -1) { - qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, NULL, NULL, NULL, true); error_report("colo-compare secondary_in error"); } @@ -577,9 +577,11 @@ static void *colo_compare_thread(void *opaque) s->worker_context = g_main_context_new(); qemu_chr_fe_set_handlers(&s->chr_pri_in, compare_chr_can_read, - compare_pri_chr_in, NULL, s, s->worker_context, true); + compare_pri_chr_in, NULL, NULL, + s, s->worker_context, true); qemu_chr_fe_set_handlers(&s->chr_sec_in, compare_chr_can_read, - compare_sec_chr_in, NULL, s, s->worker_context, true); + compare_sec_chr_in, NULL, NULL, + s, s->worker_context, true); s->compare_loop = g_main_loop_new(s->worker_context, FALSE); @@ -790,9 +792,9 @@ static void colo_compare_finalize(Object *obj) { CompareState *s = COLO_COMPARE(obj); - qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, NULL, NULL, s->worker_context, true); - qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, NULL, NULL, s->worker_context, true); qemu_chr_fe_deinit(&s->chr_out); diff --git a/net/filter-mirror.c b/net/filter-mirror.c index 72fa7c2..06321d7 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -112,7 +112,7 @@ static void redirector_chr_read(void *opaque, const uint8_t *buf, int size) if (ret == -1) { qemu_chr_fe_set_handlers(&s->chr_in, NULL, NULL, NULL, - NULL, NULL, true); + NULL, NULL, NULL, true); } } @@ -124,7 +124,7 @@ static void redirector_chr_event(void *opaque, int event) switch (event) { case CHR_EVENT_CLOSED: qemu_chr_fe_set_handlers(&s->chr_in, NULL, NULL, NULL, - NULL, NULL, true); + NULL, NULL, NULL, true); break; default: break; @@ -251,7 +251,7 @@ static void filter_redirector_setup(NetFilterState *nf, Error **errp) qemu_chr_fe_set_handlers(&s->chr_in, redirector_chr_can_read, redirector_chr_read, redirector_chr_event, - nf, NULL, true); + NULL, nf, NULL, true); } if (s->outdev) { diff --git a/net/slirp.c b/net/slirp.c index c705a60..6cbae5a 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -778,7 +778,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, fwd->slirp = s->slirp; qemu_chr_fe_set_handlers(&fwd->hd, guestfwd_can_read, guestfwd_read, - NULL, fwd, NULL, true); + NULL, NULL, fwd, NULL, true); } return 0; diff --git a/net/vhost-user.c b/net/vhost-user.c index 00a0c1c..d090311 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -214,7 +214,7 @@ static void chr_closed_bh(void *opaque) vhost_user_stop(queues, ncs); qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, - opaque, NULL, true); + NULL, opaque, NULL, true); if (err) { error_report_err(err); @@ -260,7 +260,7 @@ static void net_vhost_user_event(void *opaque, int event) g_source_remove(s->watch); s->watch = 0; - qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, NULL, NULL, false); aio_bh_schedule_oneshot(ctx, chr_closed_bh, opaque); @@ -308,7 +308,8 @@ static int net_vhost_user_init(NetClientState *peer, const char *device, return -1; } qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, - net_vhost_user_event, nc0->name, NULL, true); + net_vhost_user_event, NULL, nc0->name, NULL, + true); } while (!s->started); assert(s->vhost_net); diff --git a/qtest.c b/qtest.c index 5aa6636..b6e9780 100644 --- a/qtest.c +++ b/qtest.c @@ -691,7 +691,7 @@ void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp) qemu_chr_fe_init(&qtest_chr, chr, errp); qemu_chr_fe_set_handlers(&qtest_chr, qtest_can_read, qtest_read, - qtest_event, &qtest_chr, NULL, true); + qtest_event, NULL, &qtest_chr, NULL, true); qemu_chr_fe_set_echo(&qtest_chr, true); inbuf = g_string_new(""); diff --git a/tests/test-char.c b/tests/test-char.c index 124d0c5..f3b377f 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -182,6 +182,7 @@ static void char_mux_test(void) fe_can_read, fe_read, fe_event, + NULL, &h1, NULL, true); @@ -190,6 +191,7 @@ static void char_mux_test(void) fe_can_read, fe_read, fe_event, + NULL, &h2, NULL, true); qemu_chr_fe_take_focus(&chr_be2); @@ -213,7 +215,8 @@ static void char_mux_test(void) h1.read_count = 0; /* remove first handler */ - qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL, NULL, true); + qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL, + NULL, NULL, true); qemu_chr_be_write(base, (void *)"hello", 6); g_assert_cmpint(h1.read_count, ==, 0); g_assert_cmpint(h2.read_count, ==, 0); @@ -312,13 +315,13 @@ static void char_socket_test(void) qemu_chr_fe_init(&be, chr, &error_abort); qemu_chr_fe_set_handlers(&be, socket_can_read, socket_read, - NULL, &d, NULL, true); + NULL, NULL, &d, NULL, true); chr_client = qemu_chr_new("client", tmp); qemu_chr_fe_init(&client_be, chr_client, &error_abort); qemu_chr_fe_set_handlers(&client_be, socket_can_read_hello, socket_read_hello, - NULL, &d, NULL, true); + NULL, NULL, &d, NULL, true); g_free(tmp); d.conn_expected = true; @@ -388,6 +391,7 @@ static void char_pipe_test(void) fe_can_read, fe_read, fe_event, + NULL, &fe, NULL, true); @@ -437,7 +441,7 @@ static void char_udp_test(void) d.chr = chr; qemu_chr_fe_init(&be, chr, &error_abort); qemu_chr_fe_set_handlers(&be, socket_can_read_hello, socket_read_hello, - NULL, &d, NULL, true); + NULL, NULL, &d, NULL, true); ret = qemu_chr_write_all(chr, (uint8_t *)"hello", 5); g_assert_cmpint(ret, ==, 5); @@ -503,6 +507,7 @@ static void char_file_test(void) fe_can_read, fe_read, fe_event, + NULL, &fe, NULL, true); main_loop(); @@ -558,6 +563,7 @@ static void char_null_test(void) fe_can_read, fe_read, fe_event, + NULL, NULL, NULL, true); ret = qemu_chr_fe_write(&be, (void *)"buf", 4); diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 9095af2..718c08a 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -464,7 +464,7 @@ static void test_server_create_chr(TestServer *server, const gchar *opt) qemu_chr_fe_init(&server->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&server->chr, chr_can_read, chr_read, - chr_event, server, NULL, true); + chr_event, NULL, server, NULL, true); } static void test_server_listen(TestServer *server)