From nobody Fri Nov 14 18:16:49 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=1761144620; cv=none; d=zohomail.com; s=zohoarc; b=DbUsyZ2055ETtQYxyRplRFBzM5F6do+tIO+K5b0rxfNrkHs/dYV+oiTpTm4lYUzoU9l8+UxwJ+upBzOZHFXZtQBqTZqG4gBW/faIq442o+GwYyyvrNX3RCqDdesqgR4CYCMBzI5G0Nlar5aS00t9ItQdQNM11aSWR2HisIuB24k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144620; 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=P6HZ9k3R49RUGQ70RTeLPa0BhGvuBevLXYUZSrVV+SQ25WaVJijHi94D6B3w0zLk930sDP3fU+V+HcQXdnzb5PMvqZnO43CoAxesTMC3xUNYlpV9UmL0gEtbtTZEszI3odsTPL4P8zgCiM+6IOblG778HN7kD3OhjjpLJQFXDA4= 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 1761144620764956.6031698342058; Wed, 22 Oct 2025 07:50:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBa9Z-0002pL-G7; Wed, 22 Oct 2025 10:49:29 -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 1vBa9X-0002lc-1f for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:27 -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 1vBa9R-000752-M1 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:24 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-47495477241so19245415e9.3 for ; Wed, 22 Oct 2025 07:49:19 -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-427f00ce08asm25413646f8f.44.2025.10.22.07.49.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144557; x=1761749357; 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=lfTqIM2YsUXPYUX5XKKn2/THJRA0ncDFCys9zEgzMsLOR4rcYT/josCN/+mVDIFNN9 X8gc1lyq0hLEQ0kOEYuJ4OiMXHgbiskGpGwqHO38kjHWesiUj5D1j3DZr16fM04R35Q3 916V+MF7/REDg6ZBHwEBrsgl0c5c+7pX5iQV3FVN8Ww79WmWOTs4VuXIIAgvxiX3MbT0 LLN2ZBDKnZY6FUbrnUM+GwXgPwug2Bk0xN6E7TnDVC91Ra7RFeZw1amQT3zeKn2jEBkq RbF1ViNtCoL0lwJpcgS0+V46Gb8YQbMNYnW2ZOceEMjFeKh3fq7Tu7klLkPEaxca2heL X8Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144557; x=1761749357; 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=b2TaYyhfHbJnofsbIqPus/0Q2gJBO2GLEeDyF/BgvFfwDoWnqbXZJ9YJknMqzwYWzx FDEhFTU3pHYcFFm+O6J2ezRwLRaGW5TzCvl3jQccbvmKCwIUl2UKFJJlYhgbJ50awUtV sEc8179jtjebST/2BTkLcTwLR8aaD94uX3CtyG0iQB7Nl2VIqTr6ib0i2KD2hnqQ2h0S 5jSdRdvif0VyJJTjZbHXsRuOT9TPEGoxC/QR3xPpAtysS5HmBGJ9G5ZGVHTbk/40/2o2 5bE/Hhbar6EJdpPro9Pm7ChbC9Nvrxhg2bzT9n9+4i8b9y8g60N7BEz53MnvsGm4G8S+ 1WVw== X-Gm-Message-State: AOJu0YxO9LPtxTLdPStJ4LHFQNMKoGPbfH45m27ot+HNBZx8weOLAndP hmZp+9qjVPDM0a23yo5CLEdq0RzMEH8rtDBmUCzV1Zn97TikRYq8GlQvTz3a5KYTY8AxQIvrnc0 oxQtbcNQ= X-Gm-Gg: ASbGncs1fsIyPAzS8QvXMujiT3NfWIAKM+Txiy8RR05osNJdBF/5UX5MTO8kpeUuajb yKF9JjWmeNmcwp/88xr37qH4z5TkgqX83QYQrIB0HbezCKOEXuenzQXrHaRlhFOJjBZliHX4Bog BXj2Vb4VxIFxcyWfkkifl7HatTIjJK/pvtIIHlswyB8vDgiluMbbd0Hf2Mzu0DS+AwVCMx6C7SA 4tj/YqRIQVcNHTtSOBiT6Q+bIwslCWp+0YKmhaKrOUqyl2IcsalUsxVNcMCci9AMQM/HHltLZi/ 5cvn8NgO/qJ4j2OvIgT6Os/1/vAeojofkrIy0jcxTZ+TLYpx66CfSOIdsYrPyXCD+31HRXr41IX Xv8n9ZgnkHq/fdUxWlAo/QKlxAIcu7DzLsSD97zHSKFAIvkOWfZxeYekLmUUcB/8EyHZ2DxEOsQ VvQ7NjuDc9/ApkgEljO6lyTVK7oSuOv9J350QPmEil5swTgPjzkA== X-Google-Smtp-Source: AGHT+IH3uBIYKZa7z+Nz7+8Zuf+Bvl32phe0dV0tvqbyK5bNHbNyORPPoZamSRDiVMQqTf3HHoSnzA== X-Received: by 2002:a05:6000:430d:b0:427:8e5:39df with SMTP id ffacd0b85a97d-42708e53c54mr11138214f8f.21.1761144557150; Wed, 22 Oct 2025 07:49:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/7] chardev/char-fe: Improve @docstrings Date: Wed, 22 Oct 2025 16:48:56 +0200 Message-ID: <20251022144903.74612-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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: 1761144622560154100 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:16:49 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=1761144621; cv=none; d=zohomail.com; s=zohoarc; b=V56gip3zcVzWyLaoGRsWsnQ1luEQ2ynaLRjrXAblQWUfuINMSUQMzx8mGTqn6IFdDJveGrnqS3F0q4dsJzqXly8qinwPnFnze0mNO71EXZwEjJ9VP2AGOMVj9YiaynDF+jNEFnu+dTsAF3iNMGjEGViqMZrdMaGqmd+BOdsqG3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144621; 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=KH9kLi8wQeUfq3aAtOzXpTfYr8Gnj6eeWcGVUO8cvdnqZcp/C0iKWdRV83OVjaSex3vGGUHIcNbkl0TBxFF+vizUHUIgVXtSk3MuG+eUp9kf0HrL5JugqhCYDNxZ12BLBQg1A0dKthOUQSnhd7NNKDYsKtfpSBjtzenginLCqzs= 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 1761144621136254.2316189839222; Wed, 22 Oct 2025 07:50:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBa9e-000309-Pg; Wed, 22 Oct 2025 10:49:34 -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 1vBa9c-0002wq-V0 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:32 -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 1vBa9b-00078Y-5B for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:32 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-475c696ab23so3618975e9.1 for ; Wed, 22 Oct 2025 07:49:30 -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-475c427c3casm47262065e9.4.2025.10.22.07.49.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144569; x=1761749369; 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=QQynBKG63El5bw38fAzM94/2HygvWZMsGwQ/KZ2AhFhDmtzqI6xyYcRiC4p9Yus/tv c8Owej3Oa3uvLHRlxgTE2A/3UviuCHI/khtejHZXfgoJEhK0mQa4A8YtzfUq2p5AsA5x uGUF4GhpbAiac+1I+3IFWhm2dJZzb57XPnVgw0DT2yI5uDI5+t1P7Fp4WGlCtvRZHqeu zqTW1voSK1Yo3bxBUf6neQRblL1ecUiiB/9teCDIZSvqlgOYa5Rw2AOl/CBKJBka7lXi PweHqQuLBRkSqzR3OskSuQ/kubX8+K2MjUCQLjH9R3jWNcqoRlsaQcVRWBpYwULFOdD6 UYuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144569; x=1761749369; 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=Xu4w9Y6+ZwonB0Jqbi10+UgGLbx51Z5thG1k9XKyr+86nyaaFUEz50G/AZsjcULr7S a93UT0o7RBSSUqPgFMtZu13rp4jvT6FwDy/Pezu9mRt2Z13wx14lOhHpg3M59szosgeF dPOHNtf185zg2L0a0nvI8yCnO3+CGyp7YT4VAE9XIxtTx1fbjWfCnk0wuX7fzcbNckur ZiZR/XXRyhCYt/VaUppOFDYG6J3jWDzL+15hdOXydtA3MfwkHsk07JFvxKyfvOR3e4n4 QQt6eFmr3D094rRZsT6UXWZd7Bw2DuvG+kCj4CjF0pt81hCUs6fZAtxbWngxUtqn672o lYQw== X-Gm-Message-State: AOJu0YxIeUTKPh3tT8yieF9huSutBmLg8853ZyNsLGlWa+5xCc4cQ2L8 L0u2AhqiXu2w/xAhmZx4s4fhN4NewSHSuG7SD5DtElzvdWiSozYwn9fxQUpcUqq/x6/5fjOPKxl SQi2605Y= X-Gm-Gg: ASbGncuSfkL3B/Yp1GlzrDFmYsOaiiHFG2OLhaQw1JVaB5a04FHQQGlM4JA5F+fChzG 8V+4ovQL+mD7uPTtW3zE8fb0hnmrkLRrq7DSLlULmXza2qci9WlS9VJJE0DR0M/2kRx0JKPGhli /a5N2cwhnnf2GWQiAWdvBe11NKulUInaCloF+VQz0ytFYnIlDRRHNS9U+nGTKwF1AOV7dNjhH8d KeqdZCSxzTPgjOYVxVnLwpbOMW8GfubVS1Hnm1rSK4pLxawCKfoDe2N6mjD8bmh0OwrlAa/UJyb cLSBbO5UMF8i9ioPdbcaKOZzlXjmwSg63vvFcy/qBzFw4xOQReO99ZvbSb7kP7+QO/h6L5jnd33 NGyA8HuOOyAGfj6Z4aa24Jt6pGj0Gdt8YRm0VQhOPZtr8WBYFN/3IyhALWxfDx8FS5tUBFB2Fx8 BwtYXAqaBiJSV+cJ4pUFQLrQiGUrAWgUbLP15q8gHmRvbgQ35UYg== X-Google-Smtp-Source: AGHT+IGNf8Kp656x5OmBwRdg/t+gUU3jiGTwi+4wedQoGoLfIJaaz3b/6AK25d06d2ZbBXQs0s7FTw== X-Received: by 2002:a05:600c:34c7:b0:46f:b42e:e360 with SMTP id 5b1f17b1804b1-47117931edcmr154038905e9.40.1761144569142; Wed, 22 Oct 2025 07:49:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/7] chardev/char-io: Add @docstrings for io_channel_send[_full]() Date: Wed, 22 Oct 2025 16:48:57 +0200 Message-ID: <20251022144903.74612-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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: 1761144622500154100 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:16:49 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=1761144620; cv=none; d=zohomail.com; s=zohoarc; b=AasryY13LvU8Zda0sB/3DxmUoQSLmHAyvXRm/XUEwb3laXQqtbqd53QKiffBjlncIqfHHSYA53R9fWKg+h1mViTaR0CYPZogjx8xaLhoFDTJTNM3xw79pDJr/D1XmXx7Bz/6ApSCBfPm9Rnn/0mSHdG+hkE6yPGT5yPdQnrV5cA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144620; 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=GrufXuC85tYPnqVOonvIofGLZABFRMSBHWPOa14ylCTOU+EONruDtzgrZbn1Ak6PdJtfTuSMb9QJCrfjNuOsniaC+nNNf6gq5kGCp39gTsYapC6zPraRuxxfC/ND61l5Eu4YLc3xtpu7tmv2CNqz+GiWvchBk12i2D1DMzpzeXQ= 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 1761144620620292.5946578246402; Wed, 22 Oct 2025 07:50:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBa9r-0003Cc-LL; Wed, 22 Oct 2025 10:49:47 -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 1vBa9q-0003AH-BC for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:46 -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 1vBa9n-0007FC-LX for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:46 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-47117e75258so35868605e9.2 for ; Wed, 22 Oct 2025 07:49:43 -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-427f00ce06bsm25005321f8f.45.2025.10.22.07.49.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144582; x=1761749382; 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=iGmpK9MoytVeJR+jH+OPHfwOHojvnxQ8fqG+mPtbZ1RY0Us0//zPahA/RJg8476jgQ fHwLYSxgYvlKyHEVNcg18AwKzadNIKv/82LrXqFNeE1W3lBE73PjDYbNIF/um7Rx6NtH QZNfXf4oIdbNWJjDial0urc7JhOWlRtP49+KrVJ2OoeesVA22kg1tirsf1e3r1nJv3vW LPMpR8lG4GKWNN17D7YxYHfj4cSzhapBoZ78Ff/HnjnYx2C65PoszbAikbESLdpHu9vY xzn/5uOdqmjkPUkQTFBeVDN9sk7xhxo0/OJxcGrkstLgZ2i92u1PgnNMgljmKTg6dr/+ LNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144582; x=1761749382; 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=Ug/CJzctyLVm1jujZ/zEjvUDJhmAD01MHkGeqq9SwrxhXym4YP4lJ9rR4ZPyApFRnZ OEi3km9ltEPPA+hscO/ZrgvegqlQEoVJRrIARtApPgI/iewMd/iXmj1mvTJXdBpO8V38 5G5tJht/NcHMaZ5Qj38RFGc9w/2sp+gIOHVyx4HVn0k8OmDFVNpMS7HlGHaa45K+E2t3 6FKgxhZ6RgACThFoMGeP5T1UCg/q+5KcPwbx9Zrjp1rsKdAhWGt9or6YDqwl9maqAAUd SVC8vXQh9hYOC/TRxDDdjmQ9LoUzEEadbAaHg1jb7DU1Re+lreXMhHMNGtHhpbA96Lp3 j/pg== X-Gm-Message-State: AOJu0Yx7nOZipYrLcOxkm84tE6g9ZcRXe5SMKLLm01YeDQM4yUYMP9ti yhV7EAmeIq+ifEJMXfnFXhD4jS7cK3L00rzpnv7hXpk6tAg33GsyXSsbNA0paEOT1AGzOedHtq5 kfgE7eBQ= X-Gm-Gg: ASbGncufhzPApwAZuwaAfvxAs60pofP1+8GyfIra7uw5v72GdfqUBdFhJUt94yQLZxw MDGZDyknsAtHnZTZI8N823bPrCDNuBtXfp8DDkbNCZ3WrHc0GngBiaXAwKHtPi/ofGwC1/F3+/G Y18fW/rZnAy5gMVCynmA7JxUQGzZws4nXwVSyc7W72/JnvYybaD4hWVyH2EB4Vhq0bydeMzEf29 39DSQmZeq9/kIvcIfeVnZWiW0lxbMmeggBVnlFwiGrz+XVEx2mcseFcT+HQ9g3V9GWG45fwxXn5 5DOSjrdJU0MpxY3BMFKxRKeL3IWgOsPFf5KV4wS8CEmjbv786g8NRBM9LuvxlKme4bJrDpXi0L+ Oc0swskU/DscCYpX4vdf6yTi1I2uoMoSHhhW1j0+f2aAwIOjH+VAiN2G+hb08ZFAx6BNkyjWqKC vd+6Zc7l0m0PkcWEuIy9d6kIEoKLGLjmeEXfhEGoZiYg4f9GFz56Zwyp4HnA7D X-Google-Smtp-Source: AGHT+IFeufzexzAg/eoWTpa3bxPhIVQIIaXKb/ZYl3aHjZGenDgDhIYFv5Y37JWJP/z5ld4JbXnNGA== X-Received: by 2002:a05:600c:4e42:b0:46e:31c3:1442 with SMTP id 5b1f17b1804b1-471178afc07mr146791105e9.18.1761144581681; Wed, 22 Oct 2025 07:49:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH 3/7] chardev/char-pty: Do not ignore chr_write() failures Date: Wed, 22 Oct 2025 16:48:58 +0200 Message-ID: <20251022144903.74612-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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=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: 1761144622137158500 Cc: qemu-stable@nongnu.org Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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:16:49 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=1761144620; cv=none; d=zohomail.com; s=zohoarc; b=G8mXZz+34BxCj0LnMxqvp9eNl5k++ZBHvVf3aXkU7qUf2Q00nC8vqv8f7uDJV8HfReF9hRxtdqGCYi9xabI3ny+jPs8wJqKIYWYP6PoBvAF0RdDs6Sx3bLyT5vK1tKN41LSd6/8VhIUJ3gxxLYnsPckEm8uPPukyfiyBGN2tsjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144620; 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=eo982y9EufN6lAE38orfzAnD8HuFMjY6cZds3Jmd6WwzcvxaU2p4oYVt/4HazzIz/hk+v4/ddlYSw30R2JCm6w5zjP1EyvUlJWUuOvS8oLK5+Vx1jgffJ+eCjtBZKSbvYOT+UxemhfmMkCxbT+HR6JQLcHpPwYq6Z7C0DbsbjOk= 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 1761144620390328.51315741014037; Wed, 22 Oct 2025 07:50:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaA3-0003Or-8R; Wed, 22 Oct 2025 10:49:59 -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 1vBaA1-0003Lw-8N for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:57 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBa9z-0007KK-Ku for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:49:57 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-426ed6f4db5so635655f8f.0 for ; Wed, 22 Oct 2025 07:49:55 -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-427f00ce3e2sm25589714f8f.47.2025.10.22.07.49.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144593; x=1761749393; 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=eDl2EKu7h0kPq/KF58+Y35QruJGYeFi8vY9BD5ZHlqarrTRz2K4bqavX1SjZ3XJdaF /u3dGuZXNzjOVVLMkzfdL9mV7oxEtI8EmE/yIv5a6rNHh9FSROoDFvhK5uTrtdBpYRNk Ye0gBSBhDmQ6EMMEW74FMXkmtwGwsvhwsNI5s6T9/pm5rbQX5Lmia8O9i2SKW+M9/SsK tzdfZ8OEdZJkpYmaA+QmLyk/z+I8vmezu428y33CUIYuNq8DPM6odd6NmfERKd/S0zvz 3iwfbeJHZP3z12wMC4auslFwuJHUWZLAbyS7fDEPBZPs2YpCx5RMeTaSaprjwUUtnqZn m+DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144593; x=1761749393; 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=Ip1RwlCIk6FeqI2JNTb0PIdg9IH79+vFtbSDDhRkPsJSzpryjOGyrQrTNeo3soY6GN /6Y/Paa5JEkgWA7EzclV3R9CTWfkHB2h71LFta6nVXyGZBj/XpFrevAXyJo0ejbLF/qJ 9GM4OVvwKgxlsvYGxLzlcFrQcjbLPRnSxzQRYO1Wr9BD3ooqBnvYk1uERODG9r0vRVbn /d/acaGxpON4VzHIeCy9n1Hd497wYMYqB8nSX4ZtXx3ve9HJOyqjSD0B0viEI/z6ReYU Geo8dEwV6VG3CV2MWuUTJEbPeM0miBG9vd7nY5bNQrtbtL2nJQ2KaXBcAPOV+qR3XqF7 CkPQ== X-Gm-Message-State: AOJu0YwO+cO9cYoYYAIabZUH/kvvBlylNN5fyG7SebLDmg0W1khh3eOg X9LuVQ5sNv9dBlwT6K/qdS5nRCoUZt/oZdLa93SLKfxdcyfyWAqnx7md301JNsdVBlzA5Tmyq9j xvm7GcFk= X-Gm-Gg: ASbGncuX4P8wLm4adbM0+EOHOwmLl/y8KCzYE4WbxWB4tD8Ae7ggSQNuB8PR1Ixwl8w 9iuShpL7RWTFRLkazOAQ3fkTRchKto4QWvWbhY2Eb8L2+pe62sFjFo0mvONm+ATT3NjPhqhwMHd xsm/CW9qN+D1uC5hmyB8a6v6XRVjTgAd/Fo7nc1MNdl8aR9+HhczKhLTh0x+oU06mrVAgLtKXDm eei3CkOynK4DpvGhCPpUB6Qe24d+F3KYKNrfbThLSA4lGX5q1eV+8sVBReE7Tl0F6TczdO32WuQ vzNy4+hHLhtyP67H4n3j1BhWpK2kwJRTpT4Jwgjjtz8UzU4+nnRlQjNXqUup5kLcvS01R5wDd7p mSl6NEHt1l4Mp4jLJi4eZk+6M/phEymyb8dsMgRGxB5QHDUpXv5tL6VDCs+jjMjtgn5Vc+IFQdr trK+nXv28rLf1B47U6x/C+JpQtAFnmx8zO44ymv9cZepnOmygOLA== X-Google-Smtp-Source: AGHT+IFEQsTxFfF868oUqDAaNuYxvfDkxLPrhkOZ8HqJOmqLuzWHvIS7Gam3GpR5kVYJsL2EWd+xkg== X-Received: by 2002:a5d:584e:0:b0:407:d776:4434 with SMTP id ffacd0b85a97d-42856a89d28mr1588540f8f.30.1761144593579; Wed, 22 Oct 2025 07:49:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH 4/7] chardev/char: Allow partial writes in qemu_chr_write() Date: Wed, 22 Oct 2025 16:48:59 +0200 Message-ID: <20251022144903.74612-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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: 1761144622405154100 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:16:49 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=1761144631; cv=none; d=zohomail.com; s=zohoarc; b=dp4mS2Oi0ZPOucKocl6P0T7FeBzjEfgo9k6MRCP6VU18ZMnMpiYtzbENqbU6l8tZ7lIPJtNlCx8zFzm3tITkTQRMJce3waKFQc2jVPow6qURpXd96q082WNWiMVip+XRKUPv10X/4jdiaVcgoB4Rd1IsGvUTi06t5su7nCh/Vcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144631; 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=m1EOJj1HlhfdVvS8Vql9i0MF+cOhfXMqTdQBYN6TY9L0PmVFASgopreSSV0aO+APYUKffsfIUpI8dQOj+naNggLCSk+4EdIv0wMBlMIFN3tTsxIJZebCaYoUfHVSaoh7qnr6WhUFWjxsNRX9fjQYVr0dHdUCoj0q3gjht2eaklg= 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 1761144631103560.4941704963304; Wed, 22 Oct 2025 07:50:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaAJ-0004Yr-Nt; Wed, 22 Oct 2025 10:50:15 -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 1vBaAH-0004Qm-Uv for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:14 -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 1vBaAD-0007aj-68 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:13 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-47103b6058fso7911265e9.1 for ; Wed, 22 Oct 2025 07:50:08 -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-427ea5a0f7dsm25091777f8f.4.2025.10.22.07.50.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144605; x=1761749405; 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=sZWjASTcmDqrYjsuwqsMrYtNliEujILPzDuQuN/ePMujDcSzMGmWbA2Pp/WCpLgQIk lsPNcYwNWQQHjMRARc89l/ZxPm4lHmMQ9JyuSqee9uPrifNSIGVgzlZzhK4+nqZw/VXN WvGhJE6ZzQl1vmiWy6TzNWeUql2DbH8gDJeyXqxSqTwl0+PFjig0Kt2pBmlbDjcRJ34g d4nyWhqFcPYAkdaoZ+vlFH3nm8ozSSe8ZIOag/R2sXt2BjcYsLwM8wKIxWSTiL/kDCNO gIi+RPoOoyeiUOAJCq5wlHMDcdEPgF/pOwgXXE6JeMrK17A18CI3SDUH8vUT/LdI0CQ5 okzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144605; x=1761749405; 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=jtEPFmzLblkZi4GhcuH9gsF3t6cxXeDCsVtXiOKHaZVDc0bMB/Nzi02GU41110A4NG VfOnejvUpYG7PbLiiyC1PsiiXpIxXSBmM7+Pr6phxjkUgPm9Nh2E+SzBcjwzGlU39H3Y bsFRLFkS/iPwmXCdc8KBLFnBbtk2llCOLYB1To+mhzrmysbrs/ze16nKVzuDV83BEdIs rGVSkf8B06nk5dpdzMRQrRFilVPzmXHZCpIGbiMtkctrGjPCF5/xVZMz7+WVnM3JWaN9 wocFravARSMoGUTyXmrlsNeWrMm6y0jnDW1mamjPm1TEJBc5IYyQBfwD5UFIbihjOL3K Kc5g== X-Gm-Message-State: AOJu0YxLl9TxJDeTVpTnoRYp9Le9RQl24V4PAhPVXzVGpX3Zmf118mO+ bKNVnROy+TEHZ2MQIxdxfnhNnfjhI+SFTcZWSyVk+S5HDsN15S1nbx8Yzcxg5MJHzggL7Ia1Kjt 6wUv7TL8= X-Gm-Gg: ASbGncuoUicxFtZMo58MKaFNhv2F6CNzTUpLm2VgYbP62O21Y8lF4GdUBrNyJsIiXDC VfqeiiL0pVImMJ7JRBkJCohWJACFyfZNgkS0su7Pe0sNk22GtjGSHjPMRyZ39TQnc7v1sT1EOYO tPtNBe06spZ52gx3fNhTYxfIfn98SZmna1ocs4CQlmh27Qz27y8YhPwfP4nLYpZS3ya6CvGUwlP yMai3cLqdbvicxFdBD3JRBiH0VZqo2uqe8CRXqZSIGGReE1tKrKYGf0eh+fj3iuDB+7JJgAoWkt nBwukfE62W7tc3bFpw33/AfMYsSYrTYj2Orkmj3M4EpzQ5iZUolnZsIcafZiCgHj0oOG6IawUMP UvAIfO4nwz6+9DxJt0oMkwuQmgOP5ubZME9XKO9yuGQnrdRRXRWl1BiFHuSkbV5M1AhTDuynKdg JormZGUKeqsQKlY/Kyy3IaWAytCNP9v9EZEbCinDer90YKJpWDhhZm9sAS1Fyn X-Google-Smtp-Source: AGHT+IErFlVBAfH0mUFgLYepVZZ40yv1EyZXa/oNzJUpVKoKh1DpCn4Z6s+QoLWuSVDSx6SPzo1qgg== X-Received: by 2002:a05:600c:6c07:b0:46e:6a3f:6c6 with SMTP id 5b1f17b1804b1-475c6f1fd1cmr11488535e9.6.1761144605471; Wed, 22 Oct 2025 07:50:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH 5/7] chardev/char: Preserve %errno in qemu_chr_write() Date: Wed, 22 Oct 2025 16:49:00 +0200 Message-ID: <20251022144903.74612-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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=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: 1761144633659158500 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 --- 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:16:49 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=1761144644; cv=none; d=zohomail.com; s=zohoarc; b=SGW4oydojsP5Kx4T9W7aiEeNV6B/a/OrCuHgLc/Biu0eFImj/O+vTBOL1Pjh2rTLoIM6TwPVHXZtJ0a2f1tazKavv5K02YUlc6Ld+X9At1E/xfr5iea1jRh8GHElyX7zf1ocgm0hdYq687Uto2ubQBNyL7Hu8ACSrW/4uPZNrM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144644; 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=JI7Oo7E0h7f01K0iyZsRis9slnRf/cp9bSGQcaLZ2TCXHVrrCdxJdk8lWBTm32Bh3ioyDwoFgR5uhpHp88O4RYRqjnFnl6MErc7fdJWOblF+6eL2aidn2wXwEVQ3j/qOEFAvmjR2H/X73BYFoK9ReF/EPVlrtlxd2Y+rihdXXqE= 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 1761144644813746.2051318601128; Wed, 22 Oct 2025 07:50:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaAd-000508-S0; Wed, 22 Oct 2025 10:50:37 -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 1vBaAR-0004qd-00 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:24 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBaAO-0007dq-9D for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:21 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-42421b1514fso4429485f8f.2 for ; Wed, 22 Oct 2025 07:50:19 -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-47496d4b923sm37094015e9.14.2025.10.22.07.50.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144617; x=1761749417; 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=F5BGJxY6PIsVk2xqL3PaMVH5zoEIeUyuULxKfjUXLNW5/4v9gfdbtO7Zmh4RuM2S2L PmBvq7LVgAqen7k/YmN2Maei/yVGEM+dQyl1oH4yXGkBsyD27o8aEmZ52hc3LS3iUkGs Q3kfSsYJDjvK/VtsBwuoeb6UV1IVkVmrds1HQdgjIAdCTCuCKR0NWy13DnYwwTtaozZW 4rjwTBm4ol8zdtQnkWmE3OGQ3M8qksxzz+xOjz3S3frJ8jKTPLpGfCYyQq/Lp3v1AVMT eUajx0Rlti/iLc29NNxnjV5YJp7/I5LB6xx3YZOmfF1L77BDcu7Lsbq1R4GDeDNx1Kcp k1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144617; x=1761749417; 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=G0rRDe/IRAxgIkAhs3o51UiXdhXSDbjH1ol8p3trpKr+PZlm4X1vrPLAbXmtzjXDQd XVZSuX9xdbf+uj6WjfZ201VXeq1O3r6e+0ckk0RtyX6k/dVZk9Uar52sCXp10ZNXBftZ DnJHiY4f1HPgjktjMK/YP/EUosnZQqxSF1xCDGGGY868d9Q0JyxA4b2olAzaqVd9rudb u674ukImc+f9fudnm9h7q7d4T35YqO0s1p5BELOIhGnc/8tKSYUW8P6F5p4jGvUO0cHJ 6mRJ0jVW8IjmvHuDREDHvxbCfkEWZztRD5pSCMUt46K9Uv6sHORGaO0EfB7YGLxLZlGl CzGA== X-Gm-Message-State: AOJu0Yw0ThmV7m02Legk4BdD0zesuU/5xO5GoLmtSZWB/CCbnonuoo8m 9wlQnFIncUSjpq9X78bvxO6jtjPKB15peZIV/KSE1hsLLI6+GgB0FHcPHvgyMj8eCeAUPh9eG+5 /kw1QaHw= X-Gm-Gg: ASbGncsOj4TcaG1LKjGxocsAkItiTloLMoU3L7EZHzSnXf5rtjlQYbCazznNpCiHjy0 MBF0Zcrpj+DZ6qNZus8K9rSvfHsynM5kYXBrfe6QnYv1xtQ2iUZ23a1eBmGJadq17SHdpZbvfiF Y8+JSjyK9I+QmNMNWfBY1aGERTWPvEYYYl0FNMrkMnGWkS8TI/twtCWDMGxo8iXtDh7Mo+YmdmO TpNxAVJHlUowzchcmbV2VYMdPpxmqWPcVj7LSb9wyO+9+pPTlrLrUlvpLnvH0u5lOsX+xF8wd68 vIDG5e8waEpJhx8MOJvjjG5ifdILEsVqK1l6G5NRlkz+rq40exqLGO8wJBShI9SoHjgeAlu7rR6 URbRl2CFYiGM1SnxOdREao4p4jquvNCRvVUij0jKkXTp8lUOmT39YgDS9NMneRXig2pyhCC9CRY rC7QlyA3cW1AQJWEI+bbn507J0D9tLv+YkAwsNq0KPbyZe9tpuig== X-Google-Smtp-Source: AGHT+IFtC5ILdVfHZKF11kQmvgILa+PVC90qpZm8g7o2bLT5cY+aJy/iQu3+iXKd2by/EoBpYA6vAg== X-Received: by 2002:a05:6000:4b08:b0:427:526:16a3 with SMTP id ffacd0b85a97d-4270526183emr17023075f8f.29.1761144617270; Wed, 22 Oct 2025 07:50:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 6/7] chardev/char-hub: Retry when qemu_chr_fe_write() can not write Date: Wed, 22 Oct 2025 16:49:01 +0200 Message-ID: <20251022144903.74612-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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: 1761144649916158500 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:16:49 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=1761144653; cv=none; d=zohomail.com; s=zohoarc; b=IkF8sOEIeVWkVFdSZLEFrcX6+pn8FFnYUiP54UAFHH8M92GIquRTq/12E1uOpvnwIrIddt31/oPLb+e5RXPbWDCAy8YBS+cAO3ZWF6jKObLcYYJHKEm5ruvraxYEEIL9pc9wHMPOhxpUT9scRrIXRKyW4NeEjCH8xFyTiyL3oRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761144653; 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=iaxDeH9My87/PvYoVBz1Exasgo7GGkYMkkBE2Pgz7Cz05pAcA+ciOXjy9GSqgQUb5eakIrqLQaqYfkLd08c9LGiAR4AGbl4YICad2j8j4Ju823OeajDMinmX4r4Q19+IFa3MCFuwjFMQ7KvYE20En1XGf70d2hCMUdKfCLZUdyI= 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 1761144653496759.6574182974359; Wed, 22 Oct 2025 07:50:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBaAp-0005f7-GB; Wed, 22 Oct 2025 10:50:47 -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 1vBaAd-000553-VU for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:37 -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 1vBaAb-0007eR-93 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 10:50:35 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-47112edf9f7so34131825e9.0 for ; Wed, 22 Oct 2025 07:50:32 -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-475c41ca845sm48831605e9.0.2025.10.22.07.50.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 07:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761144629; x=1761749429; 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=uwl8nTJHg/Epkr6OCRIP2CIG8z2RWKhnoyQUN+I/48ujSNUJtTOfKve6/7PtGkcEBF JqjQAZXF4Kw2C1vCU0/jWOw13XNLo6K2IaAX4BjKVDcDeJtgwYABeDJsxlo/peqRSKsB ZqhsnGZsMBO75mHrf58hE/p+J459ybUcv+DX8rWKUHB32qq74p45ZoTjEm9R32vMwsRT LG5Oh8fkksONPS9A97nFmI7wO/MKj2kfDHYaETBQcagqzxJMsJTE+AbEOoiZegCptKuz F0dsacKkIfktfys0VSiVcKJXgxpbwVvGANCwC1wjg8TAnkR7YR2irXVhNSKkRxsjMeOZ +gXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761144629; x=1761749429; 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=VfJA6CJphyK7UYIAKCoH4x7b8mnX2b60UGXpbieYnFNvUAKqWrIaSFXPwHXA4mSoi1 oqTX+08cfj3hus6yFXgIGd/nq9nOG3AQAP/gVL27dxvvrjreb2bAq1Py0fNfvGw3WiDQ 8Ov+qn0VU2wfMKB47ybPOArySBvgMDNEnNsxG7xTLADQaHc6XG6WvNDSAEgmR7UqDUzo cYbOPdCC4rr+TLLUpQFksV9BAS2FR5MRHAEkJ1a8a0XwfHZP2QkUN4C3JUGBP9Vr2Bhc G7u1FOg4qnyUbVuR002Wduy3hRRoVzWkFaneNl4+952NG0+cv382dyk8ogRY3ckHLSuk 9Yog== X-Gm-Message-State: AOJu0YyD4DsuJkHb1prjuyfoT30UXY5iOsYX5lajgPK2KNbtnh3qYo4J sTDGII/1I7q1wJGUMo/h7pdF8EUqTNyCnbvrk6zvE/HUfluT8Oy/0sESfua3RZetr6CrhuxObBZ MjIGh90A= X-Gm-Gg: ASbGncvUA/FjsN6oN8C9pM8okEYMHjUopdZT9B2Qa0k74jCD48Zh8zMm0nyQrT5mGQJ i3YJsL0xO5fsLsn+t0bNIskRc7bGzeqvqyIXRt1tTh1s2RnBWBrXUAgTpI/ynVnkguztE9FauZu WEMafm9eeTcdtbbCeHuFvnc6wcc0bD5+6nwU1XylRZrne8iPq3IoxnK07x+2Zu1ENoGBjPn0enO RzD7ZcT17aXAnfXG82qOsHGBKVdwLkiykV0vFviibePmMUjaRqZt6sbYJiNr+WeCodyhkCeSszT 5T6tsD+EAqrO6sSPt+rnR75ZJW/VkA1OGzwsB7zqCj6x0ZzEnD7pE+lbJ5a65BgOK7IQNz+R2jp 6Cvaoc9GE/C94Kx/09X5BwgjdTkyq9ONy8cq2aQfgD9pNqbCRy3Me6SqpIIMfHUao7EFKJWosYr oclB2UfXIagwJXT5yP4KX6L3nnC3AeXAARJm0TrQEa1u5GmpsisQJEG+8z05yI X-Google-Smtp-Source: AGHT+IHtYL2UYZnW2Z2tb6CcX9id3CCNeh+XNNnh/f0uVVwIc1E/B1zC05C+HEU3RWM/cM2BEnrGAw== X-Received: by 2002:a05:600c:1907:b0:46e:206a:78cc with SMTP id 5b1f17b1804b1-4711791c3b0mr179311735e9.28.1761144629314; Wed, 22 Oct 2025 07:50:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?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 7/7] hw/char: Simplify when qemu_chr_fe_write() could not write Date: Wed, 22 Oct 2025 16:49:02 +0200 Message-ID: <20251022144903.74612-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022144903.74612-1-philmd@linaro.org> References: <20251022144903.74612-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: 1761144653956158500 If no chars were written, avoid to access the FIFO. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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