From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSZfM-0005cr-Vl for qemu-devel@nongnu.org; Fri, 03 Jun 2011 15:04:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QSZfL-0002Uc-8n for qemu-devel@nongnu.org; Fri, 03 Jun 2011 15:04:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSZfK-0002UU-Rb for qemu-devel@nongnu.org; Fri, 03 Jun 2011 15:04:15 -0400 From: Luiz Capitulino Date: Fri, 3 Jun 2011 16:03:55 -0300 Message-Id: <1307127842-12102-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1307127842-12102-1-git-send-email-lcapitulino@redhat.com> References: <1307127842-12102-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [RFC 03/10] QMP: query-block: Add the 'tray-open' key List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, amit.shah@redhat.com, aliguori@us.ibm.com, armbru@redhat.com As its name implies this new key informs the device's tray status to clients. It's only present if the device is a removable one. Signed-off-by: Luiz Capitulino --- block.c | 5 +++++ qmp-commands.hx | 2 ++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 959eedd..e1b9057 100644 --- a/block.c +++ b/block.c @@ -1740,6 +1740,11 @@ void bdrv_info(Monitor *mon, QObject **ret_data) bs->device_name, bs->removable, bs->locked); + if (bs->removable) { + QDict *dict = qobject_to_qdict(bs_obj); + qdict_put(dict, "tray-open", qbool_from_int(bs->tray_open)); + } + if (bs->drv) { QObject *obj; QDict *bs_dict = qobject_to_qdict(bs_obj); diff --git a/qmp-commands.hx b/qmp-commands.hx index a9f109a..8393f22 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1043,6 +1043,8 @@ Each json-object contain the following: - Possible values: "unknown" - "removable": true if the device is removable, false otherwise (json-bool) - "locked": true if the device is locked, false otherwise (json-bool) +- "tray-open": true if the device's tray is open, false otherwise. Only present + for removable media (json-bool) - "inserted": only present if the device is inserted, it is a json-object containing the following: - "file": device file name (json-string) -- 1.7.4.4