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=1761145739; cv=none; d=zohomail.com; s=zohoarc; b=j/2z5siPRXPN0KX65Up9keT+9XnY/orAcQWOGYc0d0BJey/YdWkZe2j3KWQG7cZ8lDvfB9epAmrsZKJuM4SMUz7Z6SB30tTAVA6XCmv1OfhelfMenYu0ZwyvAdAGq1KjULGQ0hSdckS1eLJqyzLWY9up1EiDI39yFBns4tr6Uvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145739; 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=BZKU6hQIClGvtrfJAuNwgzsS5Iba6xqxjP2d0zQb+XM=; b=L5wXTVnsEizTR8D87TvXP03STzJiGS0TzvPMC2cwA07Eidf//zixsUtGZNToAhNGE2PgJuQ3YZvo1gsY6ChwJcV082toCnq5dxB5Hp8z2+FBmzr5BM2m5ZW4NQ5N9ziy4VaiIv+Q7ZOaEakLGpSFF4Apk7Z7Sz2QJZIPLKbP3XE= 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 1761145739725802.6625652275764; Wed, 22 Oct 2025 08:08:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaRW-00008t-I6; Wed, 22 Oct 2025 11:08:02 -0400 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 1vBaRV-00008W-BE for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:01 -0400 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 1vBaRT-00019a-BS for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:01 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4711b95226dso59251245e9.0 for ; Wed, 22 Oct 2025 08:07:58 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427f009a96asm26012893f8f.31.2025.10.22.08.07.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145677; x=1761750477; 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=BZKU6hQIClGvtrfJAuNwgzsS5Iba6xqxjP2d0zQb+XM=; b=jPhndJ/vpp//npU6nBWY6M9Gonw5kMgnabKQAG+k19r64PDtvFndi5pPJtJcxsRD+b N7Vx+V74KnyTkJr8LiQuf0N9e97Yl1ZC/mXdWeyT3N4nEbDSApuJaqzov/9km06UjQBp ffIB4XwyKPRRFaVWU6pk/8SRzXmFXCgfX4rKWSBcZ5OhiO4NIcPpDX13v1SC+qjom374 qNjuiK/xCE51tfiO1Onkm2gMtIoy6/rbKDqoTNFgSmSQ5q2lHQNVsjHMCMX4NGa1A3AH yxBc9UaSW9C7dwPPkm8UWtg2Vt2j3szkeFUcAr11uWRfH5FafUhDndof3c89FHJsIclg Txeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145677; x=1761750477; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BZKU6hQIClGvtrfJAuNwgzsS5Iba6xqxjP2d0zQb+XM=; b=SX7Av4WiKMB2qnyvbH6wJmd3KtGxaGCOc3a16N5oSEF4Xn6gsISMko5dqFgD+MQ28e TjZa9Yf1fqbdbSfEAbbB04fFofmNMrDsF7KfVlRaAAKFOJ/ObRnFnERWLe1krRFYU5pI 9+B+7ZDbE5F8OWEcRXDRcBsaoUE4T3EJ5yGCzkVtSB2pqVeIqcoa4rXoqcK0HYeq9gPA gUrJxfoN2TK+W2Qzkq3fWZM29+urafAjS8Wbw20XzVrkrZNqyOsOHU0GLNULojdTlC1k LhApSyFLfrI5uQPLM3Zk2Gs0qa7/DhqafChUFT5gWTP1mC3ObbpxAxpHPduZUJ7r77N/ EIbA== X-Gm-Message-State: AOJu0Yxz7jwipO49PsTDz+bDVyZP1YebB3Hx7M/evh6Qfn6FxKr4R50F lEwyYU94yQ0g85I4tTYPl05akRqCMY2Yl6PJQRrgfb16VzRFtEBPfETweAZ6orfgGMGUGdiaD7m jP/FfuIA= X-Gm-Gg: ASbGncvYZ+HFTZuEmcaQnjF/r5FVZfCBRm3cKLCObT2am8w/nCcZbv785sLVK2NtD52 j00elmdsfex7jd3a96wa1UdH8qnD4J3eGhzuytTQRtY0z1VLqIxKw69cVMMwIlQp9wkSphMxZ/i ewamBBDSVmDpbcL1N/7vG5iv+UFKzFfo+mZr14a9GtFkK6FpgSCo/e/kqsSDt0U7tF+yAfU/znI LbW4Ua8v69dZVH0/NrAU0p7vJmVM3OcjojnJPldSH3LlHHBq+OXXThSMaq0alKAgH/jgzRVes8v 3WZL7vvdNjIC83F1U4QMq/rKfh6YH0r6gHT3Z9NI9jCIBHx7E6Xqz6iI1FZ3+C/DKeGapUH3P2J 9d/BooY93hdMwGzsGty4dxM0+vfz2ndNEjkljwPIQL0MzzFiQOA64RwoJC/S4U3NUIaKCBHrHOH mgpSWVUjnIMz3aNe+75vzGwSOm6Q147wzfF52WLzfFAYNlxrWy9g9bhnwEyqr9 X-Google-Smtp-Source: AGHT+IFHZjDIJVPW+NYgPV4I8tz4+wgdxvpS6R1G/GZ+Ri+IqcQQCWbE3FrOhDJ2dnLeAYmQCzfdpw== X-Received: by 2002:a05:600c:1396:b0:46c:adf8:c845 with SMTP id 5b1f17b1804b1-471178aba5bmr141017705e9.16.1761145677128; Wed, 22 Oct 2025 08:07:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/9] chardev/char-fe: Improve @docstrings Date: Wed, 22 Oct 2025 17:07:35 +0200 Message-ID: <20251022150743.78183-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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: 1761145744948158500 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 7901856f951..c183432825b 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=1761145738; cv=none; d=zohomail.com; s=zohoarc; b=L1EK7lFFUKl0aJGu0HwIP8/ASK8EXqBFHAYcpzt4I9BeoUPEklcA+murz3h0Fa7hKlbkeftOqV/ljUNh8wbJTiLG2fDQVNCpoJ2iuYH9i7yqQMjH+tyF0sZUx7+fsIaCrAq0827vEsFhMCySMkXDgN1mUCM9B2sCxAUKHwzNw3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145738; 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=b1bprD0sWW5+ysV7IuIdf6MtG7ztBPn1NAHgeBdloHI=; b=Cw1DIiUegYNIYeNS1zOE4gSe59hO14WRk7ZOzj7H2dfuI2an74mRMRNhFKGRsZJs3+opv+J99V4ExHQ10My/5qy7fVRT/sKXKKhrW2t5zALtWEatR3TWCuFjZh8JlcJ4Uhl0JzZNsrEZ3JRfaVN0LnJNkfsOtpGFLxcabnoZMik= 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 1761145738747744.6010760441692; Wed, 22 Oct 2025 08:08:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaRh-00009v-ME; Wed, 22 Oct 2025 11:08:13 -0400 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 1vBaRg-00009c-Om for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:12 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaRf-0001AI-81 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:12 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-46fcf9f63b6so39464545e9.2 for ; Wed, 22 Oct 2025 08:08:10 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475c428a534sm56847435e9.6.2025.10.22.08.08.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145689; x=1761750489; 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=b1bprD0sWW5+ysV7IuIdf6MtG7ztBPn1NAHgeBdloHI=; b=gLsMvEk7ufqpSAUjJWaWskEYEPu2Ir0h5SREivAhqidC4PSmLcj/McT1YG1GOv/Kku rTv8AcZ2+ODTpnFlxFFHRL1jDr45R/vMmYQwXjNVhgK4x3FldI7CnBFXVMrH81Y38+eH aSDExWQgcJttFmg3sUhBaWKMITqnqF0AFrkHqXXXEFA+JNPmGTCbbvaz9jrq0yIUK063 E8weAToTOMT9tAkD8QSNuwikCiHhEj6lw1F31szq5/1OO2iittlYG3oZ13QX/JCOT4Rz ysjHMlpCPp/L6oG6QRdckG48MQib9tq46MJboHj7zjcFns0EGQIUyi1h4OVqWwJbiB4Q hBJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145689; x=1761750489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b1bprD0sWW5+ysV7IuIdf6MtG7ztBPn1NAHgeBdloHI=; b=i+ZrE3+wpzVyOdsS/yXWh4gciQ8xxZ0wn64BWOKmvKjeGmpIfdr981NedFTAlYsoRI 0T62MwB8OLzo5rb6CpjupAJvTr4YnwK+DkLgFQFJBmsutrT9OoYzAqf+I4IY/9NyAigE fBm4l4fEexkyOIVbwkoCAOT0O1b9KDtfQljJXuaJWD2AidZb8+4z4ADOIxv/PWycG64I fXF/kKL92UyY7pYHXQntiKUSj8EX3pxxse0/38iEaBK0I/dkQBH1oxxaqtMpFB/p/+PB hsxd3BdkgmjK6GsXM/axT+65ZbVz1WbbI16FdowfnRh1QfFpPRaldI3YNGpF3BvCS1Gm kfOg== X-Gm-Message-State: AOJu0YydoY/tTgxjYghptcph5AXp1zocIoZG2Aiv8r9dGbzWO+7wuMxl Ij6lHGfVVzaWXxrKFXifkVR58uXG6SfIr6oD4/0qSUvlgvwILz8tbfDx22Wg7g5jn+VRd2e28sq saP65fbE= X-Gm-Gg: ASbGncsCPjpfLafCz1nerSt/7dNFnXDpUoFXwk3m1GcITMUbU2c7hw0apXUPtOWAA2j AZfBTlkbOew5quswza0zXcDYScuOgYIpxUHMZP32rS6iQlsH89Uqniz9JeiLDeI+AxOlKeOqVF0 gWbbWWv53eF59hdSgkem53qNpxqhWSbsysk9GtkVXRqveTwB5aH6fFmWWrYvc75L60nkBbX6jSA oDmPRarR/xqWHHm5pBd/MHAqtIfkhB5uvBwZNkGxLMt9IPM7lmtcESdXkBNYThipMkdWmvRE5Vy G9heN3ZlO/GS9p5H8ASso9NrXUSCPI4pOQa9Kpq51rOmaNyDh2gByVmcovCjxAZL4dlH5ikaiaA 9ungMR0/gRI4TFmzSjmaznyjZU5PzsVU6lD6h4T2LtA1IW5UWBtJwwXxYlqv6+WOlsNe3JXyGcJ FjYwuFAjRkWffds80K97ePrUwVYG270/UXX+0DEg6nLv7bUqYIZQ== X-Google-Smtp-Source: AGHT+IESZiOrzZ3N9YCgVJP41Qo9+EAKNvf4lDm/KAjV+Epz9oAMC0SLLl9Kzl0geUDpIYqtqBiJIQ== X-Received: by 2002:a05:600c:4e93:b0:46e:4329:a4d1 with SMTP id 5b1f17b1804b1-4711786d685mr152846985e9.4.1761145689094; Wed, 22 Oct 2025 08:08:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/9] chardev/char-io: Add @docstrings for io_channel_send[_full]() Date: Wed, 22 Oct 2025 17:07:36 +0200 Message-ID: <20251022150743.78183-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1761145739832154100 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/chardev/char-io.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/chardev/char-io.h b/include/chardev/char-io.h index ac379ea70e3..f14d1d7ef00 100644 --- a/include/chardev/char-io.h +++ b/include/chardev/char-io.h @@ -38,8 +38,26 @@ 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. + */ 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. + */ 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=1761145738; cv=none; d=zohomail.com; s=zohoarc; b=YH4vp+0XQr8rFS2FO8uZ2gzCw6jCP5FvDr7LJ6jleArD0a+fONHVhRCOvgNKZ7yumu6bwiT/XBHrHuCmpLGxkQ/7URmNMaxheg63Zgv+9YSy3H9aShlMq7PKDxKs36L/lYEJs4x1wsYaja9nwo/ea6wVV86D9BYv0hAfe1uMapk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145738; 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=iJZa9EWzfH63QR1kP5dXrAuFB9IIUaUXKXo7sPTXUC4=; b=VXACyDgQvCQMxuA2aZ8X5GqqgTKQlMpQhM1Mo7QsKSjfG7tx9tzO60gI/Fmg5wSDevWhB5mpEkWhqEdahG61/3FP6qoSBzsG3dNjHtuh/dqxe/W3isoG8biCmG1zz0EJFUJbk3Ln7H+Nvpv4ajcykvcfGEw4A7ERLeJqYTfDnks= 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 1761145738301459.26279724995925; Wed, 22 Oct 2025 08:08:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaRt-0000De-G7; Wed, 22 Oct 2025 11:08:25 -0400 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 1vBaRs-0000CR-Hv for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:24 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaRq-0001Ah-RY for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:24 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-4285169c005so907341f8f.0 for ; Wed, 22 Oct 2025 08:08:22 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427f00ce08asm25482189f8f.44.2025.10.22.08.08.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145701; x=1761750501; 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=iJZa9EWzfH63QR1kP5dXrAuFB9IIUaUXKXo7sPTXUC4=; b=NWnLXiqSmwIgoaMVDmsvX2cUIXA8VuieT3aFU3bzrOytXHGSDzQqp15N7gXZ18WckB xnwueyH6Zi96/PFvflIwQ9Tg7V1SqvPYNMDJFP5YOmr+ZfX9z5A9h3fQniViwobznxSD oCNEzAM0zXLVK8c4XuJ7sSKqqSjyf3Wc/tVpwz1YbayJUW4udNZ/Ik/AVr7EzdnLVb86 ujVxg49r7aCGrKPe+QkfuHfmDUyCp0h2Ig09QiamJ5JHQmT7T/tfyIbm7eEhXN8xqOGv LhiDiYdG2zcym769WpskPDCTYJz2CNo0mKxkHFqXeZgIttuceZ0ftK61RD6d04Glqa0z 4u/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145701; x=1761750501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iJZa9EWzfH63QR1kP5dXrAuFB9IIUaUXKXo7sPTXUC4=; b=Miz9ZmuftRsroDrbFgjehZyaHjhBVACvsm6+BxX5c4Js+5FXGvxfTFZOp//iEEvIrK TUgZTxbsRistDH/NDi4AaM/Bbf0IR9ti1emQ2KBq+PabztBwk1fU0gPYBmfz0V+WeQ/l 21JUZ5WhbueU8SuUfUwS/rmJVhSRSqGkwFtVvBLQh/cExxk6pTttHssOElIBUpXZmRoh 7gISX/oaaiAaM3YyL+0fjvdineiTciyo09Vl6cs5LcuGvO1XMwIksMCHyUkQLlbniZwK w0hQMzE07QnUHDNYwSeusFAQ6vizlEfcvYSi7EhqT0dZOnR4+0cXn9O67jxbK3OJWv0q 5/Yw== X-Gm-Message-State: AOJu0YyOrScVW8xh1DrS1zhmH2PiyZfQrOCKG0KcAd/CXIUhUF7XSZIC yv2g7KKsGioLl0GSxwS6n46KM9RgupbSX4dwXCqw8WNBJHXu3aICY0b+aM8wuriuqIHtgbwului fbLSRUD0= X-Gm-Gg: ASbGncvVgmmXYTr69otbxU2gfSHlUBEXkK4asezknDV4DoC2HWgXu6Qmy5gz3VCFflN 3qYHQKGQvplArQYZiCs5pZSphdD6I9Me32i69ziFOXO+5aUkVFcbobbM4zHh0rvStC/glrKggM2 ywvdrJ28pTb7vVDfIUsWoy2MHmxPUV1h2IGS3szz+sOhQN0M9iV9peTRK7JcfkPDJfKl5CfA5SM LCKbxBnbtyLCvgNgAXPAIVSZ1tKuK6NrLYb9W52q/A+A3zzCncJvejKHu5P94yA5LiJjMh1M67g L/p5UwTk8ZXqeGlcC6hU6oyHSI05QpSGy3y4o1vcd8pBZ+VxjlnyUIbvV+oTkxq+niZR+fTdVm0 Iya+w8cyJi9HKe1dqQqpW7SC6rU+xj9m4YeLIFej6kQ4A23+IIGD4bmVStL3hl6j2noi1NAK0lE ucDEtyHApOF5vWB+a8mYA4Bdnfl8d2ghwUBFHJWKqgrT9tyJRWCOcwxU4SDt4x X-Google-Smtp-Source: AGHT+IHwFfkGqlAHitJKvyU4seZ3kaGaAKyYYFl6d2Nf1+tOxWYT9DEmuqnQSurAtYAySbE9TloWzA== X-Received: by 2002:a5d:5f82:0:b0:425:8133:8a89 with SMTP id ffacd0b85a97d-42704d75729mr15308210f8f.22.1761145700879; Wed, 22 Oct 2025 08:08:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/9] chardev/char: Improve ChardevClass::chr_write() docstring Date: Wed, 22 Oct 2025 17:07:37 +0200 Message-ID: <20251022150743.78183-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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: 1761145739843154100 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/chardev/char.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/chardev/char.h b/include/chardev/char.h index b65e9981c14..d809bb316e9 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -263,7 +263,16 @@ 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. + */ 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=1761145773; cv=none; d=zohomail.com; s=zohoarc; b=VL+OSUHUHBmJMPmx8ycssGPG/Hb2cD4NAxMtdnffSGgz3fGbuDgL9vvdEu7UtF2u+EHnxjSWTwgLgj/wjYYfhfZbAuOVSqFtdUoyWoxXhfIXMxaADhYSyiryolWlnDwjgqUfwRwIxG9sReb5pFtBUVcUFNkvJv/E++/jNANFgSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145773; 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=8QDJMFH+dcM6qM074DoLCqmO47D4LxU/fxPKd9vCjyg=; b=jINy2KfzQEttByOU19vcBZZwIw/ihrpzskVKXYDHP50xVIxad3NYhS61MPFlECHRrKk5+pxiq9NFcGRsZmIGkTvLXDUwUe12oBmnUTIWpRMIu+3PgLnI6JzotOLVP/eKFc9dR1+wK7GYMtF69CGDb6qNgsL93HJljCFwxeDu3YE= 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 176114577346165.86062692079895; Wed, 22 Oct 2025 08:09:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaS7-0000IM-99; Wed, 22 Oct 2025 11:08:39 -0400 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 1vBaS5-0000Hm-2S for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:37 -0400 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 1vBaS3-0001BC-Gs for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:36 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4710683a644so10003635e9.0 for ; Wed, 22 Oct 2025 08:08:34 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475c427ed3fsm57895415e9.1.2025.10.22.08.08.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145713; x=1761750513; 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=8QDJMFH+dcM6qM074DoLCqmO47D4LxU/fxPKd9vCjyg=; b=F83i0niClYYxAtjOv755BaOusBak+qk6Be7fz+Pb6VRJGnKNCow1JmUboPxJce6rK6 Vxz9seY9RBGn8l7MT8tryhXUpR87ZD70nwwbura+9Q/oDSG4pzkEffId4Ne9OCwn1an2 Cl/ODep6HdMSAYHNLQH6a4lEg5l0P+e53v31L+8qm4e8+esR4BfQB0RK+S+8zMzzCp9Z AAyvR0j8RXjhtpBmMCZ11r5PxvNG41qbSSc5RWArwUzJ/IAXTxn1nFBlbe/BdcKdS/fF zrwByl6mFMyHTy2lS8KCZSO6jyELlOwaNnVeAf+krOsIQHo+oBFZpWWW7g9p4JKcTtDe 0CGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145713; x=1761750513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8QDJMFH+dcM6qM074DoLCqmO47D4LxU/fxPKd9vCjyg=; b=m30Cng/a/pZyAYvHo3YJ08ongm75EXvw9w4YYWgK+YM68sb+19jWNAMT3EXMxu099U 9DECBs1ZbUKNBqcVDB9xpX4Q4o+DbTIgU8rxPeT8rXqt33ybUGYUc3DXZLbHmpxUjGL9 jXVS4KcFoSlPwhfS+uI+7fhfIJBiHCSi/wN8xsU3OQfHaVmV6P6+yyYvfP6ZkwTGWI+2 zVidUHNPyizO1ATBOlFeV7+gXPmsmv2p2a7cfEnSCAT+QCf7RkWScpEocxvzUybWfIOk uZ18BcC/9jBHdUuWb2+FddrJf+t+PxjqOL/o7wbePZTNVzSgtFlwgF3tjDYOW/zNC1BP TlXg== X-Gm-Message-State: AOJu0YxMIVXl0ifhDitIPxKRGgnyMwpWUP7rwKqscsC/1k3nHbKhjl+n 3ix/QM7w4Av/bz7+7K4OPs6UXiLZtT22ctjf9NK41UhIWc0CCaTZlQpj70fJbISkJvdih22LBTZ tIqIoKK4= X-Gm-Gg: ASbGncvCGtwlrKYl5G27+SEpF9A0kP4RBdLnxQ8b+0/UVCDqgJybAbh/y/KlhpYdxMJ /dotoqgPILx28IHlg+qO1z5G5p4qUuno041sQug4K1jmRc0ZSLnoK/MZILYUQd6RKLKQzpThzim 3pzh8+Gt+DiGWiLjDAj7gunS9gNoZSWZH5TbqCcexpWqBRPhbTH4VcFa+cSCKA2jilo8GQe8jrX 9p8dmSmUk1arCYKXkC6i1dYho7kFculfHpWElC7cuhgCI9XgScO5sMvRi4cifdtyy2kYgyegI75 ++cYs+e6w9cunQduaZn6ZuS8oS2wDHDfHvY/TD7W7PgiJOpbRGdJyE9AzMYj3b5Ms5ubsKiTRnT y7TjQETB4z67AwMFh+M4WZL/3iQgCgj/lh1F0eV/E3a5BGxHsNnvAkpGV/uk0Q2/43TSEwPUjYJ Y9nC7P7+0OXN46c5/hygMHseQtvSSNFhSsIekGTl8jE8dKSmy9JBVr4kTQm+iC X-Google-Smtp-Source: AGHT+IEjvrOXrhPSM2M+ZyQBMv1S7SxinGaNet6YuV9WPBOkUs26/pChvIGc9B4IA10NohCvPq354g== X-Received: by 2002:a05:600c:63d7:b0:46e:74bb:6bd with SMTP id 5b1f17b1804b1-475c6f18706mr12789235e9.4.1761145712734; Wed, 22 Oct 2025 08:08:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 4/9] chardev/char: Document qemu_chr_write[_all]() Date: Wed, 22 Oct 2025 17:07:38 +0200 Message-ID: <20251022150743.78183-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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: 1761145774806158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/chardev/char.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/chardev/char.h b/include/chardev/char.h index d809bb316e9..8b1d5153dfd 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -223,7 +223,31 @@ 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. + */ 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. + */ #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 --=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=1761145773; cv=none; d=zohomail.com; s=zohoarc; b=OADniz1VNJcwC/J10liyt/tE16oGtkK+jVzJqbUK8+cU3EfEkb5AwqZK+Li0XINJkfO9CTPB3wt7++Rceo0aqrNpnTK0LkEH46yPdYcMOkvhn7B996H9xRgOCwhPo34Ias1NE/QEyJYQPrbnbqHB9/A24/kbzI1VS3VbOyv3J6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145773; 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=PpX/2+MBiez8U9HpiPaqbx+2JJKLT0Lt776CCM/DT2I=; b=POjkfH8b81Eenx7pe2DZBW050B0eRTqHZiB+jQUP0mGIhwUOLFH6lHwpfgh8DmpbBoCpIVVrL1n5JgK3t3EFSCHxaAZXLxrRZQoKygOgZ7IfQY5I0jucUq/LBDTUGPjmKRwPrc+m4aY2y7gXdm0VIAYR94PFvDhK75qA8bxXOhs= 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 1761145773576665.9490388551527; Wed, 22 Oct 2025 08:09:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaSL-0000fD-3w; Wed, 22 Oct 2025 11:08:53 -0400 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 1vBaSH-0000Vn-Gf for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:50 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaSE-0001Bj-Nd for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:08:49 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3f0ae439bc3so3755377f8f.1 for ; Wed, 22 Oct 2025 08:08:46 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427ea5b3ae9sm25319399f8f.13.2025.10.22.08.08.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145724; x=1761750524; 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=PpX/2+MBiez8U9HpiPaqbx+2JJKLT0Lt776CCM/DT2I=; b=DIeNOkXgzZFk5hc+WDYZY0cEuSlIh7lGTnkEtv9fX9rs7PqBd1jnMy1fo0X6nADd6g KqM2K+L97hva37c4qurt7UI5wivTMYiLAWv3PJ4M+Oer56s7NrXov1jNGjhMg6Rj0vy9 Q+NrpEOU4Mu95Hk/Hw94DGYea57udrVOXNb/USD99AmGVdHAA1PIkpl9K0YOz9suhQEj QojEk2IbZq1WEGYxv80glfMOcSK2WjcArmFjqNR0gcPql4+PI8ltJqIWuyNqDfEmzJyl IzrOylJiaOqlNIIEwfpj1qJtSib1rN1b2OpLyIJgfNHLdUocfsNuK6gY2jejR/rHDoIB NLaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145725; x=1761750525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PpX/2+MBiez8U9HpiPaqbx+2JJKLT0Lt776CCM/DT2I=; b=kaqaimEh5k1JAFG2dfP1EdHZ/CcCie9/lEM1G2R13AlbmUIvB9ZZtTViLyneDSBL0T 13ksT1Afxg1U6J2gmjqXfmLIpWGjnDftjvkvcwe3b0ULH4jfoOFJMccjsVszpxsQ/KyP HloKZ5i0TOtgTTI9ZTm6sOJwsMnwGfhvXQqoYMdEF1daO7M2alh7Jp0v2aQtfmjw+QGM rFqw449k+f5gb3ef4otVsh1wBMF+zHstORlEDd11RzcKVeE3XUfob16RnU9cebtY8isk DOc7Mb2dY0nOKx5BuaHt7bxnPF6mP+PrVef5XhlGVVDGpbGhrXu1VrLyX6ytxBYtizOS RntA== X-Gm-Message-State: AOJu0YzAAkRJ/WYaJm0vfhAF5cHD9tat8ZS0r+rsp3eMsGQta2jKeD4M vAVpio9myTl0VDCnExHzZVTsKclal61uQKDmHGCPAw4Ul2YRxmJ5I1jrlZ72u6Xawe/tJZLyUna NzGtqSNM= X-Gm-Gg: ASbGncsMoHIppFq8vHZyoFtXaZ6uqF0ZD8qtypgB55sXtezNmAG56FE6GqLJXxNPfZl Y+7EEQMUMg8AVj50cWlcF6QK18YRpcingJyl87DS4Rw5ziiAH1QR8ZwyzrXxQNv4r4zGBgve+2W mNRt7nNlArsJEYf2jD4FWm/MVVg+3eXOWoUt4/OdUCX9zjGTtfCUIsv3W8K71OvxqaPeyoivMlo AMwa8cd37PzNVNQ/BLEJZIc3gvJH8KM83kpM4Aag1sSt5NTar/Vg1pdVXo++CiWUUqZa+I3JMjy gWDAa54j+hB7lSxhM1oTGvqhxn2IoDuqMjmERE14MXaH0rWO0igLogyGnhMS1ejgD281Orcyf+N OqZ1a23OQlJIQ+ojuMFLdk1+6PRgu3SeN3OqY7mohaYonX3xtXdyVBxwd9q8/2MWyMxBKiPuHE/ ppIZZMdbDeueKSdK98ih2MId9rKccMT5bYgRbEddPr7g2tUlav4rb6iEGpvoVt X-Google-Smtp-Source: AGHT+IERgFqAfACqqNWlwvqCRXuzQNwXeYbCrLzMrra9u5d91nJQWz0Cv+yx0XAfp/zE7IFWxXHjiQ== X-Received: by 2002:a5d:5f56:0:b0:3ed:f690:a390 with SMTP id ffacd0b85a97d-42704defec8mr14135482f8f.40.1761145724545; Wed, 22 Oct 2025 08:08:44 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v2 5/9] chardev/char-pty: Do not ignore chr_write() failures Date: Wed, 22 Oct 2025 17:07:39 +0200 Message-ID: <20251022150743.78183-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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: 1761145774791158500 Cc: qemu-stable@nongnu.org Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- If ignoring this is deliberate, this must be described in a comment to avoid any confusion. --- 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=1761145803; cv=none; d=zohomail.com; s=zohoarc; b=DwjbiiZn9us7YE0/v+z9RBt8ZsEHpvv8oSMPabOLnll46Ymz97fwlF+RiE86zIDn+4Qd4OSNo1emh8iJBadG99JfFXBzoUHdI8LPUjdMLf4bgF7Thci+IPlnQl3ktH6SQ8OvulvH0DnY0uB+1KHTYrhRgIaqSiFJ5mjdcjmqsr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145803; 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=UsuwaPSDBJqW9x7+kDRZ6Zqv9gzfoIIzIakN2x8uDIw=; b=QvJ9p79Sz66M3w5fS2jRXCMZJhXqwhfF/mSstoWXeo2PzmBW/JZpw/azoFfha8OZjIFaaZMkSQDbBSxV7FWJLNBPCTPGO3R46DB4RHcKMB4zx8pWK+OHwNDLuaCrkS0BA9nd0ND/LHZZm1G6q5TXPluakOIOO1dSAd+09qmJ7m0= 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 1761145803939257.96608785756825; Wed, 22 Oct 2025 08:10:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaTF-00021j-08; Wed, 22 Oct 2025 11:09:49 -0400 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 1vBaSc-0001LM-KX for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:12 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaSU-0001CB-Be for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:08 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-427007b1fe5so4659641f8f.1 for ; Wed, 22 Oct 2025 08:09:00 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427ea5a1056sm25271264f8f.2.2025.10.22.08.08.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145736; x=1761750536; 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=UsuwaPSDBJqW9x7+kDRZ6Zqv9gzfoIIzIakN2x8uDIw=; b=uBs5JBRKOOcBTfIrYwaET2wZpRwkj9QI3QIuYasJJGvcemtPaeuBFQwl3qHG7m9dle XKC0sdDTxILi3DFec9qSoqQkPK61TDP+HaKQ1qyx7/7cB+lsQ7H4+CHGF7xBCFlzQzKB eC9PvN3/tjpJeyvTdjar4BihKGCqG16vCa00gOu9guliKyaZxtjtGaRI4YZTftMF6Bua WkYykHbQ4OJIyTTtGgnlegy8cBNdL+CKr7HwG/qRWehD9VhShQy94IjgYelpHiikum4/ 3UJet7vShfp/E1sJ4DNFLYhSb7fZ1EU15jMIjdyZt+fPMMXBFPyTOZe2fsdE5qiu5PUK Ydvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145736; x=1761750536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UsuwaPSDBJqW9x7+kDRZ6Zqv9gzfoIIzIakN2x8uDIw=; b=RucSS53AMTQvGnlBgY5Krj9YbCFY9w7GKY2INUWazrdggQSa3U1959XHwklRzO1AoY LRWfvmmlSYRxsCEGqdjKXKD2fVgdWXvSz+wokK8aOEa6bucmZTuLbl0n8A8T9SeaDHYJ HnY4kRKNjVY/Dz5nYY0/Cd4mhB4Ji+YZsOn6IYnTGMQKsv0cNOOiDXJSeZYwlPVaGj1Y MnJd6FweOUg8wJR9vtwWBx8xuv9G29uv/HqbiceQ50xQ/3ZlOd9E737mzLK2CIbfarKs NxMMk90I8TjrCAp1gwZ85DMhjqNFphzT+ZHjky0HxEUy08yYw9y+eiZshv2NLeZ3ZcDI jj2w== X-Gm-Message-State: AOJu0YyHGWMYS9p3nbbSMBgOix7fVErvqMPHDyeb+3aFhOPdNn3S2BFH x2OjzwK1Xftk5L0FIZlmnzWttt5WoiUspoQHCmdyf+4jHjHMOVGLwd9KJYyzFwQyOda6NPay7tn KzF9nRek= X-Gm-Gg: ASbGncs8exvLDLGM7lPINFCI3UYT4oOGUeb8bsEvQzviXLvqTy+0jLzm7QobrspTBPM v32dHed0Rv/5B+Mi4ti7mzX7Hy8owOLvxUkTH91CL2Fp5K/9Ohk7L8/sisuA3o5rU+gCl1Jn8hD mpFi4WSJFiZHIhTIC+a3Obpqun6+u08nnmFg58XKRmkUDiV+dePeoY9gaJ0wqyQb8EMtDMkXs9I LoSzgh8WLu2A7Tk9WZbbgCDzcpR1ThnF1kgfaRbGH9PGtS+cFKf3cdIqSHf0L7nA80CJ7bFSpQf depRy8AHRPyzGAlAuNByE1GfIRf4Bd6XC6Pp+tSU3ZngXoH9AlsVO4qKyvbJvby02OIzEKgDAXP BApZ87D50bSPx8ffBFMKoxA6RjG+Btsl6Pl5GsRdsqwKnLfEgwxZLI/pUURT+KKwBNY0OTiCUi3 5FvlFcHpnAWDBzhy2U2nnsLtCxaL1EA2+WwJENME2VjK7x+uOHaQ== X-Google-Smtp-Source: AGHT+IFZ9tEG32XVrcMhhtPZiHUpiLFemQcPesxatfU5D8gsn6bntLE6TaSR+aLrCSZK2BX440ZYtA== X-Received: by 2002:a05:6000:4013:b0:3d1:61f0:d26c with SMTP id ffacd0b85a97d-42704dce7bdmr14965356f8f.54.1761145736498; Wed, 22 Oct 2025 08:08:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v2 6/9] chardev/char: Allow partial writes in qemu_chr_write() Date: Wed, 22 Oct 2025 17:07:40 +0200 Message-ID: <20251022150743.78183-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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: 1761145806719154100 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char.c b/chardev/char.c index 30b21fedce4..5c8130b2435 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -189,7 +189,7 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int = len, bool write_all) replay_char_write_event_save(res, offset); } =20 - if (res < 0) { + if (res < 0 && offset =3D=3D 0) { return res; } return 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=1761145800; cv=none; d=zohomail.com; s=zohoarc; b=C1e32LSMqPkbIEoTZsLsNSFYEAj6mz+xMP6lk1A5KH6Wy2RiQe15FeyW5hLIztGlSxyr3xCbHOaCyaVOkzxRELNO/WhcJyV/YvPGit9pDu79pmlbIESZnvJDRhcyI2kwrrR/y6AgD8c7XwjKPs9KZp/g30flaTCRUL5YqqzbXi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145800; 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=uXhjggSho/stvESB1e5DNT3GroHIpKkaC36CQ6szXx4=; b=NE9M3VVQ6u0OK7Yx3CflnlGujMH8q3YmN5ueseZ4Al2VZQSqnm6PU9sToRq1w+ClNENJJoPzLhyE/ny09vfycQ1PrGD5UI9n6xxrkUjpjNVNgzjf0OThHSStWeY01b0q+/JAWto1LdSk5xgaasFQz4rnFGESTSVrfe0xXY655v8= 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 1761145800454163.60576619588971; Wed, 22 Oct 2025 08:10:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaTH-0002HT-IW; Wed, 22 Oct 2025 11:09:51 -0400 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 1vBaSg-0001NK-4x for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:15 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaSd-0001Cr-QK for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:13 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4710a1f9e4cso51705825e9.0 for ; Wed, 22 Oct 2025 08:09:10 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427ea5b3ae9sm25321242f8f.13.2025.10.22.08.09.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145749; x=1761750549; 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=uXhjggSho/stvESB1e5DNT3GroHIpKkaC36CQ6szXx4=; b=LMCyG7TTt9opyvKCmnC1S9b4A5K4LI622Ma57WXfKF3yxTQ93R8IZwnq6kajOa6N6s bxVWfDSVbVsMJviblCEMIFIxXbGNWpC98ZdhywtNNeilKMout/AIcmynui0mQ36HSVPS LGnjc2FC9rR12H1lKK6DOsPEvYSl2FpNmcnGXm+kwvayNtuppPqRlRjSju8UPx1FlxbL B6xLraJOmoGp8xLYQhb5Sm+QDjdHa6dyiP0YaP/VdD7Au+YEWi6rNoYg8eRPOJDHBiVA 208TTITDmdaWw08KSIQAvo+OkIG968PkMVe4spq/Wy0Zba6gZjEbTfTXOrEcO/L/kbYs yTfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145749; x=1761750549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uXhjggSho/stvESB1e5DNT3GroHIpKkaC36CQ6szXx4=; b=AGXCrwxloxIV5p8gkDk/hgDXuzhJe6p2CxTzoonDcUvAaNh+bgIT8e+Z2yCiYT2846 uXJ0PNhTgmDcPiYPBnB9mYj8+X3mizRuuZVJf4FmiVdPx0eViys4JXaPOTaBQ4xHQjW/ ccb/cweeHYg5qKMz+5WhT3TDAnDXOA1fw7hxZLnt77I4IgvK4VKchAUpv4eoWsjysqUs BQGwDZRqIPAXlWnFLEb4420ZNDVZ2NVhISHpvjV95vDEsz6OHKDeJHg8e9vXwQhEN/WE a2eHfh56p5yV8M2e9WLo5tZS+Yb1YtpKd0DUsXTE1WStW/bYHC5MmssNIuhvnxg1QC+6 okXw== X-Gm-Message-State: AOJu0Yy7XiFZ4JweHjqAdQhkBuoF0dh0kniTTqQAF32x67ghfwylw3+r lhspzyjTsqTUOa1SLL0CJ6yeQ/iCkkH1/0n9RL4/E8WIQ4fMUvdEiiPOpXr6PAk9J7Vx+ubacpK e8moo3uU= X-Gm-Gg: ASbGncvkbAOLFxASlga24a8GHZe6jfXDOnmSzrbnKlZnqYH7q1XmbJdYgkpBVDjxl4K 0LeXM2THODx2YeOY9o8eq58Hd6HSf31J7Ywa+MKDjoReeQ8ULiR1LlwotenY+gSvz5yPa4btdkX JNkoddJiX8k0HLlyaZNBKU85V30vFvq+Y1/0A3+WRmAAgmLYY59CTj/8nIfSDuFeE4v0YRsI3It GaSRwQCFgYTC9gfRiyWl2cLNvQcoKO5duG/kdGS/yO0Xu0paRyoyqESya4alN99vDZoaAnTvxkl GJ8yzHvFGgJ9ecQ01hdWvWiikVeE4IMxDZ0+wFnExLnSds7kx5R+BzYR4cNGVV1+exbQ24QY5we 7/zdpruljr00aOQaOsYNVP/LnT7k4v/Es0PgP568g1L/WBp6akGuJuTRSbsDqeo3xR9Sdq8E/Gb QB2ghzr0p/seXoM3GzqVuFWyYtIsHF4yZrv0vkKn88UfhOGwkKh9XBaxxL6lK5 X-Google-Smtp-Source: AGHT+IHRb7j9cc7iuYG+wxsx2kJeU6+zjX3+rl19PmtzvZIUntE7l4ECz+iLaW9F8aD+LcUgLdxEDw== X-Received: by 2002:a05:6000:420e:b0:3ec:db8b:cbf1 with SMTP id ffacd0b85a97d-42704d900a9mr14509133f8f.24.1761145748698; Wed, 22 Oct 2025 08:09:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH v2 7/9] chardev/char: Preserve %errno in qemu_chr_write() Date: Wed, 22 Oct 2025 17:07:41 +0200 Message-ID: <20251022150743.78183-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: 1761145802595154100 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Suggested-by: Peter Maydell --- chardev/char.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chardev/char.c b/chardev/char.c index 5c8130b2435..2af402d9855 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -113,6 +113,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 @@ -138,6 +139,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 @@ -154,6 +156,7 @@ static int qemu_chr_write_buffer(Chardev *s, */ qemu_chr_write_log(s, buf, len); } + errno =3D saved_errno; qemu_mutex_unlock(&s->chr_write_lock); =20 return res; @@ -186,7 +189,9 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int = len, bool write_all) res =3D qemu_chr_write_buffer(s, buf, len, &offset, 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 && offset =3D=3D 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=1761145799; cv=none; d=zohomail.com; s=zohoarc; b=COXoy1Uw6UjwO3bRsYwX5hdWJ1zhTvx8Otse4G87gR9twyO3jlYTsXWV7qmqWnejxbe9U7RRixk5s2geLRP6G6JXtx0f+Xx+eyFjYyBw7loYWhspB8S2IsznHpx4foIeco1Bx8fs6yygFkzWQJWYvN9hT5eYpdIPNmv2LkyFdtI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145799; 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=m3aV7y4YcVZL2/9uqMu4LmeCtyRFSnBcj1NtFojSaAQ=; b=n1xfkW9XGxrkmauSbKVJR7uRIY2QgF/3sryYWm5W6tyYCP3Q2kbTnCw8LdeIxmHFduDTv+kFf07w8MQUZFcEYLIDtIktv9iFjUwj3TXDnONAs9H7wgKrVii0Yi1CEBPXFLWVO2+yjH0BryJnPqf9qlwxPOh7MrW9bNo0sEaJe4w= 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 1761145799917687.5239544123493; Wed, 22 Oct 2025 08:09:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaTE-00020x-GH; Wed, 22 Oct 2025 11:09:48 -0400 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 1vBaSt-0001WV-1B for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:31 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaSq-0001Da-6T for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:26 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-471b80b994bso53501055e9.3 for ; Wed, 22 Oct 2025 08:09:22 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475c42b4867sm47602865e9.14.2025.10.22.08.09.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145760; x=1761750560; 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=m3aV7y4YcVZL2/9uqMu4LmeCtyRFSnBcj1NtFojSaAQ=; b=mVqIaHGa2aJPN/JZj+ExEpHECZyGq6pxS8EAUC8B9iIx41NwyRDsloA1oHZ6j6OkZZ BLJkneXXpXVs0gwzs8Yu8c7H3HWH9PWLacsiUNvhX0KBr/nMRkPmrr95ow2E59GStPyA 16xB5i4oWhpcJEbD1j9/p36+pwCXiLn6omQpVii1NtmtJ2yosui2W0hfarDWHB9KeUeV TvBjBkhURewzpXugI4DMgJlShJ+dP5/yZKq1YneL5ZTBlCMXaB6GK2ncfD1e2nM9BfXL JeZOhORSK2k0uBlEXLHx1+cGJzAQB77QWHhU+/iX9B/tqOz9jKN8mSW7llLmY/XyGQhH r/wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145760; x=1761750560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3aV7y4YcVZL2/9uqMu4LmeCtyRFSnBcj1NtFojSaAQ=; b=LpQIQcNHKRQ4m8mNWfrM1uAWvSoIYvNXcHnMrZFNNDvYoqUTk87jcCNdczX7uBpkyj tSoJeLe1yhS5pj4suEUwxI8m0qHdZqcZEK1JxzRiUoea/4ObQmvgEQc7y753zXyw6DFS o1QcGsEi03jNaZXo1xK7xCB5zbhUp/doTprg0tPWSDTyuLULwYiS/xtP8AA3ZLPRnp6i HXbJ+EFN7r7B3EcBzRXu/PGBIJIAN7UqSMQWQBeS8VClEDWfkNUKV7n5hZ7x93z9pzc3 4R0lpY//kLN/ULRcWiZ/PnB1m7mCNaqBVebwrsH4apSX7BvlbwLvLmy0ukq0psfezdzu Wd7w== X-Gm-Message-State: AOJu0YzW13nFdfh+i5Aa+9izrPs9jHp+DOQVQAAxDpc8se8jR7Oln52L ISSNpngxB3I56X/f0uWorGMeO0TjA/HgQZc75OfCVKkrsa7YzWcfc2/x+YUPA8fyeYhu/al2h10 erkgL7lQ= X-Gm-Gg: ASbGncvjXNIh0F3CCZ5Cir6EDfbsmJ41woDM62gMprVICAitX/9NqfTvkWiUoc5aD5b xHLRu6Q8+achR4oCn0dX/uvbm9hF/j33SOL6dXMLhiji3mIP0Qo7vV57dQ8S4dU6aw+lBWt6v8F e21ASgpXc//Rcu5NmURfezCSw/cul97P1lFW2fp16t5Cc6761vC3xfwsCOhvLhS22cI27ynAWFP sAuM8VRLKiHQ22yFIgXggyjoVJxgnvpLdBYTu/uKPApcYXDnhOHmY+SHJp/kTp2VbjQhe80b9Vb 4J8oFVG/+CJvsDORydaSVsrslZ7JNiQpzHWO4RuC09I5jRdRm3x3Eq2R4cUEQnh1Hk7k4y58I/9 hWqrL/dHW0DP1FTkYBaItyH6Zd9vtbvtpKCetvSc3sJFOJYeIdOJrtMKeMhHYX5r/m7tCSgNMU9 0sWjZdBPqVepa3KlpDnNiHdu4//WrYMYdW77MVhXxC9Ynj30qKa7CF9Hijiqgo X-Google-Smtp-Source: AGHT+IHZTkyn/42k1QpoASnxIpnRuVbmrMEH5T+8YqNQhZwt6TdoxkPNnzfrhVdI2LMH31XVop9rpw== X-Received: by 2002:a05:600c:1551:b0:46e:2801:84aa with SMTP id 5b1f17b1804b1-471177b143emr158569685e9.0.1761145760568; Wed, 22 Oct 2025 08:09:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 8/9] chardev/char-hub: Retry when qemu_chr_fe_write() can not write Date: Wed, 22 Oct 2025 17:07:42 +0200 Message-ID: <20251022150743.78183-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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: 1761145803047158500 When qemu_chr_fe_write() can not write to a backend and there is no error, it might return '0' to let the caller retry. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- chardev/char-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-hub.c b/chardev/char-hub.c index d0967c22336..4bbde9fb033 100644 --- a/chardev/char-hub.c +++ b/chardev/char-hub.c @@ -65,7 +65,7 @@ static int hub_chr_write(Chardev *chr, const uint8_t *buf= , int len) continue; } r =3D qemu_chr_fe_write(&d->backends[i].fe, buf, len); - if (r < 0) { + if (r <=3D 0) { if (errno =3D=3D EAGAIN) { /* Set index and expect to be called soon on watch wake up= */ d->be_eagain_ind =3D i; --=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=1761145799; cv=none; d=zohomail.com; s=zohoarc; b=c4Ixvuuut85aZAApX3Hd8w3zbsSDR8cKZh2F/C7YRiduIjoINYI5RvXX1GFL5CVnFXgv8MkAHpTmqaX9wxZLr7uvhP16vH4QWGak7r0b6SEdzz/YitaCbhw9D0IJYN9cAoWGm5f2Yqxgf24+pXGl313GyXKimwi2k1XkLzt9kxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761145799; 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=f3ngZPbaDwZJ3E3qgfPsLGR0H4y0FqCGiSlAmIJaKZo=; b=auOHVZshPtzGgjmS1tYx5x1ArEMjiKkUKAC0kepTaIfFQ5hbcfzJD3DDpb+lU/tTzI5EGauA1Qhv+L6YCVZkSDubG96LqP0m/VZ4UYKbX7eRUmSch58Hj/C1a7mTgyqS3HE09P5+fJxJ/PNjUELM/w4GeueuKTEyr/xr68f7CmY= 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 1761145799614189.51882789936496; Wed, 22 Oct 2025 08:09:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaTL-0002U6-03; Wed, 22 Oct 2025 11:09:55 -0400 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 1vBaT6-0001gN-3f for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:41 -0400 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 1vBaT2-0001EK-7L for qemu-devel@nongnu.org; Wed, 22 Oct 2025 11:09:38 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-47117e75258so36074545e9.2 for ; Wed, 22 Oct 2025 08:09:34 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427ea5b3c34sm25325512f8f.17.2025.10.22.08.09.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 08:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761145773; x=1761750573; 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=f3ngZPbaDwZJ3E3qgfPsLGR0H4y0FqCGiSlAmIJaKZo=; b=TSdmTSN23yD8jGXvzAbey+dWHWM8FxvrfmN1ImrH1NtZ8soN5Eqga/kO/A1xR6qHxh +8bH19ilt8w/tPjnk99wB3ttbpjTJt+CHAwf27OaRYRAznCJyDjA8Zlp4ikzb2C8A/bQ /jvTXHOcAp1tW24yoQDaFoxjxDTnSQ2vBdKe8GHQShx/a/7YlnGPrKFy9BFvHUUVEdtZ 2jYF+sq1TkXmFReziIo8se95iuJFVnNzR0gdzVdiBQk1JpkCNFdyUZxRmOFHM8mXIFKx 4aDAmb+Hlcqiq785T0zu08HByp6691GVVyvcZccPKhzzrdtFuQZsGaozX3ZlV+w+rEAn qanw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761145773; x=1761750573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f3ngZPbaDwZJ3E3qgfPsLGR0H4y0FqCGiSlAmIJaKZo=; b=beh3vC3KeTzxQfAIRjBeLjI1bV/LmMvU29nv8Ip70VGnkKsLSt4U0pWqAplJVxU9sk f753sZh2ytz6JRA4hMLCrSqPX5hE1ugnBufxJj6SlThr6ixFvglGHSONR/vHJD/rNifI qVtTJFi642cncyzVDVjxHpCup4DiwKG9HzfQHIFuCNVSTDES3mR1iTzDF8WcGIRSjguD B8GjeF7yPJ9lIoYqQYhEridV6ihQEvFnq1j7nlvxaonghYNYeLYf+L6Bcdj1E8JDY26P eyK2fYgMudkooTsD3BJnefdRRdZ/5KJFXgLALJlraoSm8wmQZmm48qskxH6LEQcxRKhH wZjw== X-Gm-Message-State: AOJu0Ywt5TIaVaTO4qb3jTNJZK19LVpU179PC4yi1V71GUX1KlQX8nsG 4koDzyga80YNrhtCKWl1bWsCD/1Py2xM6ph0XIoayWqDOcaXkrHlHnkmRtSiCLvvAwQbPjTLEgO kuwHmELQ= X-Gm-Gg: ASbGncsOYwCckpZeSLtYtO153v6rCp+2xEU9AN7SF9cGs3yf3/tftVdmZJJYR1WS8TW 0sSy3xCByV3qSRW+guWhqQ6DzO+w0wCe/bN8PhytCTwQVwBk2daWRveQ0QlJT9fAcYveBEbnwon +tUac6eXu1R0GteiGNFxkuyl1PEt1PX4rfioFYl/kxatrl6Z0HAPHjLLZs8oX0HszKanCxWSJo+ NotNwSk9Vi66NZXEGl/sTcvk+ZHlst1f/37ZH8jI4vrSjjNXVd+v1b8yJNgm1ScoqHQ+KL8e5f3 14TvyGW1poTniNHYLvFstsqpR8MrrdlTNQW7Bd50K3KGZ2feKpDYBB26Wzhk9HOFa8Lt3fUXncY yUICoArPY0g3P5GiLDnaTNYDn0sKvljmi3FWsdlOZvRhl5BwvZN47EZ3tXQKxfOScykHQjIwzkR 3nFzce0gnxiOMOWVJ0mmnJWXNYARuXXUno5lnveWHXfe8JvFgvOw== X-Google-Smtp-Source: AGHT+IEsl/9G9/Zuob4PcW4PSudJtYR4GBXWNfJrFgGghbd5T6mHaj216FQRdNkAzsYiEBWskD5SeA== X-Received: by 2002:a05:6000:1a8d:b0:428:3be9:b465 with SMTP id ffacd0b85a97d-4283be9b5bbmr11554632f8f.51.1761145772667; Wed, 22 Oct 2025 08:09:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , =?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 v2 9/9] hw/char: Simplify when qemu_chr_fe_write() could not write Date: Wed, 22 Oct 2025 17:07:43 +0200 Message-ID: <20251022150743.78183-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022150743.78183-1-philmd@linaro.org> References: <20251022150743.78183-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=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: 1761145801132158500 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