qemu-devel
[Top][All Lists]
Advanced

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

[PATCH v3 7/9] qmp: add chardev-resize command


From: Szymon Lukasz
Subject: [PATCH v3 7/9] qmp: add chardev-resize command
Date: Mon, 29 Jun 2020 18:40:39 +0200

The managment software can use this command to notify QEMU about the
size of the terminal connected to a chardev, QEMU can then forward this
information to the guest if the chardev is connected to a virtio console
device.

Signed-off-by: Szymon Lukasz <noh4hss@gmail.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
---
 chardev/char.c | 14 ++++++++++++++
 qapi/char.json | 25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/chardev/char.c b/chardev/char.c
index 1dc22aca95..c1bdfc8b5f 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -1182,6 +1182,20 @@ void qmp_chardev_send_break(const char *id, Error **errp)
     qemu_chr_be_event(chr, CHR_EVENT_BREAK);
 }
 
+void qmp_chardev_resize(const char *id, uint16_t cols, uint16_t rows,
+                        Error **errp)
+{
+    Chardev *chr;
+
+    chr = qemu_chr_find(id);
+    if (chr == NULL) {
+        error_setg(errp, "Chardev '%s' not found", id);
+        return;
+    }
+
+    qemu_chr_resize(chr, cols, rows);
+}
+
 /*
  * Add a timeout callback for the chardev (in milliseconds), return
  * the GSource object created. Please use this to add timeout hook for
diff --git a/qapi/char.json b/qapi/char.json
index daceb20f84..dc2d6cab22 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -573,3 +573,28 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+
+##
+# @chardev-resize:
+#
+# Notifies a chardev about the current size of the terminal connected
+# to this chardev.
+#
+# @id: the chardev's ID, must exist
+# @cols: the number of columns
+# @rows: the number of rows
+#
+# Returns: Nothing on success
+#
+# Since: 5.1
+#
+# Example:
+#
+# -> { "execute": "chardev-resize", "arguments": { "id": "foo", "cols": 80, 
"rows": 24 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'chardev-resize',
+  'data': { 'id': 'str',
+            'cols': 'uint16',
+            'rows': 'uint16' } }
-- 
2.27.0




reply via email to

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