diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-07 17:32:56 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-04-11 16:38:34 +0200 |
commit | 160a29e2f8b2d100246ab446813409f72d1e0767 (patch) | |
tree | 1b9ca64dcf78e2c9fde51d72e59a435ce7a67753 /include | |
parent | 2b1f8fcb847f8cc7a214e14cbbdf99b354a4f8e3 (diff) |
block: move has_variable_length to BlockLimits
At the protocol level, has_variable_length only needs to be true in the
very special case of host CD-ROM drives, so that they do not need an
explicit monitor command to read the new size when a disc is loaded
in the tray.
However, at the format level has_variable_length has to be true for all
raw blockdevs and for all filters, even though in practice the length
depends on the underlying file and thus will not change except in the
case of host CD-ROM drives.
As a first step towards computing an accurate value of has_variable_length,
add the value into the BlockLimits structure and initialize the field
from the BlockDriver.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20230407153303.391121-2-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/block_int-common.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index d419017328..a6d271f25d 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -855,6 +855,14 @@ typedef struct BlockLimits { /* maximum number of iovec elements */ int max_iov; + + /* + * true if the length of the underlying file can change, and QEMU + * is expected to adjust automatically. Mostly for CD-ROM drives, + * whose length is zero when the tray is empty (they don't need + * an explicit monitor command to load the disk inside the guest). + */ + bool has_variable_length; } BlockLimits; typedef struct BdrvOpBlocker BdrvOpBlocker; |