From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTYAg-0004Bx-8I for qemu-devel@nongnu.org; Mon, 06 Jun 2011 07:40:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTYAe-0000mU-SY for qemu-devel@nongnu.org; Mon, 06 Jun 2011 07:40:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTYAe-0000mE-F8 for qemu-devel@nongnu.org; Mon, 06 Jun 2011 07:40:36 -0400 Date: Mon, 6 Jun 2011 17:10:32 +0530 From: Amit Shah Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1307127842-12102-6-git-send-email-lcapitulino@redhat.com> 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: Luiz Capitulino Cc: kwolf@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com 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? 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? Amit