xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH V2] libxl: support custom block hotplug scripts
Date: Thu, 2 Aug 2012 19:53:43 +0100	[thread overview]
Message-ID: <1343933623.7571.77.camel@dagon.hellion.org.uk> (raw)
In-Reply-To: <20506.43218.20724.749302@mariner.uk.xensource.com>

On Thu, 2012-08-02 at 17:20 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH V2] libxl: support custom block hotplug scripts"):
> > libxl: support custom block hotplug scripts
> 
> Wow.  Thanks.  Everything looks good apart from this:
> 
> >                      DPC->had_depr_prefix=1; DEPRECATE("use `script=...'");
> > -                   SAVESTRING("script", script, yytext);
> > -               }
> > +                    if (DPC->disk->script) {
> > +                        if (*DPC->disk->script) {
> > +                            xlu__disk_err(DPC,yytext,"script respecified");
> > +                            return 0;
> > +                        }
> > +                        /* do not complain about overwriting empty strings */
> > +                        free(DPC->disk->script);
> > +                    }
> > +                    DPC->disk->script = malloc(strlen("block-")
> > +                                               +strlen(yytext) + 1);
> > +                    strcpy(DPC->disk->script, "block-");
> > +                    strcat(DPC->disk->script, yytext);
> 
> Isn't this very like the contents of the savestring() function ?

> Ie you could do:
>         char *newscript;
>         asprintf(&newscript, ...);
>         savestring(DPC, "script respecified", &DPC->disk->script, newscript);
>         free(newscript);
> 
> Other places in xl use asprintf so you can use it here.

I hadn't realised asprintf was fair game. I'll rework along these lines.

> > +                }
> 
> Is this one-character indentation change intentional ?

There's a few stray hard tabs in this file (which is predominantly using
8 space indendation). I think I fixed it in the blocks I was changing
which will look like a 1 char reindent in an MUA. 

Ian.

      reply	other threads:[~2012-08-02 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  9:57 [PATCH V2] libxl: support custom block hotplug scripts Ian Campbell
2012-08-01 10:05 ` Ian Campbell
2012-08-02 16:20 ` Ian Jackson
2012-08-02 18:53   ` Ian Campbell [this message]

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=1343933623.7571.77.camel@dagon.hellion.org.uk \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).