Patchwork [for-1.4,v2,12/13] qemu-char: Support suffixed ringbuf size arguments like "size=64K"

login
register
mail settings
Submitter Markus Armbruster
Date Feb. 6, 2013, 8:27 p.m.
Message ID <1360182446-1502-13-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/218753/
State New
Headers show

Comments

Markus Armbruster - Feb. 6, 2013, 8:27 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qemu-char.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 8a35403..a3ba021 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -98,7 +98,6 @@ 
 #include "ui/qemu-spice.h"
 
 #define READ_BUF_LEN 4096
-#define CBUFF_SIZE 65536
 
 /***********************************************************/
 /* character device */
@@ -2709,9 +2708,9 @@  static CharDriverState *qemu_chr_open_ringbuf(QemuOpts *opts)
     chr = g_malloc0(sizeof(CharDriverState));
     d = g_malloc(sizeof(*d));
 
-    d->size = qemu_opt_get_number(opts, "size", 0);
+    d->size = qemu_opt_get_size(opts, "size", 0);
     if (d->size == 0) {
-        d->size = CBUFF_SIZE;
+        d->size = 65536;
     }
 
     /* The size must be power of 2 */
@@ -3244,7 +3243,7 @@  QemuOptsList qemu_chardev_opts = {
             .type = QEMU_OPT_NUMBER,
         },{
             .name = "size",
-            .type = QEMU_OPT_NUMBER,
+            .type = QEMU_OPT_SIZE,
         },
         { /* end of list */ }
     },