[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/17] block: Improve bdrv_iterate
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 02/17] block: Improve bdrv_iterate |
Date: |
Sat, 07 Feb 2009 19:16:28 +0100 |
User-agent: |
StGIT/0.14.2 |
Make bdrv_iterate more useful by passing the BlockDriverState to the
iterator instead of the device name.
Signed-off-by: Jan Kiszka <address@hidden>
---
block.c | 4 ++--
block.h | 3 ++-
monitor.c | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index 330317a..d12a9aa 100644
--- a/block.c
+++ b/block.c
@@ -966,12 +966,12 @@ BlockDriverState *bdrv_find(const char *name)
return NULL;
}
-void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque)
+void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void *opaque)
{
BlockDriverState *bs;
for (bs = bdrv_first; bs != NULL; bs = bs->next) {
- it(opaque, bs->device_name);
+ it(opaque, bs);
}
}
diff --git a/block.h b/block.h
index e1927dd..aa26ef3 100644
--- a/block.h
+++ b/block.h
@@ -141,7 +141,8 @@ void bdrv_set_change_cb(BlockDriverState *bs,
void (*change_cb)(void *opaque), void *opaque);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
BlockDriverState *bdrv_find(const char *name);
-void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque);
+void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs),
+ void *opaque);
int bdrv_is_encrypted(BlockDriverState *bs);
int bdrv_set_key(BlockDriverState *bs, const char *key);
void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
diff --git a/monitor.c b/monitor.c
index 354a792..9643e44 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2633,8 +2633,9 @@ static void file_completion(const char *input)
closedir(ffs);
}
-static void block_completion_it(void *opaque, const char *name)
+static void block_completion_it(void *opaque, BlockDriverState *bs)
{
+ const char *name = bdrv_get_device_name(bs);
const char *input = opaque;
if (input[0] == '\0' ||
[Qemu-devel] [PATCH 01/17] block: Polish error handling of brdv_open2, Jan Kiszka, 2009/02/07
[Qemu-devel] [PATCH 09/17] monitor: Simplify password input mode, Jan Kiszka, 2009/02/07
[Qemu-devel] [PATCH 10/17] monitor: Rework terminal management, Jan Kiszka, 2009/02/07
[Qemu-devel] [PATCH 15/17] monitor: Improve mux'ed console experience, Jan Kiszka, 2009/02/07
[Qemu-devel] [PATCH 16/17] monitor: Introduce MONITOR_USE_READLINE flag, Jan Kiszka, 2009/02/07
[Qemu-devel] [PATCH 14/17] monitor: Decouple terminals, Jan Kiszka, 2009/02/07