[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 01/14] contrib: add ivshmem client and server
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 01/14] contrib: add ivshmem client and server |
Date: |
Tue, 02 Sep 2014 14:20:32 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
On 09/02/2014 09:25 AM, David Marchand wrote:
> When using ivshmem devices, notifications between guests can be sent as
> interrupts using a ivshmem-server (typical use described in documentation).
> The client is provided as a debug tool.
>
> Signed-off-by: Olivier Matz <address@hidden>
> Signed-off-by: David Marchand <address@hidden>
> ---
> +/* parse the size of shm */
> +static int
> +parse_size(const char *val_str, size_t *val)
> +{
> + char *endptr;
> + unsigned long long tmp;
> +
> + errno = 0;
> + tmp = strtoull(val_str, &endptr, 0);
> + if ((errno == ERANGE && tmp == ULLONG_MAX) || (errno != 0 && tmp == 0)) {
> + return -1;
> + }
This is overly complex; usually, this is just done as:
if (errno)
return -1;
> +/* parse an unsigned int */
> +static int
> +parse_uint(const char *val_str, unsigned *val)
> +{
> + char *endptr;
> + unsigned long tmp;
> +
> + errno = 0;
> + tmp = strtoul(val_str, &endptr, 0);
> + if ((errno == ERANGE && tmp == ULONG_MAX) || (errno != 0 && tmp == 0)) {
> + return -1;
> + }
and again
> + if (endptr == val_str || endptr[0] != '\0') {
> + return -1;
> + }
> + *val = tmp;
> + return 0;
> +}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v4 00/14] ivshmem: update documentation, add client/server tools, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 02/14] docs: update ivshmem device spec, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 03/14] contrib/ivshmem-*: comply with QEMU coding style, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 04/14] contrib/ivshmem-*: reuse qemu/queue.h, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 01/14] contrib: add ivshmem client and server, David Marchand, 2014/09/02
- Re: [Qemu-devel] [PATCH v4 01/14] contrib: add ivshmem client and server,
Eric Blake <=
- [Qemu-devel] [PATCH v4 05/14] contrib/ivshmem-*: switch to QEMU headers, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 06/14] contrib/ivshmem-server: set client sockets as non blocking, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 08/14] contrib/ivshmem-*: plug client and server in QEMU top Makefile, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 07/14] contrib/ivshmem-*: add missing const and static attrs, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 09/14] contrib/ivshmem-*: switch to g_malloc0/g_free, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 10/14] contrib/ivshmem-server: fix mem leak on error, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 11/14] contrib/ivshmem-*: rework error handling, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 12/14] contrib/ivshmem-*: various fixes, David Marchand, 2014/09/02
- [Qemu-devel] [PATCH v4 13/14] contrib/ivshmem-server: align server default parameter values, David Marchand, 2014/09/02