Skip to content

Instantly share code, notes, and snippets.

@rwmjones
Created July 31, 2026 13:34
Show Gist options
  • Select an option

  • Save rwmjones/681f1fff39a2099dfe67d46959ef0e0a to your computer and use it in GitHub Desktop.

Select an option

Save rwmjones/681f1fff39a2099dfe67d46959ef0e0a to your computer and use it in GitHub Desktop.
0001-device-types-blk-description.tex-Add-feature-flag-fo.patch
From 60e188d06d775d51e501a4c3d994eff3326c7af9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 31 Jul 2026 14:32:03 +0100
Subject: [PATCH] device-types/blk/description.tex: Add feature flag for long
device IDs
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
device-types/blk/description.tex | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/device-types/blk/description.tex b/device-types/blk/description.tex
index 3b3a4e7..b11ae64 100644
--- a/device-types/blk/description.tex
+++ b/device-types/blk/description.tex
@@ -73,6 +73,10 @@ \subsection{Feature bits}\label{sec:Device Types / Block Device / Feature bits}
VIRTIO_BLK_REQ_FLAG_OUT_FUA flag in the \field{flags} bitfield of the
\field{virtio_blk_req} structure for VIRTIO_BLK_T_OUT requests.
+\item[VIRTIO_BLK_F_LONG_ID (20)] Device returns an
+ ID of length up to 255 bytes. See discussion of
+ VIRTIO_BLK_T_GET_ID below for how it is encoded.
+
\end{description}
\subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Block Device / Feature bits / Legacy Interface: Feature bits}
@@ -516,8 +520,18 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
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.
+\field{data}.
+
+The length and encoding depend on feature bit VIRTIO_BLK_F_LONG_ID.
+
+If the feature bit is clear, 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.
+
+If the feature bit is set, the device ID may be up to 255 bytes long
+and is returned as a NUL-padded, always NUL-terminated ASCII string
+of 256 bytes. (The 256th byte is always NUL.) Older drivers may
+truncate the device ID to 20 bytes.
The \field{data} used for VIRTIO_BLK_T_GET_LIFETIME requests is populated
by the device, and is of the form
@@ -911,7 +925,9 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
virtio_blk_discard_write_zeroes for VIRTIO_BLK_T_DISCARD,
VIRTIO_BLK_T_SECURE_ERASE and VIRTIO_BLK_T_WRITE_ZEROES requests.
-The length of \field{data} MUST be 20 bytes for VIRTIO_BLK_T_GET_ID requests.
+The length of \field{data} MUST be 20 bytes for VIRTIO_BLK_T_GET_ID
+requests if VIRTIO_BLK_F_LONG_ID is clear, and MUST be 256 bytes if
+set.
VIRTIO_BLK_T_DISCARD requests MUST NOT contain more than
\field{max_discard_seg} struct virtio_blk_discard_write_zeroes segments in
--
2.55.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment