On 10/6/26 21:13, Eric Blake wrote:
On Mon, Sep 28, 2026 at 10:23:49AM +0200, guillaume vincke wrote:
+static bool nbd_channel_is_closed(QIOChannel *ioc)
+{
+ char data;
+ struct iovec iov = { .iov_base = &data, .iov_len = 1 };
+ ssize_t len = -1;
+
+ if (!qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) {
+ return false;
+ }
+
+ len = qio_channel_readv_full(
+ ioc, &iov, 1, NULL, NULL, QIO_CHANNEL_READ_FLAG_MSG_PEEK, NULL);
+
+ if (len == 0 || (len < 0 && len != QIO_CHANNEL_ERR_BLOCK)) {
+ return true;
+ }
+ return false;
The last group could be shortened to:
return len == 0 || (len < 0 && len != QIO_CHANNEL_ERR_BLOCK);
Thanks, I will make sure to include those changes in v2 once patch 2/2
is reviewed, to avoid a new submission for these alone.
The changes turned out small enough, and I want to get a bundle of
pending patches merged, so I want ahead and made the minor changes and
included this on my NBD queue.
That's perfect. Thank you for the edits.
but that is not mandatory.
Reviewed-by: Eric Blake <[email protected]>