qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Anand Avati <aavati@redhat.com>,
	Vijay Bellur <vbellur@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Amar Tumballi <amarts@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Blue Swirl <blauwirbel@gmail.com>, Avi Kivity <avi@redhat.com>,
	bharata@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend.
Date: Thu, 20 Sep 2012 10:20:33 +0200	[thread overview]
Message-ID: <505AD1D1.70604@redhat.com> (raw)
In-Reply-To: <505ACB62.7020409@redhat.com>

Il 20/09/2012 09:53, Paolo Bonzini ha scritto:
>>>> Would look a bit nicer with strstart() form cutils.c instead of strncmp().
>> > strstart() works with const char pointers, but I have char pointers here
>> > which I need to modify.
> You can pass a char* to a function that accepts const char*.  In your
> case, the last argument to strstart would be NULL.

As you pointed out on IRC, you meant the last argument.  I don't think
it would be a problem to cast that from char ** to const char **.

Perhaps it would be cleaner to make qemu_gluster_parseuri and
parse_gluster_spec accept a const char *.  You can replace strtok_r +
g_strdup with strspn/strcspn followed by g_strndup.

BTW, here the second strtok_r needs to stop at "&".

> +static int parse_socket(GlusterURI *uri, char *socket)
> +{
> +    char *token, *saveptr;
> +
> +    if (!socket) {
> +        return 0;
> +    }
> +    token = strtok_r(socket, "=", &saveptr);
> +    if (!token || strcmp(token, "socket")) {
> +        return -EINVAL;
> +    }
> +    token = strtok_r(NULL, "=", &saveptr);
> +    if (!token) {
> +        return -EINVAL;
> +    }

And the same for the second strtok_r here too:

> +    /* socket */
> +    token = strtok_r(NULL, "?", &saveptr);
> +    ret = parse_socket(uri, token);
> +    if (ret < 0) {
> +        goto out;
> +     }
> +
> +    /* Flag error for extra options */
> +    token = strtok_r(NULL, "?", &saveptr);
> +    if (token) {
> +        ret = -EINVAL;
> +        goto out;
> +    }
> +

Paolo

  reply	other threads:[~2012-09-20  8:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 15:21 [Qemu-devel] [RFC v7 0/5] GlusterFS support in QEMU - v7 Bharata B Rao
2012-09-17 15:22 ` [Qemu-devel] [PATCH v7 1/5] sockets: Make inet_parse() non static Bharata B Rao
2012-09-18 12:47   ` Kevin Wolf
2012-09-18 12:57     ` Paolo Bonzini
2012-09-20  5:57       ` Bharata B Rao
2012-09-17 15:23 ` [Qemu-devel] [PATCH v7 2/5] sockets: Change inet_parse() to accept address specification without port Bharata B Rao
2012-09-18 13:22   ` Kevin Wolf
2012-09-18 13:31     ` Paolo Bonzini
2012-09-18 14:08       ` Kevin Wolf
2012-09-20  6:30         ` Bharata B Rao
2012-09-20  6:51           ` Kevin Wolf
2012-09-17 15:24 ` [Qemu-devel] [PATCH v7 3/5] aio: Fix qemu_aio_wait() to maintain correct walking_handlers count Bharata B Rao
2012-09-17 15:25 ` [Qemu-devel] [PATCH v7 4/5] configure: Add a config option for GlusterFS as block backend Bharata B Rao
2012-09-17 15:26 ` [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU " Bharata B Rao
2012-09-18 14:01   ` Kevin Wolf
2012-09-20  6:41     ` Bharata B Rao
2012-09-20  7:53       ` Paolo Bonzini
2012-09-20  8:20         ` Paolo Bonzini [this message]
2012-09-20  9:12           ` Bharata B Rao
2012-09-20  9:14             ` Paolo Bonzini
2012-09-20  9:34             ` Kevin Wolf
2012-09-20 15:08               ` Paolo Bonzini
2012-09-21  3:50                 ` Bharata B Rao
2012-09-21  8:23                   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=505AD1D1.70604@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aavati@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=amarts@redhat.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=vbellur@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).