All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
	richard.henderson@linaro.org
Subject: [PULL 13/13] blockdev: Drop unused drive_get_next()
Date: Wed, 15 Dec 2021 15:02:22 +0100	[thread overview]
Message-ID: <20211215140222.769652-14-armbru@redhat.com> (raw)
In-Reply-To: <20211215140222.769652-1-armbru@redhat.com>

drive_get_next() is basically a bad idea.  It returns the "next" block
backend of a certain interface type.  "Next" means bus=0,unit=N, where
subsequent calls count N up from zero, per interface type.

This lets you define unit numbers implicitly by execution order.  If the
order changes, or new calls appear "in the middle", unit numbers change.
ABI break.  Hard to spot in review.

The previous commits eliminated all uses.  Drop the function.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20211117163409.3587705-14-armbru@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
---
 include/sysemu/blockdev.h |  1 -
 blockdev.c                | 10 ----------
 2 files changed, 11 deletions(-)

diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 32c2d6023c..a750f99b79 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -50,7 +50,6 @@ void drive_check_orphaned(void);
 DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
 int drive_get_max_bus(BlockInterfaceType type);
 int drive_get_max_devs(BlockInterfaceType type);
-DriveInfo *drive_get_next(BlockInterfaceType type);
 
 QemuOpts *drive_def(const char *optstr);
 QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
diff --git a/blockdev.c b/blockdev.c
index b35072644e..0eb2823b1b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -303,16 +303,6 @@ int drive_get_max_bus(BlockInterfaceType type)
     return max_bus;
 }
 
-/* Get a block device.  This should only be used for single-drive devices
-   (e.g. SD/Floppy/MTD).  Multi-disk devices (scsi/ide) should use the
-   appropriate bus.  */
-DriveInfo *drive_get_next(BlockInterfaceType type)
-{
-    static int next_block_unit[IF_COUNT];
-
-    return drive_get(type, 0, next_block_unit[type]++);
-}
-
 static void bdrv_format_print(void *opaque, const char *name)
 {
     qemu_printf(" %s", name);
-- 
2.31.1



  parent reply	other threads:[~2021-12-15 14:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 14:02 [PULL 00/13] Block device patches patches for 2021-12-15 Markus Armbruster
2021-12-15 14:02 ` [PULL 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize Markus Armbruster
2021-12-15 14:02   ` Markus Armbruster
2021-12-15 14:02 ` [PULL 02/13] hw: Replace trivial drive_get_next() by drive_get() Markus Armbruster
2021-12-15 14:02   ` Markus Armbruster
2021-12-15 14:02 ` [PULL 03/13] hw/arm/npcm7xx_boards: Replace " Markus Armbruster
2021-12-15 14:02 ` [PULL 04/13] hw/arm/versatilepb hw/arm/vexpress: " Markus Armbruster
2021-12-15 14:02 ` [PULL 05/13] hw/arm/imx25_pdk: " Markus Armbruster
2021-12-15 14:02 ` [PULL 06/13] hw/arm/mcimx6ul-evk: " Markus Armbruster
2021-12-15 14:02 ` [PULL 07/13] hw/arm/mcimx7d-sabre: " Markus Armbruster
2021-12-15 14:02 ` [PULL 08/13] hw/arm/xlnx-versal-virt: " Markus Armbruster
2021-12-15 14:02 ` [PULL 09/13] hw/microblaze: " Markus Armbruster
2021-12-15 14:02 ` [PULL 10/13] hw/arm/xlnx-zcu102: " Markus Armbruster
2021-12-15 14:02 ` [PULL 11/13] hw/arm/xilinx_zynq: " Markus Armbruster
2021-12-15 14:02 ` [PULL 12/13] hw/arm/aspeed: " Markus Armbruster
2021-12-15 14:02 ` Markus Armbruster [this message]
2021-12-16  1:00 ` [PULL 00/13] Block device patches patches for 2021-12-15 Richard Henderson

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=20211215140222.769652-14-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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.