qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/21] qemu-char: convert pipe backend to data-d


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 07/21] qemu-char: convert pipe backend to data-driven creation
Date: Mon, 12 Oct 2015 09:16:37 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/12/2015 02:03 AM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  qemu-char.c | 37 +++++++++++++++++++++----------------
>  1 file changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 84cb8d0..3545cd8 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -1078,18 +1078,17 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, 
> int fd_out)
>      return chr;
>  }
>  
> -static CharDriverState *qemu_chr_open_pipe(ChardevHostdev *opts)
> +static CharDriverState *qemu_chr_open_pipe(const char *id,
> +                                           ChardevBackend *backend,
> +                                           ChardevReturn *ret,
> +                                           Error **errp)
>  {
> +    ChardevHostdev *opts = backend->pipe;
>      int fd_in, fd_out;
>      char filename_in[CHR_MAX_FILENAME_SIZE];
>      char filename_out[CHR_MAX_FILENAME_SIZE];
>      const char *filename = opts->device;
>  
> -    if (filename == NULL) {
> -        fprintf(stderr, "chardev: pipe: no filename given\n");
> -        return NULL;
> -    }
> -
>      snprintf(filename_in, CHR_MAX_FILENAME_SIZE, "%s.in", filename);

Do we need assert(filename) here?


> @@ -2096,12 +2097,12 @@ static int win_chr_pipe_init(CharDriverState *chr, 
> const char *filename)
>  
>      s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
>      if (!s->hsend) {
> -        fprintf(stderr, "Failed CreateEvent\n");
> +        error_setg(errp, "Failed CreateEvent\n");
>          goto fail;
>      }
>      s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL);
>      if (!s->hrecv) {
> -        fprintf(stderr, "Failed CreateEvent\n");
> +        error_setg(errp, "Failed CreateEvent\n");
>          goto fail;

Drop the trailing \n, here and throughout this file

> @@ -4277,7 +4282,7 @@ ChardevReturn *qmp_chardev_add(const char *id, 
> ChardevBackend *backend,
>              abort();
>              break;
>          case CHARDEV_BACKEND_KIND_PIPE:
> -            chr = qemu_chr_open_pipe(backend->pipe);
> +            abort();
>              break;

another dead break


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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