From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55483 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe4Ft-0001wr-QB for qemu-devel@nongnu.org; Wed, 28 Jul 2010 06:52:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oe4Fs-00062M-Ka for qemu-devel@nongnu.org; Wed, 28 Jul 2010 06:52:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26052) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oe4Fs-00062H-CT for qemu-devel@nongnu.org; Wed, 28 Jul 2010 06:52:56 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6SAqtEE018354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Jul 2010 06:52:55 -0400 Message-ID: <4C500C07.8080706@redhat.com> Date: Wed, 28 Jul 2010 12:52:55 +0200 From: Kevin Wolf MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] block: Change bdrv_eject() not to drop the image List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Gleb Natapov Am 27.07.2010 14:02, schrieb Markus Armbruster: > bdrv_eject() gets called when a device model opens or closes the tray. > > If the block driver implements method bdrv_eject(), that method gets > called. Drivers host_cdrom implements it, and it opens and closes the > physical tray, and nothing else. When a device model opens, then > closes the tray, media changes only if the user actively changes the > physical media while the tray is open. This is matches how physical > hardware behaves. > > If the block driver doesn't implement method bdrv_eject(), we do > something quite different: opening the tray severs the connection to > the image by calling bdrv_close(), and closing the tray does nothing. > When the device model opens, then closes the tray, media is gone, > unless the user actively inserts another one while the tray is open, > with a suitable change command in the monitor. This isn't how > physical hardware behaves. Rather inconvenient when programs > "helpfully" eject media to give you a chance to change it. The way > bdrv_eject() behaves here turns that chance into a must, which is not > what these programs or their users expect. > > Change the default action not to call bdrv_close(). Instead, note the > tray status in new BlockDriverState member tray_open. Use it in > bdrv_is_inserted(). > > Arguably, the device models should keep track of tray status > themselves. But this is less invasive. > > Signed-off-by: Markus Armbruster Thanks, applied to the block branch. Kevin