From: Ian Jackson Subject: RE: [PATCH] libxl: make libxl communicate with xenstored by socket or xenbus driver Date: Thu, 9 Sep 2010 18:09:52 +0100 Message-ID: <19593.5344.368342.92686@mariner.uk.xensource.com> References: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB60@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB60@LONPMAILBOX01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Jun Zhu (Intern)" Cc: Ian Campbell , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Jun Zhu (Intern) writes ("RE: [Xen-devel] [PATCH] libxl: make libxl communicate with xenstored by socket or xenbus driver"): > I make another one. Thanks. (It helps if you say "v2" in the Subject line.) > - rc = xs_writev(xsh, XBT_NULL, starting->dom_path, kvs); > - if (rc) > - return; > - xs_daemon_close(xsh); > + /* we mustn't use the parent's handle in the child */ > + xsh = libxl_xs_open(); This, and some of the other parts of your patch, have what seem to be unintended whitespace and formatting changes. Can you please make sure that: * Your indents are exactly 4 spaces * You don't put any tabs in (your MUA may mangle them, and anyway we don't like tabs) * Curly backets (aka braces) should go on the same line as the if and else. > + if (!xsh) > + { > + fprintf(stderr, "cannot connect to xenstore"); > + free(kvs[1]); > + return; > + } > + xs_writev(xsh, XBT_NULL, starting->dom_path, kvs); > + libxl_xs_close(xsh); > + > + free(kvs[1]); This would be better written with the "goto out" idiom, I think ? > - ctx->xsh = xs_daemon_open(); > - if (!ctx->xsh) return ERROR_FAIL; > - return 0; > + ctx->xsh = libxl_xs_open(); > + if (!ctx->xsh) > + { > + XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno, > + "cannot connect to xenstore"); This logging, if it is appropriate, should surely be done in libxl_xs_open, rather than coded out in each call ? Thanks, Ian.