Received: from eggs.gnu.org ([2001:4830:134:3::10]:44895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVk3D-0007oZ-0Z for qemu-devel@nongnu.org; Tue, 16 Feb 2016 13:08:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVk3B-0005SY-V7 for qemu-devel@nongnu.org; Tue, 16 Feb 2016 13:08:38 -0500 From: Max Reitz Date: Tue, 16 Feb 2016 19:08:13 +0100 Message-Id: <1455646106-2047-2-git-send-email-mreitz@redhat.com> In-Reply-To: <1455646106-2047-1-git-send-email-mreitz@redhat.com> References: <1455646106-2047-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 01/14] monitor: Use BB list for BB name completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Signed-off-by: Max Reitz --- monitor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 73eac17..7620e20 100644 --- a/monitor.c +++ b/monitor.c @@ -42,6 +42,7 @@ #include "ui/console.h" #include "ui/input.h" #include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "audio/audio.h" #include "disas/disas.h" #include "sysemu/balloon.h" @@ -3467,7 +3468,7 @@ static void monitor_find_completion_by_table(Monitor *mon, int i; const char *ptype, *str, *name; const mon_cmd_t *cmd; - BlockDriverState *bs; + BlockBackend *blk = NULL; if (nb_args <= 1) { /* command completion */ @@ -3522,8 +3523,8 @@ static void monitor_find_completion_by_table(Monitor *mon, case 'B': /* block device name completion */ readline_set_completion_index(mon->rs, strlen(str)); - for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) { - name = bdrv_get_device_name(bs); + while ((blk = blk_next(blk)) != NULL) { + name = blk_name(blk); if (str[0] == '\0' || !strncmp(name, str, strlen(str))) { readline_add_completion(mon->rs, name); -- 2.7.1