All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Hao QingFeng <haoqf@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 2/3] block: Emit modules in bdrv_iterate_format()
Date: Wed, 12 Oct 2016 22:49:06 +0200	[thread overview]
Message-ID: <20161012204907.25941-3-mreitz@redhat.com> (raw)
In-Reply-To: <20161012204907.25941-1-mreitz@redhat.com>

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>
---
 block.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/block.c b/block.c
index e46e4b2..88a1ea5 100644
--- a/block.c
+++ b/block.c
@@ -2815,6 +2815,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++) {
-- 
2.10.0

  parent reply	other threads:[~2016-10-12 20:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 20:49 [Qemu-devel] [PATCH 0/3] iotests: Skip 162 if there is no SSH support Max Reitz
2016-10-12 20:49 ` [Qemu-devel] [PATCH 1/3] block: Fix bdrv_iterate_format() sorting Max Reitz
2016-10-12 21:31   ` Eric Blake
2016-10-12 20:49 ` Max Reitz [this message]
2016-10-12 22:35   ` [Qemu-devel] [PATCH 2/3] block: Emit modules in bdrv_iterate_format() Eric Blake
2016-11-02 10:52   ` Hao QingFeng
2016-11-02 11:15     ` Kevin Wolf
2016-11-02 11:59       ` Hao QingFeng
2016-11-02 15:29       ` Eric Blake
2016-10-12 20:49 ` [Qemu-devel] [PATCH 3/3] iotests: Skip test 162 if there is no SSH support Max Reitz
2016-10-12 22:36   ` Eric Blake
2016-10-12 22:26 ` [Qemu-devel] [PATCH 0/3] iotests: Skip " no-reply
2016-10-28 15:13 ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161012204907.25941-3-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=haoqf@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.