Skip to content

Commit

Permalink
blockdev: Drop deprecated bogus -drive interface type
Browse files Browse the repository at this point in the history
Drop the crap deprecated in commit a1b40bd "blockdev: Deprecate
-drive with bogus interface type" (v5.1.0).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20210309161214.1402527-5-armbru@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
  • Loading branch information
Markus Armbruster committed Mar 19, 2021
1 parent f2a9a6c commit fe9f70a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 37 deletions.
37 changes: 15 additions & 22 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,10 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit)
return NULL;
}

void drive_mark_claimed_by_board(void)
{
BlockBackend *blk;
DriveInfo *dinfo;

for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
if (dinfo && blk_get_attached_dev(blk)) {
dinfo->claimed_by_board = true;
}
}
}

/*
* Check board claimed all -drive that are meant to be claimed.
* Fatal error if any remain unclaimed.
*/
void drive_check_orphaned(void)
{
BlockBackend *blk;
Expand All @@ -261,7 +252,17 @@ void drive_check_orphaned(void)

for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
if (dinfo->is_default || dinfo->type == IF_NONE) {
/*
* Ignore default drives, because we create certain default
* drives unconditionally, then leave them unclaimed. Not the
* users fault.
* Ignore IF_VIRTIO, because it gets desugared into -device,
* so we can leave failing to -device.
* Ignore IF_NONE, because leaving unclaimed IF_NONE remains
* available for device_add is a feature.
*/
if (dinfo->is_default || dinfo->type == IF_VIRTIO
|| dinfo->type == IF_NONE) {
continue;
}
if (!blk_get_attached_dev(blk)) {
Expand All @@ -272,14 +273,6 @@ void drive_check_orphaned(void)
if_name[dinfo->type], dinfo->bus, dinfo->unit);
loc_pop(&loc);
orphans = true;
continue;
}
if (!dinfo->claimed_by_board && dinfo->type != IF_VIRTIO) {
loc_push_none(&loc);
qemu_opts_loc_restore(dinfo->opts);
warn_report("bogus if=%s is deprecated, use if=none",
if_name[dinfo->type]);
loc_pop(&loc);
}
}

Expand Down
7 changes: 0 additions & 7 deletions docs/system/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ QEMU 5.1 has three options:
to the user to load all the images they need.
3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmwrae.

``-drive`` with bogus interface type (since 5.1)
''''''''''''''''''''''''''''''''''''''''''''''''

Drives with interface types other than ``if=none`` are for onboard
devices. It is possible to use drives the board doesn't pick up with
-device. This usage is now deprecated. Use ``if=none`` instead.

Short-form boolean options (since 6.0)
''''''''''''''''''''''''''''''''''''''

Expand Down
7 changes: 7 additions & 0 deletions docs/system/removed-features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ becomes
-device isa-fdc,...
-device floppy,unit=1,drive=...

``-drive`` with bogus interface type (removed in 6.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''

Drives with interface types other than ``if=none`` are for onboard
devices. Drives the board doesn't pick up can no longer be used with
-device. Use ``if=none`` instead.


QEMU Machine Protocol (QMP) commands
------------------------------------
Expand Down
1 change: 0 additions & 1 deletion include/sysemu/blockdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ struct DriveInfo {
bool is_default; /* Added by default_drive() ? */
int media_cd;
QemuOpts *opts;
bool claimed_by_board;
QTAILQ_ENTRY(DriveInfo) next;
};

Expand Down
8 changes: 1 addition & 7 deletions softmmu/vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2511,13 +2511,7 @@ static void qemu_init_board(void)
/* From here on we enter MACHINE_PHASE_INITIALIZED. */
machine_run_board_init(current_machine);

/*
* TODO To drop support for deprecated bogus if=..., move
* drive_check_orphaned() here, replacing this call. Also drop
* its deprecation warning, along with DriveInfo member
* @claimed_by_board.
*/
drive_mark_claimed_by_board();
drive_check_orphaned();

realtime_init();

Expand Down

0 comments on commit fe9f70a

Please sign in to comment.