qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/6] spice: add chardev (v4)


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 6/6] spice: add chardev (v4)
Date: Tue, 11 Jan 2011 17:08:48 +0000

On Tue, Jan 11, 2011 at 12:08 PM, Gerd Hoffmann <address@hidden> wrote:
> From: Alon Levy <address@hidden>
>
> Adding a chardev backend for spice, where spice determines what
> to do with it based on the name attribute given during chardev creation.
> For usage by spice vdagent in conjunction with a properly named
> virtio-serial device, and future smartcard channel usage.
>
> Example usage:
>  qemu -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent \
>  -device virtserialport,chardev=vdagent,name=com.redhat.spice.0
>
> v3->v4:
>  * updated commit message
>
> v1->v3 changes: (v2 had a wrong commit message)
>  * removed spice-qemu-char.h, folded into ui/qemu-spice.h
>  * removed dead IOCTL code
>  * removed comment
>  * removed ifdef CONFIG_SPICE from qemu-config.c and qemu-options.hx help.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  Makefile.objs     |    2 +-
>  qemu-char.c       |    4 +
>  qemu-config.c     |    6 ++
>  qemu-options.hx   |   16 ++++-
>  spice-qemu-char.c |  185 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  ui/qemu-spice.h   |    3 +
>  6 files changed, 214 insertions(+), 2 deletions(-)
>  create mode 100644 spice-qemu-char.c
>
> diff --git a/Makefile.objs b/Makefile.objs
> index c3e52c5..b9e9ef6 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -105,7 +105,7 @@ common-obj-$(CONFIG_BRLAPI) += baum.o
>  common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o 
> migration-fd.o
>  common-obj-$(CONFIG_WIN32) += version.o
>
> -common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o 
> ui/spice-display.o
> +common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o 
> ui/spice-display.o spice-qemu-char.o
>
>  audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
>  audio-obj-$(CONFIG_SDL) += sdlaudio.o
> diff --git a/qemu-char.c b/qemu-char.c
> index edc9ad6..acc7130 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -97,6 +97,7 @@
>  #endif
>
>  #include "qemu_socket.h"
> +#include "ui/qemu-spice.h"
>
>  #define READ_BUF_LEN 4096
>
> @@ -2495,6 +2496,9 @@ static const struct {
>     || defined(__FreeBSD_kernel__)
>     { .name = "parport",   .open = qemu_chr_open_pp },
>  #endif
> +#ifdef CONFIG_SPICE
> +    { .name = "spicevmc",     .open = qemu_chr_open_spice },
> +#endif
>  };
>
>  CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
> diff --git a/qemu-config.c b/qemu-config.c
> index 965fa46..323d3c2 100644
> --- a/qemu-config.c
> +++ b/qemu-config.c
> @@ -146,6 +146,12 @@ static QemuOptsList qemu_chardev_opts = {
>         },{
>             .name = "signal",
>             .type = QEMU_OPT_BOOL,
> +        },{
> +            .name = "name",
> +            .type = QEMU_OPT_STRING,
> +        },{
> +            .name = "debug",
> +            .type = QEMU_OPT_NUMBER,
>         },
>         { /* end of list */ }
>     },
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 898561d..e0b76bd 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1368,6 +1368,9 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
>  #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
>     "-chardev parport,id=id,path=path[,mux=on|off]\n"
>  #endif
> +#if defined(CONFIG_SPICE)
> +    "-chardev spicevmc,id=id,debug=debug,name=name\n"
> +#endif
>     , QEMU_ARCH_ALL
>  )
>
> @@ -1392,7 +1395,8 @@ Backend is one of:
> address@hidden,
> address@hidden,
> address@hidden,
> address@hidden
> address@hidden

Missing a comma.

> address@hidden
>  The specific backend will determine the applicable options.
>
>  All devices must have an id, which can be any string up to 127 characters 
> long.
> @@ -1568,6 +1572,16 @@ Connect to a local parallel port.
> address@hidden specifies the path to the parallel port device. @option{path} 
> is
>  required.
>
> +#if defined(CONFIG_SPICE)
> address@hidden -chardev spicevmc ,address@hidden ,address@hidden, 
> address@hidden
> +
> address@hidden debug level for spicevmc
> +
> address@hidden name of spice channel to connect to
> +
> +Connect to a spice virtual machine channel, such as vdiport.
> +#endif
> +
> address@hidden table
>  ETEXI
>
> diff --git a/spice-qemu-char.c b/spice-qemu-char.c
> new file mode 100644
> index 0000000..0ffa674
> --- /dev/null
> +++ b/spice-qemu-char.c
> @@ -0,0 +1,185 @@
> +#include "config-host.h"
> +#include "ui/qemu-spice.h"
> +#include <spice.h>
> +#include <spice-experimental.h>
> +
> +#include "osdep.h"
> +
> +#define dprintf(_scd, _level, _fmt, ...)                                \
> +    do {                                                                \
> +        static unsigned __dprintf_counter = 0;                          \
> +        if (_scd->debug >= _level) {                                    \
> +            fprintf(stderr, "scd: %3d: " _fmt, ++__dprintf_counter, ## 
> __VA_ARGS__);\
> +        }                                                               \
> +    } while (0)

Tracepoints?



reply via email to

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