From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTb0l-0007Uu-Be for qemu-devel@nongnu.org; Mon, 06 Jun 2011 10:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTb0k-0006Gx-4O for qemu-devel@nongnu.org; Mon, 06 Jun 2011 10:42:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTawR-0005Zy-P1 for qemu-devel@nongnu.org; Mon, 06 Jun 2011 10:38:08 -0400 Date: Mon, 6 Jun 2011 11:38:03 -0300 From: Luiz Capitulino Message-ID: <20110606113803.68d5312a@doriath> In-Reply-To: <20110606114032.GA8114@amit-x200.redhat.com> References: <1307127842-12102-1-git-send-email-lcapitulino@redhat.com> <1307127842-12102-6-git-send-email-lcapitulino@redhat.com> <20110606114032.GA8114@amit-x200.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 05/10] QMP: Introduce the blockdev-tray-open command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: kwolf@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com On Mon, 6 Jun 2011 17:10:32 +0530 Amit Shah wrote: > On (Fri) 03 Jun 2011 [16:03:57], Luiz Capitulino wrote: > > > +static int tray_open(const char *device, int remove, int force) > > +{ > > + BlockDriverState *bs; > > + > > + bs = bdrv_removable_find(device); > > + if (!bs) { > > + return -1; > > + } > > + > > + if (bdrv_eject(bs, 1, force) < 0) { > > + /* FIXME: will report undefined error in QMP */ > > + return -1; > > + } > > + > > + if (remove) { > > + bdrv_close(bs); > > + } > > + > > + return 0; > > +} > > What's the reason to tie the 'remove' with tray open? In my first try I had a command called 'blockdev-media-remove', but then I had the impression that I was going too far as the only reason a client would ever want to open the tray is to remove the media. > Won't it be > simpler to have it separated out, perhaps a 'change' event instead of > 'insert' that can accept NULL which means just remove medium? You meant 'command' instead of 'event', right? I don't think a change command makes sense, because it's just a shortcut to open/remove/insert/close.