Received: from eggs.gnu.org ([208.118.235.92]:44220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T21dn-0001R4-HG for qemu-devel@nongnu.org; Thu, 16 Aug 2012 11:05:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T21di-0003nT-TA for qemu-devel@nongnu.org; Thu, 16 Aug 2012 11:05:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T21di-0003m3-JN for qemu-devel@nongnu.org; Thu, 16 Aug 2012 11:05:38 -0400 From: Markus Armbruster References: <1345124754-4173-1-git-send-email-peter.maydell@linaro.org> <871uj7diz7.fsf@blackfin.pond.sub.org> Date: Thu, 16 Aug 2012 17:05:31 +0200 In-Reply-To: (Peter Maydell's message of "Thu, 16 Aug 2012 15:26:07 +0100") Message-ID: <87fw7m98sk.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 0/3] Drop default SD card creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , Paul Brook , qemu-devel@nongnu.org, patches@linaro.org Peter Maydell writes: > On 16 August 2012 15:11, Markus Armbruster wrote: >> Peter Maydell writes: >>> As suggested in the recent discussion on Markus' patchset to suppress >>> unused default drives, this patchset cleans up the omap and pxa2xx >>> SD card controllers to behave like the other controllers: >>> * the init function looks for the next IF_SD drive >>> * if there isn't one, we start up as a controller with no card >>> present > >> Isn't this an incompatible change? Before, you get an SD card reader >> backed by an empty BDS default. You can load/unload cards in the >> monitor. After, you get an SD card reader that isn't backed by a BDS by >> default. Device models prepared for that can treat it as permanently >> empty. > > Hmm, yes, but most of our SD controllers already act that way. > We should probably fix them all... > > So what's the block layer equivalent of drive_get_next() that always > returns us something we can get a bdrv from? I figure you need a variant of drive_get(type, bus, unit) that creates and returns a default drive instead of null when 1. the user didn't suppress default drives with -nodefaults, and 2. (type, index) are (IF_FLOPPY, 0), (use_scsi ? IF_SCSI : IF_IDE, 2), or (IF_SD, 0), where index satisfies drive_index_to_bus_id(type, index) == bus and drive_index_to_unit_id(type, index) == unit. Happy coding :) PS: I hate drive_get_next(), because it makes which device model gets which drive depend on initialization order.