|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 14/21] xenstored: add NO_SOCKETS compilation option
On Mon, 2012-01-23 at 10:33 +0000, Stefano Stabellini wrote:
> On Fri, 20 Jan 2012, Daniel De Graaf wrote:
> > From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
> >
> > option for compiling xenstored without unix sockets to support running on
> > mini-OS
>
> The amount of ifdef's introduced by this patch is not ideal.
>
> Do you think is possible to refactor the code to use structures with
> function pointers, with a registration mechanism, so that in the dom0
> case you would end up with two structs (one for each kind of
> connections), while you would have only one on mini-OS?
>
> We could have an initialize, a destroy and an accept_connection
> functions.
I suggested earlier that sprinkling checks for fd == -1 around instead
of ifdefs might end up more palatable -- e.g. for the changes in
initialize_set, destroy_fd, write_fd, the FD_ISSET test etc. Factoring
the setup code from main() into a function which can have an ifdef
nopped case would help too.
> > Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
> > Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
> > Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
> > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
[...]
> > diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
> > index 0a01675..60f2cee 100644
> > --- a/tools/xenstore/xs.c
> > +++ b/tools/xenstore/xs.c
> > @@ -271,10 +271,12 @@ struct xs_handle *xs_open(unsigned long flags)
> > {
> > struct xs_handle *xsh = NULL;
> >
> > +#ifndef NO_SOCKETS
> > if (flags & XS_OPEN_READONLY)
> > xsh = get_handle(xs_daemon_socket_ro());
> > else
> > xsh = get_handle(xs_daemon_socket());
> > +#endif
I think tools/xenstore/xs.c is only used by the client library -- does
this change actual cause anything to happen?
[...]
> > +#ifndef NO_SOCKETS
> > const char *xs_daemon_socket(void)
> > {
> > return xs_daemon_path();
> > @@ -73,6 +76,7 @@ const char *xs_daemon_socket_ro(void)
> > return NULL;
> > return buf;
> > }
> > +#endif
If this returned NULL in the NO_SOCKETS case that might also help.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |