From: Bastian Blank Subject: Re: [PATCH 1/2] xenstored: Use xenbus_backend device on Linux Date: Thu, 15 Dec 2011 19:31:00 +0100 Message-ID: <20111215183100.GA1596@wavehammer.waldi.eu.org> References: <20111215104119.GC18042@wavehammer.waldi.eu.org> <1323968854.20077.507.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1323968854.20077.507.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 On Thu, Dec 15, 2011 at 05:07:34PM +0000, Ian Campbell wrote: > +static int linux_xenbus_backend_interface(xc_interface *xch, xc_osdep_handle h, void **map, evtchn_port_t *port) > +{ > + int ret, fd; > + void *addr; > + > + fd = open(XENSTORED_DEV, O_RDWR); > + if (fd == -1) > + { > + if ( errno != ENOENT ) > + return -1; This makes the code hard to read. You should first do the stuff on success and then the error handling. > +int xc_xenbus_backend_interface(xc_interface *xch, void **map, evtchn_port_t *port) I prefer returning structs over such pointer stunts, but okay. Bastian -- There are always alternatives. -- Spock, "The Galileo Seven", stardate 2822.3