Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8ZNP-0005BQ-Le for qemu-devel@nongnu.org; Mon, 25 May 2009 08:33:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8ZNL-00058S-7y for qemu-devel@nongnu.org; Mon, 25 May 2009 08:33:59 -0400 Received: from [199.232.76.173] (port=54706 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8ZNK-00058M-Sq for qemu-devel@nongnu.org; Mon, 25 May 2009 08:33:54 -0400 Received: from verein.lst.de ([213.95.11.210]:43060) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1M8ZNK-0000XT-BD for qemu-devel@nongnu.org; Mon, 25 May 2009 08:33:54 -0400 Date: Mon, 25 May 2009 14:33:52 +0200 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 3/4] raw-posix: split hdev drivers Message-ID: <20090525123352.GB16576@lst.de> References: <20090525075949.GC2936@lst.de> <4A1A7C1A.9050406@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A1A7C1A.9050406@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Christoph Hellwig , qemu-devel@nongnu.org On Mon, May 25, 2009 at 02:08:10PM +0300, Avi Kivity wrote: > >Instead of declaring one BlockDriver for all host devices declared one > >for each type: a generic one for normal disk devices, a Linux floppy > >driver and a CDROM driver for Linux and FreeBSD. This gets rid of a lot > >of messy ifdefs and switching based on the type in the various removal > >device methods. > > > >block.c grows a new method to find the correct host device driver based > >on OS-sepcific criteria. I would love to move this into some OS-dependant > >file but I don't think we have a place where it fits nicely yet. > > > > > > Add a ->probe_host_device() which accepts the filename (or maybe an fd) > as a parameter. First pass does a ->probe_host_device() for all drivers > that support it, second pass tries ->probe(). Yeah, we could probably do that. That means we could also move the is_windows_drive into raw-win32.c. > btw, ->probe_host_device() should use ioctls to identify the device, not > the device name, which is controlled by udev (on Linux) and therefore > nonstandard. At least the /dev/cdrom name is a symbolic overload in qemu and should always resolve to a cdrom device, if it's for some reason not present in the host namespace we need to do similar hacks as the windows raw driver.