qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/6] Expose MemCharDriver via command line


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 6/6] Expose MemCharDriver via command line
Date: Fri, 31 Aug 2012 09:02:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Lei Li <address@hidden> writes:

> Signed-off-by: Lei Li <address@hidden>
> ---
>  qemu-char.c     |   24 ++++++++++++++++++++++++
>  qemu-config.c   |    3 +++
>  qemu-options.hx |   10 ++++++++++
>  3 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index ff6651b..36f4ecc 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -99,6 +99,7 @@
>  #include "ui/qemu-spice.h"
>  
>  #define READ_BUF_LEN 4096
> +#define CBUFF_SIZE 65536
>  
>  /***********************************************************/
>  /* character device */
> @@ -2647,6 +2648,23 @@ size_t qemu_chr_mem_osize(const CharDriverState *chr)
>      return d->cbuf_count;
>  }
>  
> +static CharDriverState *qemu_chr_open_memchr(QemuOpts *opts)
> +{
> +    CharDriverState *chr;
> +    size_t capacity;
> +
> +    chr = g_malloc0(sizeof(CharDriverState));
> +
> +    capacity = qemu_opt_get_number(opts, "maxcapacity", 0);
> +    if (capacity == 0) {
> +        capacity = CBUFF_SIZE;
> +    }
> +
> +    qemu_chr_init_mem(chr, capacity);
> +
> +    return chr;
> +}
> +
>  void qmp_memchar_write(const char *chardev, int64_t size,
>                         const char *data, bool has_format,
>                         enum DataFormat format,
> @@ -2779,6 +2797,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, 
> const char *filename)
>          qemu_opt_set(opts, "path", p);
>          return opts;
>      }
> +    if (strstart(filename, "memchr", &p)) {
> +        qemu_opt_set(opts, "backend", "memchr");
> +        qemu_opt_set(opts, "maxcapacity", p);
> +        return opts;
> +    }
>      if (strstart(filename, "tcp:", &p) ||
>          strstart(filename, "telnet:", &p)) {
>          if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
> @@ -2852,6 +2875,7 @@ static const struct {
>      { .name = "udp",       .open = qemu_chr_open_udp },
>      { .name = "msmouse",   .open = qemu_chr_open_msmouse },
>      { .name = "vc",        .open = text_console_init },
> +    { .name = "memchr",    .open = qemu_chr_open_memchr },
>  #ifdef _WIN32
>      { .name = "file",      .open = qemu_chr_open_win_file_out },
>      { .name = "pipe",      .open = qemu_chr_open_win_pipe },

Is extending the legacy syntax worthwhile?

[...]



reply via email to

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