From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=X0FOGDXi; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 009925A061E for ; Thu, 30 Jan 2025 01:53:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1738198384; bh=yPq7yH4wQQ0IEcBQ5AUjX9HNZi8FZtJi9nfE9AwHyv4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X0FOGDXivXM/SusAO9MjaVDoj/c6lsuwrJ5nbGeEeFFh2B3tOHs/pGOvuErsASthz QSUdNBHxMhN9waOMZRce8gV2W6WiDWXpWnIp7u+x318fsb86m3OnNNWU5n58N7xbPW qCSACLpp/8IqWs+ofSJAxEc7AazuI4ZShv2niN1Ki8jlxG6MjW8QafTWexOT/uE947 SVbPiRNs7yrerYxC8YK8IBF6/tTXBWimvXUx6ezrkbtPEpWf/KYWBpXWGc20xCzk7A fOqMlDEs0HZo5JKo0L0tNsKOibh65gpbGY18vvg06RRXFse79ZL8RCnrmLbyRtFXEJ VqgCFIuakSqQw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yk0r02mnSz4x5l; Thu, 30 Jan 2025 11:53:04 +1100 (AEDT) Date: Thu, 30 Jan 2025 11:44:42 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 5/7] util: Add read_remainder() and read_all_buf() Message-ID: References: <20250127231532.672363-1-sbrivio@redhat.com> <20250127231532.672363-6-sbrivio@redhat.com> <20250128074849.0e83099c@elisabeth> <20250129083347.2f6a23af@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ovf61xEulxbop8rr" Content-Disposition: inline In-Reply-To: <20250129083347.2f6a23af@elisabeth> Message-ID-Hash: 53ZWBGNK4HGQY3DCFXOUL4DIUBKNU3NV X-Message-ID-Hash: 53ZWBGNK4HGQY3DCFXOUL4DIUBKNU3NV X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --ovf61xEulxbop8rr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 29, 2025 at 08:33:47AM +0100, Stefano Brivio wrote: > On Wed, 29 Jan 2025 12:03:30 +1100 > David Gibson wrote: >=20 > > On Tue, Jan 28, 2025 at 07:48:49AM +0100, Stefano Brivio wrote: > > > On Tue, 28 Jan 2025 11:59:28 +1100 > > > David Gibson wrote: > > > =20 > > > > On Tue, Jan 28, 2025 at 12:15:30AM +0100, Stefano Brivio wrote: =20 > > > > > These are symmetric to write_remainder() and write_all_buf() and > > > > > almost a copy and paste of them, with the most notable differences > > > > > being reversed reads/writes and a couple of better-safe-than-sorry > > > > > asserts to keep Coverity happy. =20 > > > >=20 > > > > So, there's one thing that needs to be not quite symmetric for the > > > > read() version: we need to handle EOF. At present, I believe these > > > > will enter an infinite loop on EOF, which is not a graceful failure > > > > mode. =20 > > >=20 > > > It doesn't happen in our current usage where we close the socket once > > > we're done, =20 > >=20 > > I don't see how what we do with the socket is relevant. Couldn't we > > hit this case if qemu unexpectedly closed the socket or died? >=20 > Yes, sure. I just mentioned that it's not the intended usage, and > rather an error case we need to handle. Oh, sure, no argument there. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --ovf61xEulxbop8rr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeay3kACgkQzQJF27ox 2GffNBAAmSmqJOY5oFfiLWrlRv+0dd4mUgCmSxfjwu2HexwEFL3/LJK8LP52M25y LgGJPYrMTmKQ3scKLLsrZZ0Apb9AFhHOQwrVuEtXOG3eywasAtECFL3TOy7b3gt0 4yMZFoSUqOkkR4haIcB1wMOf/AkRkTt74kCN1JBzy4/3KF6BjAEZQamFDWb1sZAb leIC0TF4dOxmnvc/Z+z0xWNxDjN07rlPWGDgAYuZoNdZRok1Q1Bd0JWPtdT6OWvZ V/WzcwUlspcBvp1wEvU9x1WSS7EiEjd2E12OxQ8fMTO87myrP56mPJcBMAQzURTE /E1PNMdWVzVjfD8KKZIMDVPsuazXk0Oxlk0hTZDmtRhURoG7SZBWY3xDKqDNp5QD geOToimcsKSoclSJheoGY1POCRcVfPyHjafqm9qbAnRACrvc4lAWjVuzAynQspse bHS6mi94Skac2W6UCvxlEVG0NLQhTBNYrrao+1xN8PWxFWgZEFLGaqQODWcgwN+I sUJxshWrX8tUzRvwZhr+R/86d4W1mbBrBCt3q+QWfx5z7Te6waxaKJOTce1aF/Gg TCNTHjuCvg1D2fA/9P0HeiVihmVi/I/KfcVe7l17XXEVH0KnB9rTAqadiSsIDiN8 X6+IuTQGKvMvvGbH7MLvmR8oSCozVxDz0oolAMY4dYmpShDIJaA= =hyFg -----END PGP SIGNATURE----- --ovf61xEulxbop8rr--