[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block
From: |
Bharata B Rao |
Subject: |
Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend. |
Date: |
Thu, 20 Sep 2012 12:11:14 +0530 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Sep 18, 2012 at 04:01:58PM +0200, Kevin Wolf wrote:
> > +
> > +#define GLUSTER_TRANSPORT_DEFAULT "gluster://"
> > +#define GLUSTER_TRANSPORT_DEFAULT_SZ strlen(GLUSTER_TRANSPORT_DEFAULT)
> > +#define GLUSTER_TRANSPORT_TCP "gluster+tcp://"
> > +#define GLUSTER_TRANSPORT_TCP_SZ strlen(GLUSTER_TRANSPORT_TCP)
> > +#define GLUSTER_TRANSPORT_UNIX "gluster+unix://"
> > +#define GLUSTER_TRANSPORT_UNIX_SZ strlen(GLUSTER_TRANSPORT_UNIX)
> > +#define GLUSTER_TRANSPORT_RDMA "gluster+rdma://"
> > +#define GLUSTER_TRANSPORT_RDMA_SZ strlen(GLUSTER_TRANSPORT_RDMA)
> > +
> > +
> > +static int parse_gluster_spec(GlusterURI *uri, char *spec)
> > +{
> > + char *token, *saveptr;
> > + int ret;
> > + QemuOpts *opts;
> > + char *p, *q;
> > +
> > + /* transport */
> > + p = spec;
> > + if (!strncmp(p, GLUSTER_TRANSPORT_DEFAULT,
> > GLUSTER_TRANSPORT_DEFAULT_SZ)) {
> > + uri->transport = g_strdup("tcp");
> > + p += GLUSTER_TRANSPORT_DEFAULT_SZ;
> > + } else if (!strncmp(p, GLUSTER_TRANSPORT_TCP,
> > GLUSTER_TRANSPORT_TCP_SZ)) {
> > + uri->transport = g_strdup("tcp");
> > + p += GLUSTER_TRANSPORT_TCP_SZ;
> > + } else if (!strncmp(p, GLUSTER_TRANSPORT_UNIX,
> > GLUSTER_TRANSPORT_UNIX_SZ)) {
> > + uri->transport = g_strdup("unix");
> > + p += GLUSTER_TRANSPORT_UNIX_SZ;
> > + } else if (!strncmp(p, GLUSTER_TRANSPORT_RDMA,
> > GLUSTER_TRANSPORT_RDMA_SZ)) {
>
> 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.
> > +static int qemu_gluster_parseuri(GlusterURI *uri, const char *filename)
> > +{
> > + char *token, *saveptr;
> > + char *p, *q, *gluster_spec = NULL;
> > + int ret = -EINVAL;
> > +
> > + p = q = g_strdup(filename);
>
> Neither p nor q are changed, so one variable would be enough.
Right, will fix.
>
> > +
> > + /* Extract server, volname and image */
> > + token = strtok_r(p, "?", &saveptr);
> > + if (!token) {
> > + goto out;
> > + }
> > + gluster_spec = g_strdup(token);
> > +
> > + /* socket */
> > + token = strtok_r(NULL, "?", &saveptr);
> > + ret = parse_socket(uri, token);
> > + if (ret < 0) {
> > + goto out;
> > + }
>
> The is_unix thing feels a bit backwards. You set it whenever an option
> is present, and fail if a protocol other than gluster+unix:// is used.
>
> Wouldn't it make more sense to set it depending on the protocol and then
> check in the option parser if is_unix == true when there is a 'socket'
> option? Otherwise adding non-unix options later is going to become hard.
I see your point, will change this.
>
> The rest looks good now.
Thanks for the review.
Regards,
Bharata.
- [Qemu-devel] [PATCH v7 2/5] sockets: Change inet_parse() to accept address specification without port, (continued)
[Qemu-devel] [PATCH v7 3/5] aio: Fix qemu_aio_wait() to maintain correct walking_handlers count, Bharata B Rao, 2012/09/17
[Qemu-devel] [PATCH v7 4/5] configure: Add a config option for GlusterFS as block backend, Bharata B Rao, 2012/09/17
[Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Bharata B Rao, 2012/09/17
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Kevin Wolf, 2012/09/18
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend.,
Bharata B Rao <=
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Paolo Bonzini, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Paolo Bonzini, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Bharata B Rao, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Paolo Bonzini, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Kevin Wolf, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Paolo Bonzini, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Bharata B Rao, 2012/09/20
- Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend., Paolo Bonzini, 2012/09/21