From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1Ccy-0004h5-JU for qemu-devel@nongnu.org; Wed, 07 Sep 2011 03:32:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1Ccx-0008VK-JE for qemu-devel@nongnu.org; Wed, 07 Sep 2011 03:32:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1Ccx-0008VB-9M for qemu-devel@nongnu.org; Wed, 07 Sep 2011 03:32:55 -0400 Message-ID: <4E671ED3.6060500@redhat.com> Date: Wed, 07 Sep 2011 09:35:47 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1315328340-6192-1-git-send-email-armbru@redhat.com> <1315328340-6192-18-git-send-email-armbru@redhat.com> <4E6719BB.802@redhat.com> In-Reply-To: <4E6719BB.802@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 17/27] ide/atapi: Preserve tray state on migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, Markus Armbruster , lcapitulino@redhat.com, hare@suse.de, amit.shah@redhat.com, hch@lst.de Am 07.09.2011 09:14, schrieb Paolo Bonzini: > On 09/06/2011 06:58 PM, Markus Armbruster wrote: >> Use a subsection, so that migration to older version still works, >> provided the tray is closed and unlocked. >> >> Signed-off-by: Markus Armbruster >> --- >> hw/ide/core.c | 32 ++++++++++++++++++++++++++++++++ >> 1 files changed, 32 insertions(+), 0 deletions(-) >> >> diff --git a/hw/ide/core.c b/hw/ide/core.c >> index b1a73ee..30cb7de 100644 >> --- a/hw/ide/core.c >> +++ b/hw/ide/core.c >> @@ -2058,6 +2058,22 @@ static bool ide_drive_pio_state_needed(void *opaque) >> || (s->bus->error_status& BM_STATUS_PIO_RETRY); >> } >> >> +static int ide_tray_state_post_load(void *opaque, int version_id) >> +{ >> + IDEState *s = opaque; >> + >> + bdrv_eject(s->bs, s->tray_open); >> + bdrv_lock_medium(s->bs, s->tray_locked); >> + return 0; >> +} >> + >> +static bool ide_tray_state_needed(void *opaque) >> +{ >> + IDEState *s = opaque; >> + >> + return s->tray_open || s->tray_locked; > > I wonder if the most common case is this, or rather "tray closed and > locked". Perhaps it depends (for Windows it is likely unlocked, for > Linux locked). In any case there's time before 1.0 to fix this, so I would argue that the common case even for Linux is that you don't have a CD mounted (probably the drive is empty anyway). Kevin