diff options
author | Max Reitz <mreitz@redhat.com> | 2016-10-12 22:49:06 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2016-11-11 15:56:22 +0100 |
commit | eb0df69f50bd64454bcb9457e875cd52f00dced8 (patch) | |
tree | 68c5398095526870adb14bbf0e8f6a7b21401c78 /block.c | |
parent | ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9 (diff) | |
download | qemu-eb0df69f50bd64454bcb9457e875cd52f00dced8.zip qemu-eb0df69f50bd64454bcb9457e875cd52f00dced8.tar.gz qemu-eb0df69f50bd64454bcb9457e875cd52f00dced8.tar.bz2 |
block: Emit modules in bdrv_iterate_format()
Some block drivers may not be loaded yet, but qemu supports them
nonetheless. bdrv_iterate_format() should report them, too.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161012204907.25941-3-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -2822,6 +2822,24 @@ void bdrv_iterate_format(void (*it)(void *opaque, const char *name), } } + for (i = 0; i < (int)ARRAY_SIZE(block_driver_modules); i++) { + const char *format_name = block_driver_modules[i].format_name; + + if (format_name) { + bool found = false; + int j = count; + + while (formats && j && !found) { + found = !strcmp(formats[--j], format_name); + } + + if (!found) { + formats = g_renew(const char *, formats, count + 1); + formats[count++] = format_name; + } + } + } + qsort(formats, count, sizeof(formats[0]), qsort_strcmp); for (i = 0; i < count; i++) { |