[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] xenstored: Use xenbus_backend device on Linux



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.