@@ -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 */ }
},
@@ -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.
-@item -chardev memory ,id=@var{id} ,maxcapacity=@var{maxcapacity}
+@item -chardev memory ,id=@var{id} [,size=@var{size}]
-Create a circular buffer with fixed size indicated by optionally @option{maxcapacity}
-which will be default 64K if it is not given.
-
-@option{maxcapacity} 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}.
+@var{size} must be a power of 2, and defaults to @code{64K}).
@item -chardev file ,id=@var{id} ,path=@var{path}
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 <armbru@redhat.com> --- qemu-char.c | 11 +++++------ qemu-options.hx | 11 ++++------- 2 files changed, 9 insertions(+), 13 deletions(-)