From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955549; cv=none; d=zohomail.com; s=zohoarc; b=dj70BFmEVPRcDicWuwnl1QNjIR4Ypw8XTxtcyQwkIjSRuUQjJMwWXdqomzgJRtQwLIy+T3dlR+raAMt4vJoViZOJUSl0XTyQ7eL+lw/PfckhiSxHFd5L2sVm0OFHowX8IVCSkMNE1oyzCjwfKgXZqk+xTikzsbE41l1SOvVMNZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955549; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=apexKtUJRTnb9NQkAMbfIqDJeSAiNfnmujGl4iNTzpQ=; b=ms9tQu5Ok2FqNKShDqgPJQMMNEhGSfh1+nKs/KoBhVeED1FsptoHaW90InPLUHN1aYwsLaUd9Gn1le1eKOvpiwLaVBOZHt93g+7p//QE8eLkKn/86TARn8O/I6am+q/GbfyBuPftyjr0u8d/N7/dIqZl6anmUK78XfR374DL4pU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955549004513.0114451988869; Wed, 12 Nov 2025 05:52:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBFj-0001mP-0l; Wed, 12 Nov 2025 08:51:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB6j-0003yX-3u for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:41:59 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB6g-0001JA-SE for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:41:56 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso4355825e9.1 for ; Wed, 12 Nov 2025 05:41:54 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e7006bsm34341315e9.12.2025.11.12.05.41.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954913; x=1763559713; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=apexKtUJRTnb9NQkAMbfIqDJeSAiNfnmujGl4iNTzpQ=; b=TCmN+q250mnSj7igGavKC9x+dl2qoxFKe/Zb1iuKamnQR5sDdoY5DkFoM1sdmnnFkE MTViA276uSX/96f94Ek/QYGyVFRFiHN5Olmj7lDEfXz+bQFBkfV8zn4+DriCa7CQmdUK ZhzFmjEGSVjrXAg2/95vHad9Lg8eQcHfbGheaL7TucDtvmHCBmyMye9Kn5AkQOARcFY1 jCC7OLY4ULK8hZKAjdBdHYcM4sfE3zd9iXq6wdYPoRjgZT0raR1KXXTyVhpXcwwoMCza Gkj6itQ5Brf9cZQ6+2QhdI6/cjL+qHO034SW8XmxdMMpEY8HrA5DC/Myjpvl+B/JWl8j Hc9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954913; x=1763559713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=apexKtUJRTnb9NQkAMbfIqDJeSAiNfnmujGl4iNTzpQ=; b=gHuifjPVFJVz0SWNyU+ezkUukJjDMxIps4d+4QCDNQud6YF9WWyIeF9Pef+8a0BVml QuetfFzFkXbpCwrAcKkikY67fTHrq5MSEtvd1WHEYFaLhlZmZHwXGtp0JKeMC/3TL5tv B2crPTm8rH+qgoHlxTQyXNpAtE7hBKYF6gamMNjH7DBBicl+5oxAuhJg0SZlyLV4ZFlM 2Hte91GXNnW5WR6J2sjoDA2omLqSZWpe6tTfC2637aWAttVdO7oh3cqGlm02erPvQSPn X5K/18OSr+bE+/4pvgKLVOjVtplBlvUM7VmH7rjHYGC5xITQwh1eA7+9Y4YjJxfKlHi5 hD0w== X-Gm-Message-State: AOJu0YyxiwWrwQlT4XQQIvwFDwyjYSm9CN12ajyhOdcXjNgh+dyBUCD2 f2XsJwDkBvb3dDX6cLUX2R4LHVUh74ZdZMr6/Ed4tA/9KUgEZacOlOENabSG1635R3h4chY5ev9 aJt9iGGFbXw== X-Gm-Gg: ASbGncscd8EX/KWg++P3Z2MQkd9eE/7+9+ApoPpCPQ038pxr43CGHyqvgJ9xrc906LI rbExEQNdmp4IqhvCFv5nrMAkMagOlSfPB7+ohpqYCMfWo8VKJG6lBTG4NWJFm9Eq+jphmJgoorG 4RFZzMZCJnAsuR5+eqwOeMS7JsBrz5Jodnqhowh9mLqh8+FLoaPtWShUz/5Dt+OKY7G+eD8ZkiY XkGUqY8a9Cb7ncSveW8Enl02U5CA7+tNmG2aNHNsNQONrEoECcUA2JDl2/MxCTcRsfCr8z68+C8 gmYUWy2O3jIN8s/Ae7heMCzOAPR3OldQyZGDd37xVvYH9wp2hBRlq0HlXJUAD0NuKKSPAklUSnB 0/nQQq/3Msh7whMJpuy3+LNGFD8t9T7+ORKX7mRQTBg7Ahn8zUK4TOsA1sW68NTTh87zrwFAk/K JEYdoJrVcZwWKAWR65lYFRon81/JvSamx7w+uzjqs6hd3IKbfN7yif4H8= X-Google-Smtp-Source: AGHT+IEMelvSB4VGymHm+7CGO6Rqhr9OAJdxfZfXcW3qNERuWkFv0CvxmAdzjSH+obz3PCD6hbASgA== X-Received: by 2002:a05:600c:3587:b0:46e:1a5e:211 with SMTP id 5b1f17b1804b1-477870c653bmr29946385e9.21.1762954912740; Wed, 12 Nov 2025 05:41:52 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 01/10] chardev/char-fe: Improve @docstrings Date: Wed, 12 Nov 2025 14:41:34 +0100 Message-ID: <20251112134143.27194-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955551038158500 Describe the @c (this is the *frontend*) and @s (the *backend*) parameters. Fill qemu_chr_fe_[gs]et_msgfds() method docstrings. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char-fe.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h index 5f8a6df17dc..36bcf1f88a6 100644 --- a/include/chardev/char-fe.h +++ b/include/chardev/char-fe.h @@ -26,6 +26,8 @@ struct CharFrontend { =20 /** * qemu_chr_fe_init: + * @c: the character frontend + * @s: the character backend * * Initializes the frontend @c for the given Chardev backend @s. Call * qemu_chr_fe_deinit() to remove the association and release the backend. @@ -47,6 +49,7 @@ void qemu_chr_fe_deinit(CharFrontend *c, bool del); =20 /** * qemu_chr_fe_get_driver: + * @c: the character frontend * * Returns: the driver associated with a CharFrontend or NULL if no * associated Chardev. @@ -58,6 +61,7 @@ Chardev *qemu_chr_fe_get_driver(CharFrontend *c); =20 /** * qemu_chr_fe_backend_connected: + * @c: the character frontend * * Returns: true if there is a backend associated with @c. */ @@ -102,6 +106,7 @@ void qemu_chr_fe_set_handlers_full(CharFrontend *c, =20 /** * qemu_chr_fe_set_handlers: + * @c: the character frontend * * Version of qemu_chr_fe_set_handlers_full() with sync_state =3D true. */ @@ -116,6 +121,7 @@ void qemu_chr_fe_set_handlers(CharFrontend *c, =20 /** * qemu_chr_fe_take_focus: + * @c: the character frontend * * Take the focus (if the front end is muxed). * @@ -125,6 +131,7 @@ void qemu_chr_fe_take_focus(CharFrontend *c); =20 /** * qemu_chr_fe_accept_input: + * @c: the character frontend * * Notify that the frontend is ready to receive data */ @@ -132,6 +139,7 @@ void qemu_chr_fe_accept_input(CharFrontend *c); =20 /** * qemu_chr_fe_disconnect: + * @c: the character frontend * * Close a fd accepted by character backend. * Without associated Chardev, do nothing. @@ -148,6 +156,7 @@ int qemu_chr_fe_wait_connected(CharFrontend *c, Error *= *errp); =20 /** * qemu_chr_fe_set_echo: + * @c: the character frontend * @echo: true to enable echo, false to disable echo * * Ask the backend to override its normal echo setting. This only really @@ -169,6 +178,7 @@ void qemu_chr_fe_set_open(CharFrontend *c, bool is_open= ); =20 /** * qemu_chr_fe_printf: + * @c: the character frontend * @fmt: see #printf * * Write to a character backend using a printf style interface. This @@ -197,6 +207,7 @@ typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCo= ndition condition, void * =20 /** * qemu_chr_fe_add_watch: + * @c: the character frontend * @cond: the condition to poll for * @func: the function to call when the condition happens * @user_data: the opaque pointer to pass to @func @@ -219,6 +230,7 @@ guint qemu_chr_fe_add_watch(CharFrontend *c, GIOConditi= on cond, =20 /** * qemu_chr_fe_write: + * @c: the character frontend to write to * @buf: the data * @len: the number of bytes to send * @@ -233,6 +245,7 @@ int qemu_chr_fe_write(CharFrontend *c, const uint8_t *b= uf, int len); =20 /** * qemu_chr_fe_write_all: + * @c: the character frontend to write to * @buf: the data * @len: the number of bytes to send * @@ -248,6 +261,7 @@ int qemu_chr_fe_write_all(CharFrontend *c, const uint8_= t *buf, int len); =20 /** * qemu_chr_fe_read_all: + * @c: the character frontend to read from * @buf: the data buffer * @len: the number of bytes to read * @@ -260,6 +274,7 @@ int qemu_chr_fe_read_all(CharFrontend *c, uint8_t *buf,= int len); =20 /** * qemu_chr_fe_ioctl: + * @c: the character frontend to control * @cmd: see CHR_IOCTL_* * @arg: the data associated with @cmd * @@ -273,6 +288,7 @@ int qemu_chr_fe_ioctl(CharFrontend *c, int cmd, void *a= rg); =20 /** * qemu_chr_fe_get_msgfd: + * @c: the character frontend to access * * For backends capable of fd passing, return the latest file descriptor p= assed * by a client. @@ -286,9 +302,12 @@ int qemu_chr_fe_get_msgfd(CharFrontend *c); =20 /** * qemu_chr_fe_get_msgfds: + * @c: the character frontend + * @fds: an array of ancillary file descriptors to get + * @num: the maximum number of ancillary file descriptors to get in @fds * * For backends capable of fd passing, return the number of file received - * descriptors and fills the fds array up to num elements + * descriptors and fills the fds array up to @num elements * * Returns: -1 if fd passing isn't supported or there are no pending file * descriptors. If file descriptors are returned, subsequent cal= ls to @@ -299,6 +318,9 @@ int qemu_chr_fe_get_msgfds(CharFrontend *c, int *fds, i= nt num); =20 /** * qemu_chr_fe_set_msgfds: + * @c: the character frontend + * @fds: an array of ancillary file descriptors to set + * @num: the number of ancillary file descriptors to set * * For backends capable of fd passing, set an array of fds to be passed wi= th * the next send operation. --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955399; cv=none; d=zohomail.com; s=zohoarc; b=JqGRXQML9ATLiSeDyOS9FGSuYvH4v+agveTWHl59ytMt0JFYZLpHjqVVp1e96GwKo5SRf+PNsbd5c34QIH8g1yUQIKtU3xjmfkSfLLNswNXbFG5wRmVxsW7Zt775w2T5gyQiHO+/Ftjt3sONL1twoFlBYMbhO+Ib20XE1JMo9lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955399; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+28mb6/qxZ6eOW2R7gXOmFFtY5bUA8Y2twhmxYKlCbE=; b=Dtxr2CeIFTSkRv2YOrrxd+R1uWSs0OMzYsc2RRx6y4C8ubDNoXvf75VxWLhKf6lst+gRNWTwNBboichMjInLtpSb3d99zmHhfhU+tGNk6zFeRCXvWzSlMhPkNwuMkTnN7GN5ZIvhiEVpXpWn7FVTmafoeCJscbwIYGQdboGyvRA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955399446879.1057270703897; Wed, 12 Nov 2025 05:49:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBE5-00078g-Kd; Wed, 12 Nov 2025 08:49:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB6p-00041L-Hr for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:05 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB6o-0001Je-3H for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:03 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-477775d3728so7618835e9.2 for ; Wed, 12 Nov 2025 05:42:01 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac675cd25sm34703662f8f.22.2025.11.12.05.41.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954920; x=1763559720; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+28mb6/qxZ6eOW2R7gXOmFFtY5bUA8Y2twhmxYKlCbE=; b=xIiqlzkFuQn5ZkgDUnI9TRQws5gBd+w7w2bH9EmT0YttrAWA3CvK6tYTfuveEnv0V6 0cRMdlHq6RTA998fqwJPs9JamZTixV7d7fyzBhAOYg6P9CaGx48FeTo2/qSIDBAJr3sw qbQiC1rbZSLy5p2WGXx5nT/dagWKtuKSF9hoFcV1mrJTwHfBdHgwA08557VifbZ+9sz9 1vrtqG69PwO3x8fBOC73ricf9JeBvjIf/tVL/TtbjGFxBdaqcwF0y4LSvXPrBCD9ZVZJ h5OKQeoNCjdve9R0G9Mxk8P/NSepAq1ipyJr52D+l5hQ+Baybwn+jDgH7ocp88YrB+0H 4JLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954920; x=1763559720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+28mb6/qxZ6eOW2R7gXOmFFtY5bUA8Y2twhmxYKlCbE=; b=QhitizA9mE6G1/v0PCW6bVpPAITWZnWhsYCivB4UvmdFRyQgh8AZUH/OGbVm9ckvZ0 TM5Idlpbxjmc2HHnF4k9ZQDbGgR/a+KlFX72oMFCR59912wgx0jpmhyCwJNuauqHBSqs aUINCVrBaT+N4HILZG5uSsjmY876eew3kbHTsXujLHdr1kl0m94VWeVRxAqFhqdqVd+F JcfIGmH12JYNYncHkG0l/pjtpWMQhe++l+P7vekj9eIjpFVwndhol9tuGRVHA1oiRzqM llwuN4VEYFJpVwB4FG0O1S36in8eW+tlrqchu5K9cZr19nhXrKYUvCSpWemUPNREhkVK poPA== X-Gm-Message-State: AOJu0YxVCB+FIbY8Z4ItjLxqarzGW5+O7nmHa6LsxCNqW4J94Jbr2bW4 wXNj6BOPP43vrxuF6gk6mlxPRLSJ9f1FfWZ7DvX13obaWYMDn2WHT2HDFFGEcZMQAZSoBrUAPsQ VApHL14bM2A== X-Gm-Gg: ASbGncuSgfJ75/VEzUQQObOqhonqDUghMzoojs4cDlZy6VhvkcQrR/XXQsg9AUhzbtU F/hY4gGp8yzl49THMQ1CGGNQ2npunCuqt4yFX2J4QBdhgUS15gqTjp+g7DqdJCOvihoPNBH8HV4 LO9WIToBai3LsrtvHADRkYncHZewJ4kFH/nMTq/Mfi0VCQIAtt7ygO0Bis/xWpk8trlY72WAGlN RLIgoYcbTlLeDXUKQBNSsbRFvuNQvKMX+wPJiVRZwc9WbZPvUqfYTE7uZhHA9ej58SOPBJmn6a3 ZHyofM3zFlDG9zQSIo1VOVSTWsRYt4+TLcmq+B2HDc5jbCkuhrGu6r45fKOtnbKxS1qygHhYbGM g7ZAMjdMf0zd8nG+WFpnDfRrvX74klBeex988MUofZzahavSb7OO3bQx7GFg0uixZCcoOxAJSNa M6P6rs0IhVmihaRqWmTBqHDrsfZQlCwo2qLbmAcA1gzxIkIkXSQ62g+ks= X-Google-Smtp-Source: AGHT+IECmPThv0Pj+IN2TLSZCg1tMWtQ/247+6M4vZaDrhQEPTeNbG+7UqTvBNKcUxCWgn8CSNVN6Q== X-Received: by 2002:a05:600c:3511:b0:477:6d96:b3ca with SMTP id 5b1f17b1804b1-4778703e676mr30655935e9.5.1762954919724; Wed, 12 Nov 2025 05:41:59 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 02/10] chardev/char-io: Add @docstrings for io_channel_send[_full]() Date: Wed, 12 Nov 2025 14:41:35 +0100 Message-ID: <20251112134143.27194-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955401143158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char-io.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/chardev/char-io.h b/include/chardev/char-io.h index ac379ea70e3..5b181be6a0b 100644 --- a/include/chardev/char-io.h +++ b/include/chardev/char-io.h @@ -38,8 +38,28 @@ GSource *io_add_watch_poll(Chardev *chr, =20 void remove_fd_in_watch(Chardev *chr); =20 +/** + * io_channel_send: + * @ioc: the IO channel object + * @buf: the data + * @len: the number of bytes to send + * + * Returns: the number of bytes consumed or -1 on error. + * On error, %errno is also set as appropriate. + */ int io_channel_send(QIOChannel *ioc, const void *buf, size_t len); =20 +/** + * io_channel_send_full: + * @ioc: the IO channel object + * @buf: the data + * @len: the number of bytes to send + * @fds: an array of file handles to send + * @nfds: number of file handles in @fds + * + * Returns: the number of bytes consumed or -1 on error. + * On error, %errno is also set as appropriate. + */ int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len, int *fds, size_t nfds); =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955399; cv=none; d=zohomail.com; s=zohoarc; b=OVxC66pMV2JO2KskHXSA5k8yIjj2gvTxO0KxaFmgApFl9CWJZ0uQVWcrrlYVu8sngg3JVi2pJgXt/KA5MsW0eHAjikwakME9goQHga90rgmh7B8LS+j33lJfjcmszYWNOEv8udNBKQQqo7TlaMmJ7lHkINFat0HU9yWG/qG5Z0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955399; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Kqvv4c6i4mp0sBOCXGvJZ0HxeshggKA5QiiUueMIbSo=; b=YmMPIrstoKoXJ9fPAfEfpW/jIDH0aFwXCK3WezPPnC4tN9HtI3kAU7D0cr1K/n6kOvp7XdGh93mJTWHlBVC7opHeGvT2OK5j19eDg2HJOQXrahqlnEyEZgyQSq8hmnk6ksBxPHgxWJpZeFtkcgEfNp4tAl5P5qdNcKHX+7/jXVE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955399229347.1433346642124; Wed, 12 Nov 2025 05:49:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBEE-0007DC-Mu; Wed, 12 Nov 2025 08:49:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB6x-00042F-K3 for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:12 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB6u-0001KD-K8 for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:11 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47118259fd8so6145385e9.3 for ; Wed, 12 Nov 2025 05:42:08 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e8e743sm34172765e9.15.2025.11.12.05.42.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954927; x=1763559727; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kqvv4c6i4mp0sBOCXGvJZ0HxeshggKA5QiiUueMIbSo=; b=bvDi6JF9/0ZR0fqCFITXPLRIfdUqyq120dqI54um7yBPt6kt521Af08WSKF8vxLGeb PKGY/vaw8Ds5m2G05GZKJkUsx5tOfk0ZF3+CW2Kk/st63nfeAxBWhgvW67ejg4gvuQzy uoX6gyuGWir+enlIkzcHR1T0qoroH57tXsftVFOQZgUUiHFAxEs48J243aoncUAz6p52 vw8I/nqMYa3Qiw7j0LKATlLp38H7UwBMrJKnVkdrhtH/tiT49ejovPrqRdrpusB6ypI5 RKQKW14f5zlwPOS0sVEh0P3F6arCHx7IAjdWun6mfkjQ0lx4CwvWgoq4GOUQVAxTcn2V wFzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954927; x=1763559727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Kqvv4c6i4mp0sBOCXGvJZ0HxeshggKA5QiiUueMIbSo=; b=J+20xdp+Bw4Z71uB2Gc2YQOAW96oX4EqmuKp6PgtEDmqzOhwhXqZSIFusfITIxCUxK eAnThWYqKiRXybQZ3bB9D6oah/sAv4IOQybBuSeza0GukB0cFPA+cU8vm5YbcepKg/bG Ez+2DBRu3Y1LMofgjhQO6geWdE83t6hkzUuGt367Yss7l93oqkcc6TKl16jeTrWMBLWM d5P+wuSiRStOjah1kBDbBn9LaQ6DKDYWKuvEJ5BK7+ftK6WXoUviBLZ3ZAXSazi+4Vnj /lWDtOyS0HZE9YVPp/62BI3O6YiP4CqWWfOWFSIsULlek8o/2Wj4yAQ2UkCxOB9sgLkx TSHw== X-Gm-Message-State: AOJu0Ywldqu1EfOzdILuKuwc6i5VXqKuWxGqJknKVQPUx63E5cpta4+W mNc5RYgfMfJeIZ+p4Cr1KlMUf79+R3FwHdno/4g197ngzjwBOipFPzr2pu4Eqe5xn5zACEA0C0P gwhGVOC4Bbw== X-Gm-Gg: ASbGncuv5q9zCO3eFBPa9Zo0sCftl+0Ci8mPgspTwraMllO0T7FaRuqb6nCPqPXFeBT IWUtv9N0nxtLXB2JaAwt0AChTr2aDwxT2AbdoQ+DZ5S5WprEqHBc7V9tLGIKFL6jKttv79nOhTw QcPHD+QB75GzzQSP/JgR6IO4sL9YcAIwcU5nM2NMb/AfnHENGUYiO0ELtAo+Z0uQeao2RaLVC5p JthfOpYmqRTHVspscvWIeXdu0N+eUZNCZRtHmFaAPWcoOca3VVocxgH0JzrgoYgHz1w0aVXZO+g AVuLyfVOLK0eXtxzCn/6+KGQPGkC7CqmQ+6xcG1PQYzgRITxUD70QpdbIaB78Jz5WCau8mnmd2l JWfHEMxrqYVkOtKQI8gtQ0LaGYf8RnyQ1Jp3Kq1vx6L9q0ZZq6evcOpcmPjJvb9/qF2T/KNdJqo oJdmiRf4QNAhjOYHO+pqiaMtX8dr6s6pY67WePjXJmeMJCw6tKFwetRp4= X-Google-Smtp-Source: AGHT+IHwvQAIqQo3qXpDX63W7d62iIL/ecSGXZ28juJnwIFUt5yJVNib7cQ+0pvxVRC8zDcqwe4IlQ== X-Received: by 2002:a05:600c:1396:b0:46e:4246:c90d with SMTP id 5b1f17b1804b1-4778707c897mr23436145e9.11.1762954926657; Wed, 12 Nov 2025 05:42:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 03/10] chardev/char: Improve ChardevClass::chr_write() docstring Date: Wed, 12 Nov 2025 14:41:36 +0100 Message-ID: <20251112134143.27194-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955401143158501 Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/chardev/char.h b/include/chardev/char.h index b65e9981c14..df55c7f4e67 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -263,7 +263,17 @@ struct ChardevClass { void (*open)(Chardev *chr, ChardevBackend *backend, bool *be_opened, Error **errp); =20 - /* write buf to the backend */ + /** + * chr_write: Write data to a character backend + * @s: the character backend to write to + * @buf: the data to write + * @len: the number of bytes to write + * + * Called with chr_write_lock held. + * + * Returns: the number of bytes consumed or -1 on error. + * On error, %errno is also set as appropriate. + */ int (*chr_write)(Chardev *s, const uint8_t *buf, int len); =20 /* --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955399; cv=none; d=zohomail.com; s=zohoarc; b=GkGs3RmieQnMABbN5IaLrYmIHipop2nrq2yRxTq4g+VSg2/u3l7mzOFvfRGD3p9HVrmSGNeot1CLQ30msWC6PMc7yttRFjfTU2q2qCi1P6QkzW5rtPih50mGVY+XBsvKDCyRuHsKQkIPR3NGjEGmnIernyBfVuHrwmL1PvXT4B4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955399; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RpfJ4jVX8PRzGjLcbMi2UKEOY8vjEXd8DJ9mg1LwAPA=; b=AsPZ5Dp3j7Vq8rVPTso+3aJo9sRk8nyPh+Tq5KgRf/JUpYYNUgm57QKNvyxX84WF7l1oCt4D66zIXrVZDO9id7dt9CKahg5nGvRXDe6ttKqE9i+ga1PrWU4s1BOrTmIYjPS/z4yORJe2NK0YENFFhj4ulsDBXY4IiqLZE19FSCs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176295539940896.1851122697226; Wed, 12 Nov 2025 05:49:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBE4-00078c-5m; Wed, 12 Nov 2025 08:49:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB73-00043C-AD for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:20 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB71-0001L0-PH for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:17 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47789cd2083so3751435e9.2 for ; Wed, 12 Nov 2025 05:42:15 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e8e798sm35417825e9.10.2025.11.12.05.42.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954934; x=1763559734; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RpfJ4jVX8PRzGjLcbMi2UKEOY8vjEXd8DJ9mg1LwAPA=; b=llLavNj2I+HUAldU4+Yt5whOSYFIzXA5Vhy+/Urnv0xKjKmgSaKJKGvgf0NblRfo77 hZBPZrMn6PLKaT3WmDbz4CX24dk5D5lp0H0gy62TZfu2fcAxyUSuYhfCLFMeHtleOexx gqH5pfM6CLKdUbXlzCHidvjsB5mgHxPDRw/BlxHMBYoj0kprUam1AxaVnvf9R1Gdi7LO 7nmVdrbvWW1Sc7wNSvFpCp7qayrLoxwakjr7mRRTb1peM9ztAOVX1bu2Vb/0/PPB9kLE mHR2ZmcAF3vVHN7g9Y1BHnM/ivPSgJvzPPYJaTrNq6p0hjsdEQU6cmqhptn0M/fGniPt /MRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954934; x=1763559734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RpfJ4jVX8PRzGjLcbMi2UKEOY8vjEXd8DJ9mg1LwAPA=; b=vM03RZ04dqsmiQtCtoqW+UKxJxu1CAaG/b8tFd5BmdtTX9fDIrdFaRVyXm7i/igcPr jbGMMTRU14AfvR7qXHtGoEAtWWNQPS9tG/etwXif5WiHLRZq0xWniwIjfAD/ABBpKw6S 0oiU8ae9z3HBKLuMmBZLfzKDhoGytO4NAVRDZKJg18iPk7i3MVMF09uhGvSMSrq9Vr8O ZhpFjzmmhcNWsimgVnGgXgGD4ubu6GSRqCUdzie1TdC9tzP9XMxLaAwCqNN2l83Kunum JsVb7NC4+3vDwIBUkBsa/aiw0X3KWNA49I80F4zTTA7HXzk0MzQMrrYJz6+fVQJqLT1k 2vQg== X-Gm-Message-State: AOJu0YwtEziYkcyyMpX8OpJ/cwyeeGDayxLYWqCT/Ba51iCMhfnyiKSW OizR6mpLZqhgNiDPHW3/ezCd33XM0Dak6G0aQ/mtIfepBXLmETUqR1AR3glwp8DrqVnrPl64rV+ MjM0nq02wxw== X-Gm-Gg: ASbGncsQ+7k33F5YinSyhXk1putdu1s1nf07QPqUWG7V+8y1o/6KRfVT+M+FrN0r89b b0zh968JJB63WmgO2aU/PXKHAAjaKafXBezrux4eJjvTlfx8Ng65lXMB3x8kXPqrGUa5WrHG0qq fdXoI4WtLKrNh0dg+eBMyz7xIOFABkL7oJRbfv1oPv0JHq33bMlYIhNGFg/VKZIfL1oVzs2b+hJ IfN1jbMx/RAd6LMWQbtXxuZkgh/FjVfW+ZhJVR+IROtqdoLWxYa/lsJM67rrSUjj3lGL4DXKEwR zP0jouuNwvI4CjCsxuSGhmxH4PR8fPez7y5p96g6r9UIG/GeZglgwUpq16zVmvqmZmRvqQ0L9pb +8vKqsGI+Zw6Xya0wLpv4kBqLq39kiTpoo4waws7obveFVHJvCQBlHTHyk7V3i9rneTgZaazhoi JNwxTJuuDcaEt6KUzEdIhCr3238IdJC1pirR1W2UrJL45GaRcMx5P+/ZE= X-Google-Smtp-Source: AGHT+IF8PpiXsnoKZXjUMlDZQSx3EHhpu0A7iBpsvCfG4lu3hnCWTf4ODBLCnAZOyBv47g1LjluNtg== X-Received: by 2002:a05:600c:4f0b:b0:477:55ce:f3c2 with SMTP id 5b1f17b1804b1-47787084475mr23116055e9.14.1762954933725; Wed, 12 Nov 2025 05:42:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 04/10] chardev/char: Document qemu_chr_write[_all]() Date: Wed, 12 Nov 2025 14:41:37 +0100 Message-ID: <20251112134143.27194-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955401163158500 Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char.h | 29 +++++++++++++++++++++++++++++ chardev/char.c | 1 + 2 files changed, 30 insertions(+) diff --git a/include/chardev/char.h b/include/chardev/char.h index df55c7f4e67..4aab018938d 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -223,8 +223,37 @@ void qemu_chr_set_feature(Chardev *chr, ChardevFeature feature); QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename, bool permit_mux_mon); + +/** + * qemu_chr_write: Write data to a character backend + * @s: the character backend to write to + * @buf: the data + * @len: the number of bytes to write + * @write_all: whether to block until all chars are written + * + * Attempt to write all the data to the backend. If not all + * data can be consumed and @write_all is %true, keep retrying + * while the backend return EAGAIN, effectively blocking the caller. + * + * Returns: the number of bytes consumed or -1 on error. + * On error, %errno is also set as appropriate. + */ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all= ); + +/** + * qemu_chr_write_all: Write data to a character backend + * @s: the character backend to write to + * @buf: the data + * @len: the number of bytes to write + * + * Unlike @qemu_chr_write, this call will block if the backend + * cannot consume all of the data attempted to be written. + * + * Returns: the number of bytes consumed or -1 on error. + * On error, %errno is also set as appropriate. + */ #define qemu_chr_write_all(s, buf, len) qemu_chr_write(s, buf, len, true) + int qemu_chr_wait_connected(Chardev *chr, Error **errp); =20 #define TYPE_CHARDEV "chardev" diff --git a/chardev/char.c b/chardev/char.c index 3e432195a5a..105b0d53184 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -108,6 +108,7 @@ static void qemu_chr_write_log(Chardev *s, const uint8_= t *buf, size_t len) } } =20 +/* qemu_chr_write_buffer: Return the number of bytes consumed or -1 on err= or. */ static int qemu_chr_write_buffer(Chardev *s, const uint8_t *buf, int len, int *offset, bool write_all) --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955575; cv=none; d=zohomail.com; s=zohoarc; b=AKhHniRQsmIDvNxEJi+JNIOS+MRKVgj+Vw+iiJcchQh31vMbz1sj2nr0EELc3emUidLlZtmDQ7y4WIkrDZm7Zj7+/WlOmAmYFTl7tr2Lux6y/tNbbhLAcFngVPgUyekeXMXCW6s3xMiscOfuymWcZITMOH6cNmjyFhmg1jPGPTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955575; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0pYieo1+6dfcbenlhIHP+WF6cacxySZysF7HQTfjLpY=; b=BQDWQiDoN6p/SD9zceEtKZNrgKYkqqpKnk9D1NQ03vHF8EMjeKRK9+yuvj2vH1oW3PnTjmcYIk8aJejQnzFUCq6R+4Jj3x0qQux8aE9MSw5EU8ILGptRVmFJEGO4J90AikacXeCDaX2W0EVBoBad8/NoDYby74s4xHXwQrmxD10= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955575324523.3527036056583; Wed, 12 Nov 2025 05:52:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBFo-0002DP-Nh; Wed, 12 Nov 2025 08:51:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7A-000459-KQ for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:26 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB78-0001LU-OP for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:23 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-47778b23f64so6115995e9.0 for ; Wed, 12 Nov 2025 05:42:22 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e486fbsm34773685e9.5.2025.11.12.05.42.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954940; x=1763559740; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0pYieo1+6dfcbenlhIHP+WF6cacxySZysF7HQTfjLpY=; b=hecaKoxMEl7efQPk9yWWW1pdI87O9i0+bH0RocQ8y6RNH+MfsCvA7K4U29ScnaiAUU nSlliH48yt9LeI0DoSnTHkXpStv541uVbagbQrQmFPLoijj0orH0f5aQQJcTm3e0AiKP VXxWSu2vT7Mna/2ei/4lQWntxrtNRL5vNxCcB9rf5R2235xYdX7jXXZkDybh5gRzjylK khql888gHyRqfYLm+FZjNkWWz8vw3n2T+3sOgU2a8qo0PyP8kdEAh3OrKJfwiAtDfS6+ 12rr+0K/LszfafPJFi1Hefof152Zg5shJQjqGR1Pt2VXFY05n5+e7KpjrDqr83yeFTbs 1GmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954940; x=1763559740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0pYieo1+6dfcbenlhIHP+WF6cacxySZysF7HQTfjLpY=; b=oW/bUD4kIA5Jieg6Qp2drULeRKnKfUFnzTH9pBcL7T4EIvZ7TNY9Dk5iPwqkDVPweB 31MKsHFlSrQBTplp78LPUcaH+1mVhlCM3S3UZhVOXvt8vg5vz0TN+EjDBJEfBPvmhWUw F8Ntv6AJUmgn2QB7PaODbgqTSXu4WXSmJKBMpKuMCmjA57osmB7Be/1tsWLp/AdeizE7 VD00uVBty9CukRzeUYJAWSGcj5phMjzMwOs/gPy1yZKOWHgBCfSjOyfPxtDQ5tirzCIq HkEzs7n4WaZszzz5IPWpRrDBxDoMxMz8vTbyEY1SnLhCmb9ms5vUgZ3g8HUGEDP14TJC OHOQ== X-Gm-Message-State: AOJu0YzNEf0HFyOzCEw8rF/vnwRb6O+xjMvLTO5/N0qodIQFwOttxK8v KYOjUQt+Q+AQBpRUVFvw5TQJE3FAfVeHFg/gqEhO9OqyDN6loRVrERMvqcDtV+aq2/w37mN4Z33 XMKTmhXavuw== X-Gm-Gg: ASbGnct9P+AerKqWfeEEc5UWKqfiWb4R7fz6oiAjDGPPEJTFOoKMEnFXBLab8Fm2Y2z doYZRNrNoxj+WXoDKUPslmSbz8DNv0a0+tqIw8SGYY8BTwvEzR5oo+n9Lh64m6pYvhPkntzi9HI qtABPQHZpq1RLnO5WmYzcCkIv9/3INlZxglmBQn3TzR5xaOZfl5CBA52yI8+T2zvDzrKgcFBiWO wSlEagQbKR0zUtBlnqEyRwbT2MwXjhUIWlE6m7wCf0N42MqsLdSK25iNp1Unp2APY77q7dCoQHw I6T/HviQL71KpAUPXdtQ/9niCUglo4U5j8ORNPOkHR9I4lJ/0zDwwBbjfGP/oT2Kt/ZT8CJf1wZ UzIyxCSW6mEL23L/WTbx30CmzFGiM7z7vr3B+xsazwhcQMiftDbn6qe0Go9vXlHQ0DH6hIh7+UF Rv6/Not5wp/UrddPvUhR1Tu4nwQNOD/GDJMQiomFEkklAtD1YKUQJkD3I= X-Google-Smtp-Source: AGHT+IGme6ut1aBA7asl3KLM1DTfWrl690FNOykvafBr91i6tkg4cUEcJk3nEYeyRbiaG16S5eqtlw== X-Received: by 2002:a7b:ca49:0:b0:477:8a2a:1244 with SMTP id 5b1f17b1804b1-4778a2a1695mr7485285e9.11.1762954940592; Wed, 12 Nov 2025 05:42:20 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v3 05/10] chardev/char-pty: Do not ignore chr_write() failures Date: Wed, 12 Nov 2025 14:41:38 +0100 Message-ID: <20251112134143.27194-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955576877153000 Cc: qemu-stable@nongnu.org Fixes: 4f7689f0817 ("Avoid losing bytes when on (re-)connect") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- chardev/char-pty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-pty.c b/chardev/char-pty.c index b066f014126..652b0bd9e73 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -125,7 +125,7 @@ static int char_pty_chr_write(Chardev *chr, const uint8= _t *buf, int len) rc =3D RETRY_ON_EINTR(g_poll(&pfd, 1, 0)); g_assert(rc >=3D 0); if (!(pfd.revents & G_IO_HUP) && (pfd.revents & G_IO_OUT)) { - io_channel_send(s->ioc, buf, len); + return io_channel_send(s->ioc, buf, len); } =20 return len; --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955472; cv=none; d=zohomail.com; s=zohoarc; b=dQoHaGC47mnia+y8XMIY9nv9JEwT8JmmBWzwf1wzv4t4k4sthz1fGKu3jL/nRrKPX7UDXBKe8oOXIfom1piblzjHtAv5p7p7+bNsacR6zQd7aEXCY6IBwmBYpeDX/XXcNq6ERVh1Rirk8b5v0Qf4/ax33IjZefS2nQO5CFwEuF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955472; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6NuFzPNCwgBB9LblffFmsa55eQ/4iQv98wvI6PkiWGA=; b=P/MiVcAev69DU+4CkxQt8NcgH1UaYfjqYF3353GKIz/et6gjHCKO0ngLEWnhdD/YMwvQHKfADhGlagyPVhS6aSc02JgYqwg4ta2KkLe464IsdpwXFMamlYHJdkL+s92RKc/W8F/EsJKT7WnSa9gQjD4RT2nR/3Mo1LPo3u6m8Tk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955472139317.30789290939265; Wed, 12 Nov 2025 05:51:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBEF-0007E3-3N; Wed, 12 Nov 2025 08:49:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7H-0004Ae-5d for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:32 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB7F-0001Me-Nf for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:30 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-42b38693c4dso404039f8f.3 for ; Wed, 12 Nov 2025 05:42:29 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac67921c3sm34772695f8f.40.2025.11.12.05.42.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954947; x=1763559747; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6NuFzPNCwgBB9LblffFmsa55eQ/4iQv98wvI6PkiWGA=; b=owaGmlmgWg1p5xYyiifAAn3J6VH3Vhx1c7iYeQGw4wypdAZe3DIPw/SRm8mQxw+a6I Zym7NOUtqWcJ2Lu0/LrhOWSqP8HdXPh6ri5OkR+Weoe2R2P4uwda5fnd0CfJeoHJUtNR VYe+nChDm8ZyEJlaxHJUB386YpZvwdcI1zf2hZZnv1XziK66mPsi2LrDyc5sAG5rtJMO l+DngIHhlM5OiLrSuuy0Th3CLjUrj2tkwdxGUzmzmO71iTtdb7IJIaNuv5lsx3NtsbSQ DWW+NUpdCghHJgjNJtj/eL6G8onX2pq6/eIplgNG2rtBUiwrHYVeGgiaRdkFZ4s/B1hq twOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954947; x=1763559747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6NuFzPNCwgBB9LblffFmsa55eQ/4iQv98wvI6PkiWGA=; b=HHOrT3HBVQpyyBom7ov/vF0vpYMje6cI2HxgVVPfBnL7uE34Jifhfhq7qC/Pslevrc gaQsE28rgXfv3tUNdObXWOYeM+lSJy3DZmSpipyowNWCIufmXsUk5wN226HzjJo2+QLO 46SzxHpWi2GKuL5+4Xo9b17kdQPRlah0x3AvrvRJWL16KGLMCmy5sxw5ZzH12hs6PUBG AHyOvRX12Xc1U336y0SdaHd5bra5g7QtGeL6chSYjyaNhz00uJGjDbwHIPgfv80bxwbf aiVnQeJLA/cTLD/Cd83mFVQMRLu8uBFDZjEfQ/ZWPXEub2kR/k/SAEThKEHVWkmKeAEV ie6g== X-Gm-Message-State: AOJu0Yz82vs1w52mNz1Yv9+5mbcnvnUaXiskTqwH4obNyrdEboT8KiDQ McWV5dEl+2LJAHvksn4IEDgW6YL8W42L0y1KqieZpuZAHhy7crxIGfCUZbI7Xz4myv5k7LmN5mk X6TqPfKpnQg== X-Gm-Gg: ASbGncvmFBbYssArBIuozHSQ+dwMIJf5HDiRGxDhaCDOPDtC0LNm+A2L9RfnewS8Zot SHrk5Mfv4fXU6Xz3EFRSSnCAJmoOchA6T3iXK6ZT2JMkoSjCcSBKRv3oM23gdomsOdssICR8XuL kMUyVKDxY7A9rgd0eWdrebD+MRurlVtp1eRGf9KdLB3mpHHHvZiQTttYM6n1g+xa1XnyF1+Z2bw Sq01+av1vZ/rYbfvJNXw+v1zFheRogyN8VaQxf2tm0lyLGbYjza7RlmYaTof+XJNiIbf3vS/j3i FjhsgwgJ92WyhvyR2y/QZe9s8RkkhO+2HRW6vUzDF8DkisE655Rc19t4DAljuynbRssBOq0txh7 HubvFvp2Jj89Cme2mS/HKvkI3NXzVzMYIO/74l2rxmweRIG2FWjkccGeDKaZp8y2xMR1e2RZDBo xl4zQqdYeeotiUR5AnsfZ3BurUt7FHJwq3at1keJkc1ofvvs4y+NKn+MA= X-Google-Smtp-Source: AGHT+IExEjIeS26/WorPB2eRgkhHxRI7V4iJI1VXXnfi0zNWFgmjvLuo2AoPLb/BheG19yMF7z8irw== X-Received: by 2002:a05:6000:2888:b0:429:cc1c:c2e with SMTP id ffacd0b85a97d-42b4bb90b6bmr2259806f8f.1.1762954947478; Wed, 12 Nov 2025 05:42:27 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v3 06/10] chardev/char: Allow partial writes in qemu_chr_write() Date: Wed, 12 Nov 2025 14:41:39 +0100 Message-ID: <20251112134143.27194-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955474687153000 If qemu_chr_write_buffer() returned an error, but could write some characters, return the number of character written. Otherwise frontends able to recover and resume writes re-write the partial chars already written. Cc: qemu-stable@nongnu.org Suggested-by: Alex Benn=C3=A9e Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- chardev/char.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chardev/char.c b/chardev/char.c index 105b0d53184..7931f4e0832 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -186,6 +186,11 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int= len, bool write_all) =20 res =3D qemu_chr_write_buffer(s, buf, len, &offset, write_all); =20 + if (!write_all && res < 0 && offset =3D=3D 0) { + /* Allow partial writes */ + return res; + } + if (qemu_chr_replay(s) && replay_mode =3D=3D REPLAY_MODE_RECORD) { replay_char_write_event_save(res, offset); } --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955484; cv=none; d=zohomail.com; s=zohoarc; b=CR/YiL2SJoh/6GEctAzLDFE5PFOayNc1sH1u0FblRRKBk3KYeKxm00YfuL0iij4bfBnlc6cOX0CYlb6P1nLKhEhTIeFS4+l9DSHkobUzfpBlQE4CY5USAr3TO77mmhL2i+fq5lzYU1KYnBQqTkEgG2Hb2jnpyh1gXX11V4HaojA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955484; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QfROIVJKqfl7QKnSQpWNFzHIRml7qxEw0ys6YQW3ulo=; b=ZzI0xgQRH9x7GqoMG7RJEhOUUSpGUiMVIFwBSN0ZBLSAt3BmTPqP3m7rlQpzEyYy0WZKUdyuwBdJhJ7D67bnLoAHerqvnw/wqSXkDY2i+mPQRIkwiGPfZMYi3ec/ttbq/61VU7lJd43Pj2ve9gCKPKxVrkUnDVCH+4g0nXBCHf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955484753179.11680902542503; Wed, 12 Nov 2025 05:51:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBEF-0007FB-Mi; Wed, 12 Nov 2025 08:49:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7O-0004Cy-9F for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:41 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB7M-0001NJ-Ec for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:38 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4775ae77516so8961695e9.1 for ; Wed, 12 Nov 2025 05:42:36 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b2c6d3f67sm27951608f8f.37.2025.11.12.05.42.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954954; x=1763559754; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QfROIVJKqfl7QKnSQpWNFzHIRml7qxEw0ys6YQW3ulo=; b=xXfo6V9ltwRGH22ODMXuLEq6FI5CeWdLN77Vy5/UNZvtfTdUv/mX71CcvrK9y66dkA x5MG/aOHoq2kuD6jV3XtMwW4P9mPMTqQHPFRNqRl1UTFAKToqswGPkXqhSa8flC8LyDs kEeDBiQLqGPLbeajjXu1fsL/Ta3ZKDzVMpS6VVO6On8YA0BodgvU/Xj8r7k+FaxaGGQt nFs1MIVKaBkompZLBGaR31v9sDaGUh/mWn3+oXJjzaIGoixWpfTo41Pbjoai1i5IoOrj a12TRQDKJPU11m5t7+6MmUxJr4bRKTKsI+tg1Evgdu8T/349sXde4Rjm961/Mpvy0BkP DPEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954954; x=1763559754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QfROIVJKqfl7QKnSQpWNFzHIRml7qxEw0ys6YQW3ulo=; b=wJlBE3CMteITKS0DXyN8E4IcqJJ+HDRREoSf/xuUgo7fI7Td4Z0JkazriHffbshkHp TgaMdvKK8i+N/Qn+jib/fYMaLr+YnKYaOjA3YYgM6V/SMumWaFYf3TUGBILxWHz1LOub Az+6nOtsuSBe1srjUb4535o8b9rDZEt5q26pQMYJH2B2jVpVese5g/8+GNQY59cZHFzP WSR8o5NyMZPFkHw+AfPXrtAwba0w9wtHBsBmEK1v971ZAgsjzpIuGqU+9Q3HnUblUOhK ieZ+0d52/hc9bXGmX3E8QZlEImmRknlf8gvFa2Yldo+q+umzx1l+qZf7ci4q6X6kMpAA K63w== X-Gm-Message-State: AOJu0YyHYdT1XHAWBbzdPP0/at9genbYUy0rYQzV1wq/ointYGfKQD9Y Pqvkd6eBPU4JABHEP7NoFi46dFuRn60Z6uw7dhwJgKJuIqUXew7JQZGYFsfAJHBoD70WYa/cAqj DE5Q2IBdb7A== X-Gm-Gg: ASbGncuUI5iapTMtPe6sNF86O4FTbJPevfM9RSl17IDlEnUsaleVdwL0dOAu8IN3qso IUyzw+VfjrhO+JZQeUn56N5yX8eT0ZZst/6D+TL2QUikL3gR7MzEFnTRneZqhf4xmmOk7WJeyYh Q9wgusxMlYFfMWs5+EcjEJgj0X0f7vedjxoUshFT9SiDEC2sCfx3knTFWX1BJBgWdeMV2kJg3UU kZKV/uIc/ViWa77kLvHwVDddctHbgAgqQ47hLyu2q7knDcGjF2S2jjYdO7i4FqUmP6AIcSH0uoT TcDkEu7fIrYtpr3MZ+jfd9HwSR1uJ9NM/HXyZnEl3ONzWuNuJKfekfpFbsScxhE6xmBHHFpjbZX TZly+lSWAsLdT+L4e81FxWOZw7MPR5DLo1eB4atUWURfA9tp0dZZJpOR4T5M00bd58fl99YEBmz CGIz8fi+hwxHctNnU6G2n/r+Lkwbohy6FY/t/IGsm1HeYgieISYEzd80A= X-Google-Smtp-Source: AGHT+IFHHTPtzjtpxezcgC/tlkCl+4sqWp6QwK3mmQBikIms2T7kNlVM3+Z0g8E/zIvlPyBv58bN2w== X-Received: by 2002:a05:6000:2003:b0:42b:40df:2339 with SMTP id ffacd0b85a97d-42b4bdb9f74mr2764618f8f.57.1762954954573; Wed, 12 Nov 2025 05:42:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v3 07/10] chardev/char: Preserve %errno in qemu_chr_write() Date: Wed, 12 Nov 2025 14:41:40 +0100 Message-ID: <20251112134143.27194-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955486113158500 qemu_chr_write() dispatches to ChardevClass::chr_write(), and is expected to propagate the backend error, not some unrelated one produce by "best effort" logfile or replay. Preserve and return the relevant %errno. Cc: qemu-stable@nongnu.org Reported-by: Peter Maydell Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- chardev/char.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chardev/char.c b/chardev/char.c index 7931f4e0832..46a2dbfb5a3 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -114,6 +114,7 @@ static int qemu_chr_write_buffer(Chardev *s, int *offset, bool write_all) { ChardevClass *cc =3D CHARDEV_GET_CLASS(s); + int saved_errno; int res =3D 0; *offset =3D 0; =20 @@ -139,6 +140,7 @@ static int qemu_chr_write_buffer(Chardev *s, break; } } + saved_errno =3D errno; if (*offset > 0) { /* * If some data was written by backend, we should @@ -156,6 +158,7 @@ static int qemu_chr_write_buffer(Chardev *s, qemu_chr_write_log(s, buf, len); } qemu_mutex_unlock(&s->chr_write_lock); + errno =3D saved_errno; =20 return res; } @@ -192,7 +195,9 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int = len, bool write_all) } =20 if (qemu_chr_replay(s) && replay_mode =3D=3D REPLAY_MODE_RECORD) { + int saved_errno =3D errno; replay_char_write_event_save(res, offset); + errno =3D saved_errno; } =20 if (res < 0) { --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955607; cv=none; d=zohomail.com; s=zohoarc; b=CrgRHRhJ2ihaitLefVr+JzEsj7laXubT+9RzvurTTImV8ZmfSLTjNVxbH9BgQAKahnRyDG1kJu3E87E+EL7vISp8XSpQGD8TBWwe+VWMd1ImMafs68y75FfPFJn76vyDNMR92lHcGfcKgLOwzqaEvT1IJTgFTvr/JsIDqzTtW1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955607; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7TFalIf6p2Ud7G8385u1fjKI34moKfzih1m84zw2yGM=; b=mxOpHKSEak3chEX0vgExSX7UXCrn25bHc2wfCEakRsvWbNgM9RJcyUBHfiBCNdTcHAIGnblzNc3KbEaS2ILiG+EMvvPCsdYuMamhsWBGInBWYdBfLSnkZWkcecGwBP1iDiItOfxNsw3tY3mDzyqbhfu2S5Mcy8Y6wlFTtoGSVvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955607080147.41627027883942; Wed, 12 Nov 2025 05:53:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBGT-0002Wl-A3; Wed, 12 Nov 2025 08:52:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7V-0004F0-3a for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:46 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB7T-0001Ob-Je for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:44 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-477632d45c9so6278605e9.2 for ; Wed, 12 Nov 2025 05:42:43 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b32ecf522sm22908082f8f.45.2025.11.12.05.42.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954961; x=1763559761; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7TFalIf6p2Ud7G8385u1fjKI34moKfzih1m84zw2yGM=; b=lQp6jxW0ut3ceKMa/WdcmJbq+fxNjAFS69TGOI1iRB3oiINqk1iY/L7FB8rsqALziI uUOT1Cp9g9nZUaSFA/glvT9Q80hF2sZBYYCWEXk4lZ5RlhyYxHk4bd+hUZ+mab2omsZW FTaoO2TCvRfYrH1p7v2Fdb54uaemT3v6epO2pvHpGK4egAhek3Nt74gcT15mYGEGn1u+ DCO5Tqolpbqxli3meSU11r+HaZRWlU9+dGqTtk8ub+fw1pgy6OgE8RZcUkPDXhbOLUz/ 6Ou2f4eIBK27dsmUtF1//fQjjG6vnqUKV6ZzGNIms8UpTTHLLbphlywlJnZH7DmK1WIH X4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954961; x=1763559761; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7TFalIf6p2Ud7G8385u1fjKI34moKfzih1m84zw2yGM=; b=drawAe2aQOxzOp2axJXS64yWCFufejdKzC2dFLVMN21kwbPfilPVIV7tXiC2ht/2vg iR8TsvkNf7dgdWJhl2v2CUdZ+3XzqH0M7vLqjsO+jNsntF0yYjr/zAdfHyxPQl6JlnT4 93vpoyvwUJnpRy8ccZd6x/H+X91GdymqXtuRsHxsk9Ajwr5GWkEv7EoUIre8HZcvoDb4 0Cn7gCBad8Hm/HfkzxpcQOLTBFVgf9dztTVv111036Uw626XnoHSvKs8yOMho3YQ5xbz rwKx9FB6M7Zx8zc4+EApBNNCkQbaf1MBv5PIjTaM/sdahr+w1KKpoy/QwVdBKE9YRcV2 z8gg== X-Gm-Message-State: AOJu0YysqC0oqndiKuzEKu86HSwJrGJuikcybNap5WlOUizKZ/9NUM6t 4eaBh5OlFg9IwKCOlshI6F5bgBVgQtFIK+JntYS34QU4poQ9Cx0OU+Cj+TnNgg7+BNEQ/ZHQ0m8 VAO1OQPlg5g== X-Gm-Gg: ASbGncsmweZ+xeOs4KW4rwW8aG1Bq2hJhhrlnk5I8kZXaZtWW30mrWFwTmkLAGPZemj qxHMOUVA/FmiJjnR0OrfJUsflOgZbFLWuV3mU8JyfQTEPjiTelZA+SIr6CkQP0q90Uh+6AtW9l0 degUitseZA/aCJlmPM5HKtqaKDEj7eie89dWR9ceS2+ErfnSKekqZ7DwHNvXX8mdF1o8WylNPn7 z0T6z5mwoGBE41wosmPxgEVmFexPzzIRYpeXAHzTxPOPgCAh0y5i6c3ET5mTVGPGdC6sG6P4EnX eHDP5GQA5EvQnVB//Ip5MNWU2QH3egl0Yg25hYyrG4Pe5ZpJX8CMbzDBmihGc/p2rkUOAttr0Up arq0ygGJ3v49kas0K+4ZdgeYyWq02xOfh1k8uTFqbKm7MXzshiWXUST/yeCDoxw/cW5Erg674Hw OpgoKv7CqD4rx11Ei69iRZfmzOrcJcQo1ZgBvEQVZgBmvjfQkPlsayNnQ= X-Google-Smtp-Source: AGHT+IGjJz/Ru1QoGC/G6zHrb0o3uOx0SmaXgE1I/3vEgRpYCihWxP1Y7QoO1ELr5TmRunhBvUqDfw== X-Received: by 2002:a05:600c:1d10:b0:477:5486:ec73 with SMTP id 5b1f17b1804b1-477870b953emr28428685e9.39.1762954961484; Wed, 12 Nov 2025 05:42:41 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 08/10] chardev/char: Document qemu_chr_fe_write()'s return value Date: Wed, 12 Nov 2025 14:41:41 +0100 Message-ID: <20251112134143.27194-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955609071153000 Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char-fe.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h index 36bcf1f88a6..fbec6a73dbb 100644 --- a/include/chardev/char-fe.h +++ b/include/chardev/char-fe.h @@ -238,8 +238,9 @@ guint qemu_chr_fe_add_watch(CharFrontend *c, GIOConditi= on cond, * will send data from the front end to the back end. This function * is thread-safe. * - * Returns: the number of bytes consumed (0 if no associated Chardev) - * or -1 on error. + * Returns: 0 if no associated Chardev or no data could be written, + * a positive value indicating the number of bytes consumed, + * or a negative %errno indicating a definite error. */ int qemu_chr_fe_write(CharFrontend *c, const uint8_t *buf, int len); =20 @@ -254,8 +255,8 @@ int qemu_chr_fe_write(CharFrontend *c, const uint8_t *b= uf, int len); * this function will block if the back end cannot consume all of the data * attempted to be written. This function is thread-safe. * - * Returns: the number of bytes consumed (0 if no associated Chardev) - * or -1 on error. + * Returns: 0 if no associated Chardev or no data could be written, + * @len on success or a negative %errno indicating a definite err= or. */ int qemu_chr_fe_write_all(CharFrontend *c, const uint8_t *buf, int len); =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955606; cv=none; d=zohomail.com; s=zohoarc; b=dTas/GnkNPQuiRsQ2Z0PxCqBhdI9s/ue8vXO5kkediCJBydALzncXE5yuBLua6ws+fbTciPdgljStQu8T8OpWOnyDPPUcgiWVbisIS42ur/PycgqlZJ/K3G0oY6vDC+Uuq0KvxBklX1YvyKc9CXXAOHlOKBetx/3OFHdL7JUQnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955606; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+FKtjjNLglLvZKO2jnLzMl6gZsHlOg0FzPTza935NrQ=; b=PjyBGEOhD2sXGZXdeLml2Ty+jsdpa8SraAWj0JroiD5d8WbsCK9RcQL9bP1dKZTGCgkKkdLbBTiidzuU/RnTbZcraue9qfsaqFOZRkrUI7OzmGW9bdvIJlbZ8+RGcTvs4isaW80QCzy4IAnya+EUpyCILUrxyri6PjUUmsYSjlU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955606528586.306759834082; Wed, 12 Nov 2025 05:53:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBGg-0002k5-C0; Wed, 12 Nov 2025 08:52:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7b-0004Ib-Sm for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:53 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB7a-0001PX-F5 for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:51 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-42b3377aaf2so503941f8f.2 for ; Wed, 12 Nov 2025 05:42:50 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b2e052f32sm27479368f8f.17.2025.11.12.05.42.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954969; x=1763559769; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+FKtjjNLglLvZKO2jnLzMl6gZsHlOg0FzPTza935NrQ=; b=Mhf4m2aqs3yszqewGtCnGGJ0V2BJl3o80Zp+X1JPYhkGQhy6krI5wJlfKMfEDQn28y ibrfCm4/RWarUjy3RkIRqE7dGrGUKUrH5RniAav6RQLu0Dc4qEPdvnof2mDQodtuyLn3 bu36gIX1eZgbq2dMSBCeAofxxMwQYnJSjNXAemPCddgxrSTQHeuLEDsPEw3PEW0VQIA4 AyGk4IglBy3OUZjnWIIk56xkILhdYQapJuJDth3mTEpkZyy9nPdgKl2f9OM8wcJaAdFl 9HwN45p3B+2DMiQibvWSaKU0xzsbHy1JhtrIGFgL377B0M3oNmnwirIlu73otq20n3fZ ys9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954969; x=1763559769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+FKtjjNLglLvZKO2jnLzMl6gZsHlOg0FzPTza935NrQ=; b=FUUGX1Zv3ET9XPhlyr8y2SnynG+LZIZ7Y6yhXY7f/vitUSjiCuxbRIjBdB4FuhjxbB rGreXhd2tMEWfRWZ8Z96V6QdM9sjZ625nlqcMwhVbW+loBrs/g5c1KDkxKOojxKrhE+7 HtCBVuhDsbgH2mrbHtGULkJiNQwzObVesWM69Ir4jTMepRgEUImyutvQotk8NaDKfATT hWmpqy0s41B7ZhPdAcA12YQPhfAxNk4pae6q81VJEpiMr0v7PvG/bCBMUsxbeKf+fBaj EwAZfOmFZD6OfyzJkvpxLL8MvF3hshV1eMSKCpOjpdG9m94QeUPdw0QSeokb+GIXvZ9D HStA== X-Gm-Message-State: AOJu0YzzIXiZTkh4+gemOyapwtqSnqWsdJaAe8QmENL1eO3gL0GqXxdl ZPEeVlJ5sbzGoCc8FAam4BT8m4bXR7wFwTiJynjPd87m1F3LcCE0KwjoKOvc+qKLdp+suD0oNT8 SJE7BZItDCA== X-Gm-Gg: ASbGncsL5VtA+aALb7kJvxS58pMHWwTSmEIQ2sns5e4/y9J29G8qfiB3770XypIyHqE QG45BJBDWMq1kJHhccfn/LBgGyLDhFmkQER1tbGoBwLjrLaVtPOGWLexkeFc+FKlJLuEVIOVj65 E7Wul/OEL6jzK55ai73ZVJCNx7ZpSieHQw7XxCWAWR0pu3q3jvjRazM/Gt170Pl9YzBd1i35y+6 qNzuhTU2pcNNZRQU+RLoVJt4GcDzdqh0yqLrLORmQB14oZB3lYxCjQ13W4TVCrUEJJy7qKMt1Gd +OPEhgRZnOmOioUEJzjfDQaNd/X33++YgINJYhpR+F1Iu+3FL9HVENfPOnn2zkj7W+GKd2SACqd qBvMOJPJJr/p1qW9C3wUh0ASNEbxL+gz6AazavWr8Ea4sSn/chuTjdvgT3cUHDCb3mY/fQ2j4zU jf6csw6+xI/Zlra6vPRX/Fkxk+1uL/uG1HF2f9Y9og6Bba6rXk0kl/MJc= X-Google-Smtp-Source: AGHT+IE6U1v+SxSpbcd7fRn/IKD99tBQOXOF7AIL563l2AwmeycAM8BBAUsouxCh8B0yHer2RLgpKA== X-Received: by 2002:a05:6000:2f82:b0:42b:2fc8:186 with SMTP id ffacd0b85a97d-42b4bdb7e9dmr2826173f8f.46.1762954968588; Wed, 12 Nov 2025 05:42:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Edgar E. Iglesias" , Alistair Francis , Palmer Dabbelt , qemu-arm@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v3 09/10] hw/char: Simplify when qemu_chr_fe_write() could not write Date: Wed, 12 Nov 2025 14:41:42 +0100 Message-ID: <20251112134143.27194-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955607799158500 If no chars were written, avoid to access the FIFO. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/char/cadence_uart.c | 2 +- hw/char/ibex_uart.c | 2 +- hw/char/sifive_uart.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index 0dfa356b6d0..8908ebbe34a 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -316,7 +316,7 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIO= Condition cond, =20 ret =3D qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_count); =20 - if (ret >=3D 0) { + if (ret > 0) { s->tx_count -=3D ret; memmove(s->tx_fifo, s->tx_fifo + ret, s->tx_count); } diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c index d6f0d18c777..b7843c7a741 100644 --- a/hw/char/ibex_uart.c +++ b/hw/char/ibex_uart.c @@ -161,7 +161,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCon= dition cond, =20 ret =3D qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_level); =20 - if (ret >=3D 0) { + if (ret > 0) { s->tx_level -=3D ret; memmove(s->tx_fifo, s->tx_fifo + ret, s->tx_level); } diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c index e7357d585a1..e5b381425a9 100644 --- a/hw/char/sifive_uart.c +++ b/hw/char/sifive_uart.c @@ -83,7 +83,7 @@ static gboolean sifive_uart_xmit(void *do_not_use, GIOCon= dition cond, fifo8_num_used(&s->tx_fifo), &numptr); ret =3D qemu_chr_fe_write(&s->chr, characters, numptr); =20 - if (ret >=3D 0) { + if (ret > 0) { /* We wrote the data, actually pop the fifo */ fifo8_pop_bufptr(&s->tx_fifo, ret, NULL); } --=20 2.51.0 From nobody Fri Nov 14 18:17:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1762955473; cv=none; d=zohomail.com; s=zohoarc; b=nZcavvKOutVziw1ZmmoO5JABTvwg/eYpIry9Ev0BX5OTAJhF6nYk4xkZx6tXM+QsHTTYd5iHLuE9FpPSlQ1E8Nv/rrW1qoN3B8iiFhBOXTq9HSp+RcfEqgF4ST85EwMp0p+hHD0sGGERtTmDz7Lqd867+LTvuO/xNFWflHW3I/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762955473; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OJZy/Fy5K9acciKNQyPK4u1aveLBTjzoIj3j8wI0EAM=; b=nUevM6c+85BWSzdwwgq+xs6fnnhbnNtLf8mvVKU5IH9wnqUFdBOdCBCpIWNJwV307FiQQerSV98Cb1Wr863uWQUrD+iYJOB/KpEKlwbCROrpsZ1GHJAc8QQjNn+a7104/IlcFTDh3zI1BieOaUCE0Gnp1ykYfRScOkZSa8++4J4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762955473416960.3072922503931; Wed, 12 Nov 2025 05:51:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vJBEI-0007Hw-47; Wed, 12 Nov 2025 08:49:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vJB7i-0004LC-Vi for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:43:00 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vJB7h-0001Qf-CE for qemu-devel@nongnu.org; Wed, 12 Nov 2025 08:42:58 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4777a9aeedaso7707715e9.3 for ; Wed, 12 Nov 2025 05:42:56 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47788a59190sm14282065e9.3.2025.11.12.05.42.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Nov 2025 05:42:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762954976; x=1763559776; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OJZy/Fy5K9acciKNQyPK4u1aveLBTjzoIj3j8wI0EAM=; b=vXC73oQXX7AgRpit8PkFJJFOZX+BqOEWhpiA3cldOMQ+NGWwUtGitm1M49TBSHoXQx qD000oYdDOtYBoiKIurkpn75S9rY1bbA38XMgGsSdPhyFP9QPbx4rFgUlwEc9lx2pJ96 bj0BoYGLNhx6/4IRrRMTd1i8kylqh6uows1uoWQt0LxvbShRs4R9mC/YpTsOunVzBkJ6 SiZMFV6pp/8xtQA8LDM8AdxzizrVAflRLD1sCaeNPvqHGuGsK2Hk6JeTd2xp5XgPFjuF R5J0+JPTbtuE+Xe0S0ag44S0XxKXlJriC7i2A2SdvD0u2pMDRW0+iLgikSj5szlTtOSB ZZ4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762954976; x=1763559776; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OJZy/Fy5K9acciKNQyPK4u1aveLBTjzoIj3j8wI0EAM=; b=mogWRsLjhB5gRr+NG7OXVnKmdZSk4UdlPxl2hV2kW0x/z6qtCUcgOVpka3tkZIzZS4 Wo5KILv12f3yxn3aW0iPIIEVwgvfznFk38qHR/ZcvMha6GJ3HHQiZ8DC5elIRZSCs0zk R5XfysNbyzHDn3z9W+0eeyXFtL3g8GB+JK/H+bzeBXYRIcnJxz5lUMAFVmpXrckRFscg JhHHkDK5msHY4lZnGNoGyXWNc6+K5+2v8bwHji2iohEuTwxU5+K797LUXI3UCe0s+imw p+Z7DMu5N33rK89pc2ZwSEVghS8B5TTjowjyKPwyI197u9NlaKjO+RSgW73w1+vVvdnN ZB5g== X-Gm-Message-State: AOJu0YxYWpyt4aktq4jRjElvSaTMb4dMbqJYOHfxas0LQulIrdk718kp +I/dxEjlZ8DJKZRybKFQKMtblrTTWWXr+HD4mLoE0RLA4TVVs/8KjDVOTzk4bvZsH5AeLUyxvwE usyA3yv2Ofg== X-Gm-Gg: ASbGncvVXXp7fC30kqUYU3TIAbWNK3fxsR5Q0uYxEAaPc5kAOD+lXcLoJXWhtr8ndce 8rJq9va5lbWcthznh7FdUO3fb62PPNaJB/46aYPjuZBg2Cw3hR1tAOI6Z4/5oMtGMusd8zmWbvy 5reTCypIAfgQtkExNJ2Iui+tLiEBc7MnmLmC1zaQFsLyXgCiv3UhJBHM5MHgbp1cp/lu28tL+z0 /WdTlhISQuq81TKwxHcH2Hm6qJ1Yej46mhOz4NDRo5RyL7/ZlWbecZ+/ThKg9zsDkDK0LO+vUt+ 2vJ51yykeMr8J7u+S9UC7ywkLVYXCN0A0ZpMRqoGJHovj55vnZkeCJu0p16PcWIIIwuoCQq1fPt DkCiVxSO6e3gXZC5ZytS08AfdZqeE/9nmdkmLi+gSlnsKaZndqaiPaIsA5yOEP5dZuuOM0axg81 72YuQP7GsTQBAiZg2+wkyUfUsoZGYicKUlWmPOZCB3si+2+mvDwaoXqg4= X-Google-Smtp-Source: AGHT+IEeyCCm2DEr0whAopnPgp8P83v70oyTslSXpqcj70WqAfDUouBOEFLMk66oGBSnbRIanNetIA== X-Received: by 2002:a05:600c:45c4:b0:475:dd59:d8da with SMTP id 5b1f17b1804b1-477870c9a4bmr26406015e9.40.1762954975616; Wed, 12 Nov 2025 05:42:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 10/10] system/replay: Rename some method parameters Date: Wed, 12 Nov 2025 14:41:43 +0100 Message-ID: <20251112134143.27194-11-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251112134143.27194-1-philmd@linaro.org> References: <20251112134143.27194-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1762955474043158500 replay_char_read_all_save_error() saves %errno, so rename as @errcode, replay_char_write_event_save() saves the number of bytes written, so rename as @nbytes (same for replay_char_write_event_load). Use the forward declaration in both replay_register_char_driver() and replay_chr_be_write() declarations, matching their definitions. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/system/replay.h | 16 ++++++++-------- replay/replay-char.c | 14 +++++++------- stubs/replay-tools.c | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/system/replay.h b/include/system/replay.h index 68f91bdfbf2..56d2aebac7f 100644 --- a/include/system/replay.h +++ b/include/system/replay.h @@ -136,18 +136,18 @@ uint64_t blkreplay_next_id(void); =20 /* Character device */ =20 -/*! Registers char driver to save it's events */ -void replay_register_char_driver(struct Chardev *chr); -/*! Saves write to char device event to the log */ -void replay_chr_be_write(struct Chardev *s, const uint8_t *buf, int len); +/*! Registers @chr char driver to save it's events */ +void replay_register_char_driver(Chardev *chr); +/*! Saves write to char device @s event to the log */ +void replay_chr_be_write(Chardev *s, const uint8_t *buf, int len); /*! Writes char write return value to the replay log. */ -void replay_char_write_event_save(int res, int offset); +void replay_char_write_event_save(int nbytes, int offset); /*! Reads char write return value from the replay log. */ -void replay_char_write_event_load(int *res, int *offset); +void replay_char_write_event_load(int *nbytes, int *offset); /*! Reads information about read_all character event. */ int replay_char_read_all_load(uint8_t *buf); -/*! Writes character read_all error code into the replay log. */ -void replay_char_read_all_save_error(int res); +/*! Writes character read_all error code @errcode into the replay log. */ +void replay_char_read_all_save_error(int errcode); /*! Writes character read_all execution result into the replay log. */ void replay_char_read_all_save_buf(uint8_t *buf, int offset); =20 diff --git a/replay/replay-char.c b/replay/replay-char.c index 81dc416e988..023159b155f 100644 --- a/replay/replay-char.c +++ b/replay/replay-char.c @@ -93,23 +93,23 @@ void *replay_event_char_read_load(void) return event; } =20 -void replay_char_write_event_save(int res, int offset) +void replay_char_write_event_save(int nbytes, int offset) { g_assert(replay_mutex_locked()); =20 replay_save_instructions(); replay_put_event(EVENT_CHAR_WRITE); - replay_put_dword(res); + replay_put_dword(nbytes); replay_put_dword(offset); } =20 -void replay_char_write_event_load(int *res, int *offset) +void replay_char_write_event_load(int *nbytes, int *offset) { g_assert(replay_mutex_locked()); =20 replay_account_executed_instructions(); if (replay_next_event_is(EVENT_CHAR_WRITE)) { - *res =3D replay_get_dword(); + *nbytes =3D replay_get_dword(); *offset =3D replay_get_dword(); replay_finish_event(); } else { @@ -138,13 +138,13 @@ int replay_char_read_all_load(uint8_t *buf) } } =20 -void replay_char_read_all_save_error(int res) +void replay_char_read_all_save_error(int errcode) { g_assert(replay_mutex_locked()); - assert(res < 0); + assert(errcode < 0); replay_save_instructions(); replay_put_event(EVENT_CHAR_READ_ALL_ERROR); - replay_put_dword(res); + replay_put_dword(errcode); } =20 void replay_char_read_all_save_buf(uint8_t *buf, int offset) diff --git a/stubs/replay-tools.c b/stubs/replay-tools.c index c537485f401..df21475cec5 100644 --- a/stubs/replay-tools.c +++ b/stubs/replay-tools.c @@ -49,21 +49,21 @@ void replay_mutex_unlock(void) { } =20 -void replay_register_char_driver(struct Chardev *chr) +void replay_register_char_driver(Chardev *chr) { } =20 -void replay_chr_be_write(struct Chardev *s, const uint8_t *buf, int len) +void replay_chr_be_write(Chardev *s, const uint8_t *buf, int len) { abort(); } =20 -void replay_char_write_event_save(int res, int offset) +void replay_char_write_event_save(int nbytes, int offset) { abort(); } =20 -void replay_char_write_event_load(int *res, int *offset) +void replay_char_write_event_load(int *nbytes, int *offset) { abort(); } @@ -73,7 +73,7 @@ int replay_char_read_all_load(uint8_t *buf) abort(); } =20 -void replay_char_read_all_save_error(int res) +void replay_char_read_all_save_error(int errcode) { abort(); } --=20 2.51.0