qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 03/10] QMP: query-block: Add the 'tray-open' key


From: Luiz Capitulino
Subject: [Qemu-devel] [RFC 03/10] QMP: query-block: Add the 'tray-open' key
Date: Fri, 3 Jun 2011 16:03:55 -0300

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]