From: Ian Jackson Subject: Re: [PATCH v2 03/15] libxl: add libxl__xs_path_cleanup Date: Tue, 22 May 2012 15:19:42 +0100 Message-ID: <20411.41086.644398.17763@mariner.uk.xensource.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-4-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1337695365-5142-4-git-send-email-roger.pau@citrix.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: Roger Pau Monne Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Roger Pau Monne writes ("[PATCH v2 03/15] libxl: add libxl__xs_path_cleanup"): > Add a function which behaves like "xenstore-rm -t", and which will be > used to clean xenstore after unplug since we will be no longer > executing xen-hotplug-cleanup script, that used to do that for us. > > Changes since v5: > > * Abort if no transaction or user_path supplied. Thanks. Acked-by: Ian Jackson > diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c > index 6ca1afe..c5b5364 100644 > --- a/tools/libxl/libxl_xshelp.c > +++ b/tools/libxl/libxl_xshelp.c > @@ -135,6 +135,44 @@ char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid) > return s; > } > > +int libxl__xs_path_cleanup(libxl__gc *gc, xs_transaction_t t, char *user_path) ... > + /* A path and transaction must be provided by the caller */ > + assert(user_path && t); Personally I wouldn't bother asserting user_path here. > + path = libxl__strdup(gc, user_path); After all this will tidily dereference null anyway. In general we don't bother asserting that function arguments we are going to dereference are non-0, since the crash is debuggable either way. But I don't particularly object, especially as you do need to assert that t is non-0 as this function is not safe outside a transaction. Ian.