From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGZH1-0004Kt-T2 for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:31:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGZGy-0007kA-MV for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:31:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGZGy-0007k2-G6 for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:31:36 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0SKVZLa021987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 28 Jan 2015 15:31:36 -0500 Message-ID: <54C93FC4.60904@redhat.com> Date: Wed, 28 Jan 2015 15:00:04 -0500 From: Max Reitz MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-40-git-send-email-mreitz@redhat.com> <54C93F76.8090905@redhat.com> In-Reply-To: <54C93F76.8090905@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RESEND 39/50] blockdev: Add blockdev-close-tray List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , John Snow On 2015-01-28 at 14:58, Eric Blake wrote: > On 01/27/2015 12:46 PM, Max Reitz wrote: >> Signed-off-by: Max Reitz >> --- >> blockdev.c | 22 ++++++++++++++++++++++ >> qapi/block-core.json | 14 ++++++++++++++ >> qmp-commands.hx | 33 +++++++++++++++++++++++++++++++++ >> 3 files changed, 69 insertions(+) >> >> +void qmp_blockdev_close_tray(const char *device, Error **errp) >> +{ >> + BlockBackend *blk; >> + >> + blk = blk_by_name(device); >> + if (!blk) { >> + error_set(errp, QERR_DEVICE_NOT_FOUND, device); >> + return; >> + } >> + >> + if (!blk_dev_has_removable_media(blk)) { >> + error_setg(errp, "Device '%s' is not removable", device); >> + return; >> + } >> + >> + if (!blk_dev_is_tray_open(blk)) { >> + return; >> + } > Is it worth documenting that this (and the one in 38/50) are intentional > no-ops if the tray is already in the desired state? There's certainly no harm in documenting it, so I might as well just do it. Max > Reviewed-by: Eric Blake