qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-char: Convert socket char backend to parse


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] qemu-char: Convert socket char backend to parse/kind
Date: Mon, 23 Jun 2014 14:05:23 +0100

On 23 June 2014 13:49, Markus Armbruster <address@hidden> wrote:
> Peter Maydell <address@hidden> writes:
>
>> Convert the socket char backend to the new style QAPI framework;
>> this allows it to return an Error ** to callers who might not
>> want it to print directly about socket failures.
>>
>> Signed-off-by: Peter Maydell <address@hidden>
>> ---
>> I'm not 100% sure I have this correct -- review from somebody
>> who understands the char backends appreciated!
>
> Not sure anybody really understands this mess, but I can try.

Thanks.

>> +    addr = g_new0(SocketAddress, 1);
>> +    if (path) {
>> +        addr->kind = SOCKET_ADDRESS_KIND_UNIX;
>
> Missing:
>
>            addr->q_unix = g_new(UnixSocketAddress, 1);
>
> See also socket_parse().

Heh, yes. You can tell I didn't test this code path ;-)

>> +        addr->q_unix->path = g_strdup(path);
>> +    } else {
>> +        addr->kind = SOCKET_ADDRESS_KIND_INET;
>> +        addr->inet = g_new0(InetSocketAddress, 1);
>> +        addr->inet->host = g_strdup(host);
>> +        addr->inet->port = g_strdup(port);
>> +        addr->inet->to = qemu_opt_get_number(opts, "to", 0);
>> +        addr->inet->has_to = true;
>> +        if (qemu_opt_get_bool(opts, "ipv4", 0)) {
>> +            addr->inet->has_ipv4 = addr->inet->ipv4 = true;
>> +        }
>> +        if (qemu_opt_get_bool(opts, "ipv6", 0)) {
>> +            addr->inet->has_ipv6 = addr->inet->ipv6 = true;
>> +        }
>> +    }
>> +    backend->socket->addr = addr;
>> +}
>> +
>>  typedef struct CharDriver {
>>      const char *name;
>>      /* old, pre qapi */
>> @@ -4064,7 +4064,8 @@ void qmp_chardev_remove(const char *id, Error **errp)
>>  static void register_types(void)
>>  {
>>      register_char_driver_qapi("null", CHARDEV_BACKEND_KIND_NULL, NULL);
>> -    register_char_driver("socket", qemu_chr_open_socket);
>> +    register_char_driver_qapi("socket", CHARDEV_BACKEND_KIND_SOCKET,
>> +                              qemu_chr_parse_socket);
>>      register_char_driver("udp", qemu_chr_open_udp);
>>      register_char_driver_qapi("ringbuf", CHARDEV_BACKEND_KIND_RINGBUF,
>>                                qemu_chr_parse_ringbuf);
>
> Only one old-style driver left: "udp".  It's closely related to
> "socket"...  would you be willing to take care of that one, too?

Yeah, I noticed that too; I figured I'd get this patch
through review first, though.

thanks
-- PMM



reply via email to

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