[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-1.4 09/12] qemu-char: Redo chardev "memory" size
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH for-1.4 09/12] qemu-char: Redo chardev "memory" size configuration |
Date: |
Tue, 5 Feb 2013 17:22:12 +0100 |
New device, has never been released, so we can still improve things
without worrying about compatibility:
* Rename parameter from maxcapacity to size (simple words are good for
you).
* Clearly mark the parameter as optional in documentation.
* Support suffixed size arguments like "size=64K",
* Fix chardev-add to report errors to current monitor, not stderr.
Signed-off-by: Markus Armbruster <address@hidden>
---
qemu-char.c | 11 +++++------
qemu-options.hx | 11 ++++-------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index ab011c6..8972bfd 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 */
@@ -2716,14 +2715,14 @@ static CharDriverState
*qemu_chr_open_cirmemchr(QemuOpts *opts)
chr = g_malloc0(sizeof(CharDriverState));
d = g_malloc(sizeof(*d));
- d->size = qemu_opt_get_number(opts, "maxcapacity", 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 */
if (d->size & (d->size - 1)) {
- fprintf(stderr, "chardev: size of memory device must be power of 2\n");
+ error_report("size of memory device must be power of 2");
goto fail;
}
@@ -3243,8 +3242,8 @@ QemuOptsList qemu_chardev_opts = {
.name = "debug",
.type = QEMU_OPT_NUMBER,
},{
- .name = "maxcapacity",
- .type = QEMU_OPT_NUMBER,
+ .name = "size",
+ .type = QEMU_OPT_SIZE,
},
{ /* end of list */ }
},
diff --git a/qemu-options.hx b/qemu-options.hx
index 2d44137..fb7592f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1736,7 +1736,7 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
"-chardev msmouse,id=id[,mux=on|off]\n"
"-chardev
vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
" [,mux=on|off]\n"
- "-chardev memory,id=id,maxcapacity=maxcapacity\n"
+ "-chardev memory,id=id[,size=size]\n"
"-chardev file,id=id,path=path[,mux=on|off]\n"
"-chardev pipe,id=id,path=path[,mux=on|off]\n"
#ifdef _WIN32
@@ -1887,13 +1887,10 @@ the console, in pixels.
@option{cols} and @option{rows} specify that the console be sized to fit a text
console with the given dimensions.
address@hidden -chardev memory ,address@hidden ,address@hidden
address@hidden -chardev memory ,address@hidden [,address@hidden
-Create a circular buffer with fixed size indicated by optionally
@option{maxcapacity}
-which will be default 64K if it is not given.
-
address@hidden specifies the max capacity of the size of circular buffer
-to create. Should be power of 2.
+Create a circular memory buffer with fixed size @option{size}.
address@hidden must be a power of 2, and defaults to @code{64K}).
@item -chardev file ,address@hidden ,address@hidden
--
1.7.11.7
- Re: [Qemu-devel] [PATCH for-1.4 01/12] qmp: Fix design bug and read beyond buffer in memchar-write, (continued)
Re: [Qemu-devel] [PATCH for-1.4 01/12] qmp: Fix design bug and read beyond buffer in memchar-write, Luiz Capitulino, 2013/02/06
[Qemu-devel] [PATCH for-1.4 08/12] qemu-char: Drop undocumented chardev "memory" compatibility syntax, Markus Armbruster, 2013/02/05
[Qemu-devel] [PATCH for-1.4 09/12] qemu-char: Redo chardev "memory" size configuration,
Markus Armbruster <=
[Qemu-devel] [PATCH for-1.4 12/12] QAPI QMP HMP: Fix and improve memchar-read/-write docs, Markus Armbruster, 2013/02/05
[Qemu-devel] [PATCH for-1.4 11/12] qmp: Use generic errors in memchar-read, memchar-write, Markus Armbruster, 2013/02/05
[Qemu-devel] [PATCH for-1.4 10/12] qemu-char: General chardev "memory" code cleanup, Markus Armbruster, 2013/02/05
Re: [Qemu-devel] [PATCH for-1.4 00/12] Fix memchar-read/-write before API gets released, Luiz Capitulino, 2013/02/06
Re: [Qemu-devel] [PATCH for-1.4 00/12] Fix memchar-read/-write before API gets released, Anthony Liguori, 2013/02/06