提交 2f399b0a 编写于 作者: M Markus Armbruster 提交者: Kevin Wolf

block: New bdrv_next()

This is a more flexible alternative to bdrv_iterate().
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 ac59eb95
...@@ -1330,6 +1330,14 @@ BlockDriverState *bdrv_find(const char *name) ...@@ -1330,6 +1330,14 @@ BlockDriverState *bdrv_find(const char *name)
return NULL; return NULL;
} }
BlockDriverState *bdrv_next(BlockDriverState *bs)
{
if (!bs) {
return QTAILQ_FIRST(&bdrv_states);
}
return QTAILQ_NEXT(bs, list);
}
void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void *opaque) void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void *opaque)
{ {
BlockDriverState *bs; BlockDriverState *bs;
......
...@@ -168,6 +168,7 @@ void bdrv_set_change_cb(BlockDriverState *bs, ...@@ -168,6 +168,7 @@ void bdrv_set_change_cb(BlockDriverState *bs,
void (*change_cb)(void *opaque), void *opaque); void (*change_cb)(void *opaque), void *opaque);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size); void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
BlockDriverState *bdrv_find(const char *name); BlockDriverState *bdrv_find(const char *name);
BlockDriverState *bdrv_next(BlockDriverState *bs);
void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs),
void *opaque); void *opaque);
int bdrv_is_encrypted(BlockDriverState *bs); int bdrv_is_encrypted(BlockDriverState *bs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册