From: Ian Jackson Subject: Re: [PATCH 14/15] libxl: New API for providing OS events to libxl Date: Fri, 9 Dec 2011 16:51:10 +0000 Message-ID: <20194.15486.922005.205889@mariner.uk.xensource.com> References: <1323108621-22654-1-git-send-email-ian.jackson@eu.citrix.com> <1323108621-22654-15-git-send-email-ian.jackson@eu.citrix.com> <1323279343.2969.44.camel@zakaz.uk.xensource.com> <20193.5581.714247.641528@mariner.uk.xensource.com> <1323422186.20077.28.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1323422186.20077.28.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 14/15] libxl: New API for providing OS events to libxl"): > On Thu, 2011-12-08 at 19:53 +0000, Ian Jackson wrote: > > All the existing files in libxl/ mention this nonexistent file > > LICENCE. I think we should fix this in a separate patch. I'd argue > > that my copying of the existing text isn't making the situation worse. > > Sure, I didn't mean to suggest you needed to fix this in this series, I > just happened to observe it here. Right. Yes. > > > > +int libxl__ev_fd_register(libxl__gc *gc, libxl__ev_fd *ev, > > > > + libxl__ev_fd_callback *func, > > > > + int fd, short events) { > > > > > > Strictly speaking CODING_STYLE requires the { to be on the next line. > > > > Oh, I probably have a lot of those. Damn. > > Yeah, I refrained from commenting every time ;-) Fixed. > > You mean "int xs_path_is_subpath_p(const char *parent, const char *child)" ? ... > Wouldn't most users of libxenstore doing watches need something like > this (and probably either open code it or erroneously omit it)? Many. If you are careful enough with your tokens you might not need to. > Regardless of where it goes moving that logic into a helper function > will make it clearer what is going on, both by having a descriptive name > and allowing the logic to be a bit more spaced out / commented, the last > clause in particular is slightly subtle. OK, I have split this out into a function in libxenstore (in a separate patch): /* Returns true if child is either equal to parent, or a node underneath * parent; or false otherwise. Done by string comparison, so relative and * absolute pathnames never in a parent/child relationship by this * definition. Cannot fail. */ bool xs_path_is_subpath(const char *parent, const char *child); You're right, the resulting code is clearer I think. Ian.