From: Ian Jackson Subject: Re: [PATCH 2/2] libxl: implement libxl__xs_mknod using XS_WRITE rather than XS_MKDIR Date: Wed, 25 Nov 2015 14:03:56 +0000 Message-ID: <22101.49100.503499.986903@mariner.uk.xensource.com> References: <1448453505-7694-1-git-send-email-paul.durrant@citrix.com> <1448453505-7694-3-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a1ag6-00055F-By for xen-devel@lists.xenproject.org; Wed, 25 Nov 2015 14:04:10 +0000 In-Reply-To: <1448453505-7694-3-git-send-email-paul.durrant@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: Paul Durrant Cc: xen-devel@lists.xenproject.org, Wei Liu , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Paul Durrant writes ("[PATCH 2/2] libxl: implement libxl__xs_mknod using XS_WRITE rather than XS_MKDIR"): > This patch modifies the implentation of libxl__xs_mknod() to use XS_WRITE > rather than XS_MKDIR since passing an empty value to the former will > ensure that the path is both existent and empty upon return, rather than > merely existent. The function return type is also changed to a libxl > error value rather than a boolean, it's declaration is accordingly moved > into the 'checked' section in libxl_internal.h, and a comment is added to > clarify its semantics. ... > +/* On success, path will exist and will be empty */ > +int libxl__xs_mknod(libxl__gc *gc, xs_transaction_t t, > + const char *path, struct xs_permissions *perms, > + unsigned int num_perms); I like the idea of making this function a `checked' one, but: /*----- "checked" xenstore access functions -----*/ /* Each of these functions will check that it succeeded; if it * fails it logs and returns ERROR_FAIL. */ but your implementation does not log anything. I think it's probably correct to add the logging but it would perhaps be worth checking the call sites. While I am here, you maybe want to adjust the wording of a couple of comments: > +/* On success, path will exist and will be empty */ You mean `will have an empty value'. WRITE does not delete any subtrees (and libxl__xs_mknod shouldn't IMO). > + bool ok; /* the return value from a boolean function */ Maybe say `the success return value from a boolean function' ? Ian.