diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2016-11-11 15:58:12 +0100 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2016-11-11 15:58:12 +0100 |
| commit | ff569b9424d1e6c7144dbe7d76ea50f5c11d4a1c (patch) | |
| tree | a882a3c2fb4b2fd7eac2e9e0463cf8a97c09cd6d /block.c | |
| parent | 07555ba6f303d4be8af538c3a66cc46ccb2e5751 (diff) | |
| parent | 4e6d13c9839915ba90d7d561c54cc10416c8c4bd (diff) | |
| download | focaccia-qemu-ff569b9424d1e6c7144dbe7d76ea50f5c11d4a1c.tar.gz focaccia-qemu-ff569b9424d1e6c7144dbe7d76ea50f5c11d4a1c.zip | |
Merge remote-tracking branch 'mreitz/tags/pull-block-2016-11-11' into queue-block
Block patches for qemu 2.8 # gpg: Signature made Fri Nov 11 15:56:59 2016 CET # gpg: using RSA key 0xF407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * mreitz/tags/pull-block-2016-11-11: raw-posix: Rename 'raw_s' to 'rs' iotests: Always use -machine accel=qtest iotests: Skip test 162 if there is no SSH support block: Emit modules in bdrv_iterate_format() block: Fix bdrv_iterate_format() sorting Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
| -rw-r--r-- | block.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/block.c b/block.c index c19c6c6d42..39ddea3411 100644 --- a/block.c +++ b/block.c @@ -2796,7 +2796,7 @@ const char *bdrv_get_format_name(BlockDriverState *bs) static int qsort_strcmp(const void *a, const void *b) { - return strcmp(a, b); + return strcmp(*(char *const *)a, *(char *const *)b); } void bdrv_iterate_format(void (*it)(void *opaque, const char *name), @@ -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++) { |