From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH V2] libxl: support custom block hotplug scripts Date: Thu, 2 Aug 2012 19:53:43 +0100 Message-ID: <1343933623.7571.77.camel@dagon.hellion.org.uk> References: <84f0686ebcbfb0fa3a43.1343815057@cosworth.uk.xensource.com> <20506.43218.20724.749302@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20506.43218.20724.749302@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Roger Pau Monne , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org 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.