From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkZTP-000513-3G for qemu-devel@nongnu.org; Wed, 14 May 2014 09:44:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkZTK-0006MQ-9j for qemu-devel@nongnu.org; Wed, 14 May 2014 09:43:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkZTK-0006MM-1g for qemu-devel@nongnu.org; Wed, 14 May 2014 09:43:50 -0400 Date: Wed, 14 May 2014 09:43:38 -0400 From: Jeff Cody Message-ID: <20140514134338.GE8452@localhost.localdomain> References: <1399662217-31148-1-git-send-email-stefanha@redhat.com> <1399662217-31148-4-git-send-email-stefanha@redhat.com> <20140513161849.08628e6c.cornelia.huck@de.ibm.com> <20140514123548.GB16683@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PULL 03/17] qemu-img: sort block formats in help message List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mike Day Cc: Cornelia Huck , Stefan Hajnoczi , "qemu-devel@nongnu.org" , Stefan Hajnoczi , Peter Maydell On Wed, May 14, 2014 at 09:27:31AM -0400, Mike Day wrote: > On Wed, May 14, 2014 at 8:35 AM, Stefan Hajnoczi 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