On Wed, May 14, 2014 at 09:27:31AM -0400, Mike Day wrote:
> On Wed, May 14, 2014 at 8:35 AM, Stefan Hajnoczi <stefa...@gmail.com> wrote:
> > Jeff Cody recently wanted to eliminate duplicate entries in the list.  I
> > thought part of your intention was to address the duplicates with your
> > patch.
> >
> > We can back out the sequence API if it's not supported on older glib but
> > it would be nice to eliminate duplicates later, too.
> 
> I agree. I can submit an additional patch that uses an older API.
> What, exactly is the cause of duplicate entries in the list? I've only
> seen it one time but its disconcerting when it happens.
>

Some block drivers register multiple drivers for a given format name,
for instance, gluster:

https://github.com/qemu/qemu/blob/master/block/gluster.c#L818

    static void bdrv_gluster_init(void)
    {
        bdrv_register(&bdrv_gluster_rdma);
        bdrv_register(&bdrv_gluster_unix);
        bdrv_register(&bdrv_gluster_tcp);
        bdrv_register(&bdrv_gluster);
    }

Each of those drivers has a format_name of "gluster", in this example.

In qemu-img, it lists the supported formats by simply calling
bdrv_iterate_format(), which calls a callback function for each
format_name in the driver list.

Prior to a recent commit, this function did not make distinction on
duplicates.  As of commit e855e4fb7, duplicates are not longer printed
in the help message:

e855e4fb7: Ignore duplicate or NULL format_name in bdrv_iterate_format):

https://github.com/qemu/qemu/commit/e855e4fb7b97f7f605e1f44427b98022e39e6f8f#diff-ea36ba0f79150cc299732696a069caba

Reply via email to