From: "Richard W.M. Jones" <rjones@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-comment@lists.linux.dev
Subject: Re: [PATCH 1/1] device-types/blk/description.tex: Allow longer device IDs to be returned
Date: Sun, 6 Sep 2026 17:06:25 +0100 [thread overview]
Message-ID: <20260906160625.GJ1436@redhat.com> (raw)
In-Reply-To: <20260906110725-mutt-send-email-mst@kernel.org>
On Sun, Sep 06, 2026 at 11:13:39AM -0400, Michael S. Tsirkin wrote:
> On Sun, Sep 06, 2026 at 03:54:44PM +0100, Richard W.M. Jones wrote:
[...]
> U also want a feature bit otherwise driver does not know if it's safe to
> send VIRTIO_BLK_T_GET_LONG_ID.
Interestingly (at least for Linux) sending VIRTIO_BLK_T_GET_LONG_ID
when the hypervisor doesn't support it returns -EOPNOTSUPP, but I can
add a feature bit as well.
> > \end{lstlisting}
> >
> > The \field{flags} bitfield is ignored by the device unless
> > @@ -515,9 +516,26 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
> > the device to discard the specified range, provided that following reads return
> > zeroes.
> >
> > -VIRTIO_BLK_T_GET_ID requests fetch the device ID string from the device into
> > -\field{data}. The device ID string is a NUL-padded ASCII string up to 20 bytes
> > -long. If the string is 20 bytes long then there is no NUL terminator.
> > +VIRTIO_BLK_T_GET_ID or VIRTIO_BLK_T_GET_LONG_ID requests fetch the
> > +device ID string from the device into \field{data}. The device ID
> > +string is an ASCII string which can be up to 247 bytes long.
> > +
> > +VIRTIO_BLK_T_GET_ID fetches the first 20 bytes of the device ID
> > +string. If the ID is shorter than 20 bytes, then the response is
> > +padded with NUL bytes so its length is 20 bytes. (Note that if the ID
> > +is 20 bytes or longer, this means the response will not be NUL
> > +terminated.)
> > +
> > +VIRTIO_BLK_T_GET_LONG_ID fetches the complete device ID string. The
> > +response is always 248 bytes long, padded to this length with NUL
> > +bytes. Since the longest permitted device ID string is 247 bytes, the
> > +response MUST be NUL terminated.
>
> That's a lot of padding) Sure u do not want to use the actual length?
I'm not too clear on this (and the spec is also unclear), but it seems
the buffer is allocated in the guest RAM? In that case since it
doesn't know the length in advance it must allocate a fixed size buffer.
[...]
> > +(non-truncated) device ID. In this case a guest which has not opted
>
> avoid "guest"
Is "driver" preferred?
I'll send a follow up addressing your other points, but probably not today.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit
next prev parent reply other threads:[~2026-09-06 16:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 14:54 [PATCH 0/1] [PATCH] device-types/blk/description.tex: Allow longer device IDs to be returned Richard W.M. Jones
2026-09-06 14:54 ` [PATCH 1/1] " Richard W.M. Jones
2026-09-06 15:13 ` Michael S. Tsirkin
2026-09-06 16:06 ` Richard W.M. Jones [this message]
2026-09-07 7:33 ` Michael S. Tsirkin
2026-09-07 7:56 ` Michael S. Tsirkin
2026-09-07 14:02 ` Richard W.M. Jones
2026-09-07 19:27 ` Michael S. Tsirkin
2026-09-08 9:35 ` Richard W.M. Jones
2026-09-08 10:06 ` Michael S. Tsirkin
2026-09-08 10:43 ` Richard W.M. Jones
2026-09-08 10:57 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260906160625.GJ1436@redhat.com \
--to=rjones@redhat.com \
--cc=mst@redhat.com \
--cc=virtio-comment@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.