diff mbox

[Xen-devel,1/3] move xenstore public headers to include subdir

Message ID 1405008961-17187-1-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini July 10, 2014, 4:15 p.m. UTC
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/xenstore/Makefile                |    9 +-
 tools/xenstore/compat/xs.h             |    2 -
 tools/xenstore/compat/xs_lib.h         |    2 -
 tools/xenstore/include/compat/xs.h     |    2 +
 tools/xenstore/include/compat/xs_lib.h |    2 +
 tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
 tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
 tools/xenstore/xenstore.h              |  257 --------------------------------
 tools/xenstore/xenstore_lib.h          |   85 -----------
 9 files changed, 351 insertions(+), 350 deletions(-)
 delete mode 100644 tools/xenstore/compat/xs.h
 delete mode 100644 tools/xenstore/compat/xs_lib.h
 create mode 100644 tools/xenstore/include/compat/xs.h
 create mode 100644 tools/xenstore/include/compat/xs_lib.h
 create mode 100644 tools/xenstore/include/xenstore.h
 create mode 100644 tools/xenstore/include/xenstore_lib.h
 delete mode 100644 tools/xenstore/xenstore.h
 delete mode 100644 tools/xenstore/xenstore_lib.h

Comments

Ian Campbell July 10, 2014, 4:22 p.m. UTC | #1
On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  tools/xenstore/Makefile                |    9 +-
>  tools/xenstore/compat/xs.h             |    2 -
>  tools/xenstore/compat/xs_lib.h         |    2 -
>  tools/xenstore/include/compat/xs.h     |    2 +
>  tools/xenstore/include/compat/xs_lib.h |    2 +
>  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
>  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
>  tools/xenstore/xenstore.h              |  257 --------------------------------
>  tools/xenstore/xenstore_lib.h          |   85 -----------

Please can you use "git format-patch -M" so the renames are clear.

>  9 files changed, 351 insertions(+), 350 deletions(-)
>  delete mode 100644 tools/xenstore/compat/xs.h
>  delete mode 100644 tools/xenstore/compat/xs_lib.h
>  create mode 100644 tools/xenstore/include/compat/xs.h
>  create mode 100644 tools/xenstore/include/compat/xs_lib.h
>  create mode 100644 tools/xenstore/include/xenstore.h
>  create mode 100644 tools/xenstore/include/xenstore_lib.h
>  delete mode 100644 tools/xenstore/xenstore.h
>  delete mode 100644 tools/xenstore/xenstore_lib.h
> 
> diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> index e34bd41..2947d3e 100644
> --- a/tools/xenstore/Makefile
> +++ b/tools/xenstore/Makefile
> @@ -6,6 +6,7 @@ MINOR = 3
>  
>  CFLAGS += -Werror
>  CFLAGS += -I.
> +CFLAGS += -I./include

Since you don't change any other Makefiles how do the in-tree consumers
of this library continue to build?

(probably using /usr/include/xenstore_lib.h)

Ian.
Stefano Stabellini July 10, 2014, 4:27 p.m. UTC | #2
On Thu, 10 Jul 2014, Ian Campbell wrote:
> On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > ---
> >  tools/xenstore/Makefile                |    9 +-
> >  tools/xenstore/compat/xs.h             |    2 -
> >  tools/xenstore/compat/xs_lib.h         |    2 -
> >  tools/xenstore/include/compat/xs.h     |    2 +
> >  tools/xenstore/include/compat/xs_lib.h |    2 +
> >  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
> >  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
> >  tools/xenstore/xenstore.h              |  257 --------------------------------
> >  tools/xenstore/xenstore_lib.h          |   85 -----------
> 
> Please can you use "git format-patch -M" so the renames are clear.
> 
> >  9 files changed, 351 insertions(+), 350 deletions(-)
> >  delete mode 100644 tools/xenstore/compat/xs.h
> >  delete mode 100644 tools/xenstore/compat/xs_lib.h
> >  create mode 100644 tools/xenstore/include/compat/xs.h
> >  create mode 100644 tools/xenstore/include/compat/xs_lib.h
> >  create mode 100644 tools/xenstore/include/xenstore.h
> >  create mode 100644 tools/xenstore/include/xenstore_lib.h
> >  delete mode 100644 tools/xenstore/xenstore.h
> >  delete mode 100644 tools/xenstore/xenstore_lib.h
> > 
> > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > index e34bd41..2947d3e 100644
> > --- a/tools/xenstore/Makefile
> > +++ b/tools/xenstore/Makefile
> > @@ -6,6 +6,7 @@ MINOR = 3
> >  
> >  CFLAGS += -Werror
> >  CFLAGS += -I.
> > +CFLAGS += -I./include
> 
> Since you don't change any other Makefiles how do the in-tree consumers
> of this library continue to build?
> 
> (probably using /usr/include/xenstore_lib.h)

They don't: the series is not bisectable in the current form (I wrote it
in patch #0).
I was thinking of getting some reviews and then send the whole series as
a single patch.
Ian Campbell July 10, 2014, 4:31 p.m. UTC | #3
On Thu, 2014-07-10 at 17:27 +0100, Stefano Stabellini wrote:
> On Thu, 10 Jul 2014, Ian Campbell wrote:
> > On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > ---
> > >  tools/xenstore/Makefile                |    9 +-
> > >  tools/xenstore/compat/xs.h             |    2 -
> > >  tools/xenstore/compat/xs_lib.h         |    2 -
> > >  tools/xenstore/include/compat/xs.h     |    2 +
> > >  tools/xenstore/include/compat/xs_lib.h |    2 +
> > >  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
> > >  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
> > >  tools/xenstore/xenstore.h              |  257 --------------------------------
> > >  tools/xenstore/xenstore_lib.h          |   85 -----------
> > 
> > Please can you use "git format-patch -M" so the renames are clear.
> > 
> > >  9 files changed, 351 insertions(+), 350 deletions(-)
> > >  delete mode 100644 tools/xenstore/compat/xs.h
> > >  delete mode 100644 tools/xenstore/compat/xs_lib.h
> > >  create mode 100644 tools/xenstore/include/compat/xs.h
> > >  create mode 100644 tools/xenstore/include/compat/xs_lib.h
> > >  create mode 100644 tools/xenstore/include/xenstore.h
> > >  create mode 100644 tools/xenstore/include/xenstore_lib.h
> > >  delete mode 100644 tools/xenstore/xenstore.h
> > >  delete mode 100644 tools/xenstore/xenstore_lib.h
> > > 
> > > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > > index e34bd41..2947d3e 100644
> > > --- a/tools/xenstore/Makefile
> > > +++ b/tools/xenstore/Makefile
> > > @@ -6,6 +6,7 @@ MINOR = 3
> > >  
> > >  CFLAGS += -Werror
> > >  CFLAGS += -I.
> > > +CFLAGS += -I./include
> > 
> > Since you don't change any other Makefiles how do the in-tree consumers
> > of this library continue to build?
> > 
> > (probably using /usr/include/xenstore_lib.h)
> 
> They don't: the series is not bisectable in the current form (I wrote it
> in patch #0).
> I was thinking of getting some reviews and then send the whole series as
> a single patch.

Ah OK, sorry for missing that bit.
Stefano Stabellini July 10, 2014, 4:36 p.m. UTC | #4
On Thu, 10 Jul 2014, Ian Campbell wrote:
> On Thu, 2014-07-10 at 17:27 +0100, Stefano Stabellini wrote:
> > On Thu, 10 Jul 2014, Ian Campbell wrote:
> > > On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > > ---
> > > >  tools/xenstore/Makefile                |    9 +-
> > > >  tools/xenstore/compat/xs.h             |    2 -
> > > >  tools/xenstore/compat/xs_lib.h         |    2 -
> > > >  tools/xenstore/include/compat/xs.h     |    2 +
> > > >  tools/xenstore/include/compat/xs_lib.h |    2 +
> > > >  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
> > > >  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
> > > >  tools/xenstore/xenstore.h              |  257 --------------------------------
> > > >  tools/xenstore/xenstore_lib.h          |   85 -----------
> > > 
> > > Please can you use "git format-patch -M" so the renames are clear.
> > > 
> > > >  9 files changed, 351 insertions(+), 350 deletions(-)
> > > >  delete mode 100644 tools/xenstore/compat/xs.h
> > > >  delete mode 100644 tools/xenstore/compat/xs_lib.h
> > > >  create mode 100644 tools/xenstore/include/compat/xs.h
> > > >  create mode 100644 tools/xenstore/include/compat/xs_lib.h
> > > >  create mode 100644 tools/xenstore/include/xenstore.h
> > > >  create mode 100644 tools/xenstore/include/xenstore_lib.h
> > > >  delete mode 100644 tools/xenstore/xenstore.h
> > > >  delete mode 100644 tools/xenstore/xenstore_lib.h
> > > > 
> > > > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > > > index e34bd41..2947d3e 100644
> > > > --- a/tools/xenstore/Makefile
> > > > +++ b/tools/xenstore/Makefile
> > > > @@ -6,6 +6,7 @@ MINOR = 3
> > > >  
> > > >  CFLAGS += -Werror
> > > >  CFLAGS += -I.
> > > > +CFLAGS += -I./include
> > > 
> > > Since you don't change any other Makefiles how do the in-tree consumers
> > > of this library continue to build?
> > > 
> > > (probably using /usr/include/xenstore_lib.h)
> > 
> > They don't: the series is not bisectable in the current form (I wrote it
> > in patch #0).
> > I was thinking of getting some reviews and then send the whole series as
> > a single patch.
> 
> Ah OK, sorry for missing that bit.

The problem remains for the Makefile of qemu-xen-traditional though. I
have to make that change separately.
Ian Campbell July 10, 2014, 4:41 p.m. UTC | #5
On Thu, 2014-07-10 at 17:36 +0100, Stefano Stabellini wrote:
> On Thu, 10 Jul 2014, Ian Campbell wrote:
> > On Thu, 2014-07-10 at 17:27 +0100, Stefano Stabellini wrote:
> > > On Thu, 10 Jul 2014, Ian Campbell wrote:
> > > > On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > > > ---
> > > > >  tools/xenstore/Makefile                |    9 +-
> > > > >  tools/xenstore/compat/xs.h             |    2 -
> > > > >  tools/xenstore/compat/xs_lib.h         |    2 -
> > > > >  tools/xenstore/include/compat/xs.h     |    2 +
> > > > >  tools/xenstore/include/compat/xs_lib.h |    2 +
> > > > >  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
> > > > >  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
> > > > >  tools/xenstore/xenstore.h              |  257 --------------------------------
> > > > >  tools/xenstore/xenstore_lib.h          |   85 -----------
> > > > 
> > > > Please can you use "git format-patch -M" so the renames are clear.
> > > > 
> > > > >  9 files changed, 351 insertions(+), 350 deletions(-)
> > > > >  delete mode 100644 tools/xenstore/compat/xs.h
> > > > >  delete mode 100644 tools/xenstore/compat/xs_lib.h
> > > > >  create mode 100644 tools/xenstore/include/compat/xs.h
> > > > >  create mode 100644 tools/xenstore/include/compat/xs_lib.h
> > > > >  create mode 100644 tools/xenstore/include/xenstore.h
> > > > >  create mode 100644 tools/xenstore/include/xenstore_lib.h
> > > > >  delete mode 100644 tools/xenstore/xenstore.h
> > > > >  delete mode 100644 tools/xenstore/xenstore_lib.h
> > > > > 
> > > > > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > > > > index e34bd41..2947d3e 100644
> > > > > --- a/tools/xenstore/Makefile
> > > > > +++ b/tools/xenstore/Makefile
> > > > > @@ -6,6 +6,7 @@ MINOR = 3
> > > > >  
> > > > >  CFLAGS += -Werror
> > > > >  CFLAGS += -I.
> > > > > +CFLAGS += -I./include
> > > > 
> > > > Since you don't change any other Makefiles how do the in-tree consumers
> > > > of this library continue to build?
> > > > 
> > > > (probably using /usr/include/xenstore_lib.h)
> > > 
> > > They don't: the series is not bisectable in the current form (I wrote it
> > > in patch #0).
> > > I was thinking of getting some reviews and then send the whole series as
> > > a single patch.
> > 
> > Ah OK, sorry for missing that bit.
> 
> The problem remains for the Makefile of qemu-xen-traditional though. I
> have to make that change separately.

Don't you (or Ian) push to qemu-trad first and then update Config.mk at
the same time as everything else?
Stefano Stabellini July 11, 2014, 11:19 a.m. UTC | #6
On Thu, 10 Jul 2014, Ian Campbell wrote:
> On Thu, 2014-07-10 at 17:36 +0100, Stefano Stabellini wrote:
> > On Thu, 10 Jul 2014, Ian Campbell wrote:
> > > On Thu, 2014-07-10 at 17:27 +0100, Stefano Stabellini wrote:
> > > > On Thu, 10 Jul 2014, Ian Campbell wrote:
> > > > > On Thu, 2014-07-10 at 17:15 +0100, Stefano Stabellini wrote:
> > > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > > > > ---
> > > > > >  tools/xenstore/Makefile                |    9 +-
> > > > > >  tools/xenstore/compat/xs.h             |    2 -
> > > > > >  tools/xenstore/compat/xs_lib.h         |    2 -
> > > > > >  tools/xenstore/include/compat/xs.h     |    2 +
> > > > > >  tools/xenstore/include/compat/xs_lib.h |    2 +
> > > > > >  tools/xenstore/include/xenstore.h      |  257 ++++++++++++++++++++++++++++++++
> > > > > >  tools/xenstore/include/xenstore_lib.h  |   85 +++++++++++
> > > > > >  tools/xenstore/xenstore.h              |  257 --------------------------------
> > > > > >  tools/xenstore/xenstore_lib.h          |   85 -----------
> > > > > 
> > > > > Please can you use "git format-patch -M" so the renames are clear.
> > > > > 
> > > > > >  9 files changed, 351 insertions(+), 350 deletions(-)
> > > > > >  delete mode 100644 tools/xenstore/compat/xs.h
> > > > > >  delete mode 100644 tools/xenstore/compat/xs_lib.h
> > > > > >  create mode 100644 tools/xenstore/include/compat/xs.h
> > > > > >  create mode 100644 tools/xenstore/include/compat/xs_lib.h
> > > > > >  create mode 100644 tools/xenstore/include/xenstore.h
> > > > > >  create mode 100644 tools/xenstore/include/xenstore_lib.h
> > > > > >  delete mode 100644 tools/xenstore/xenstore.h
> > > > > >  delete mode 100644 tools/xenstore/xenstore_lib.h
> > > > > > 
> > > > > > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > > > > > index e34bd41..2947d3e 100644
> > > > > > --- a/tools/xenstore/Makefile
> > > > > > +++ b/tools/xenstore/Makefile
> > > > > > @@ -6,6 +6,7 @@ MINOR = 3
> > > > > >  
> > > > > >  CFLAGS += -Werror
> > > > > >  CFLAGS += -I.
> > > > > > +CFLAGS += -I./include
> > > > > 
> > > > > Since you don't change any other Makefiles how do the in-tree consumers
> > > > > of this library continue to build?
> > > > > 
> > > > > (probably using /usr/include/xenstore_lib.h)
> > > > 
> > > > They don't: the series is not bisectable in the current form (I wrote it
> > > > in patch #0).
> > > > I was thinking of getting some reviews and then send the whole series as
> > > > a single patch.
> > > 
> > > Ah OK, sorry for missing that bit.
> > 
> > The problem remains for the Makefile of qemu-xen-traditional though. I
> > have to make that change separately.
> 
> Don't you (or Ian) push to qemu-trad first and then update Config.mk at
> the same time as everything else?

Yes, that would work. Ian needs to keep that in mind when applying this.
I'll add a note to the commit message so that we don't forget.
diff mbox

Patch

diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index e34bd41..2947d3e 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -6,6 +6,7 @@  MINOR = 3
 
 CFLAGS += -Werror
 CFLAGS += -I.
+CFLAGS += -I./include
 CFLAGS += $(CFLAGS_libxenctrl)
 
 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
@@ -126,10 +127,10 @@  install: all
 	ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR)
 	ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so
 	$(INSTALL_DATA) libxenstore.a $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) xenstore.h $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL_DATA) xenstore_lib.h $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL_DATA) compat/xs.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs.h
-	$(INSTALL_DATA) compat/xs_lib.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs_lib.h
+	$(INSTALL_DATA) include/xenstore.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) include/xenstore_lib.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) include/compat/xs.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs.h
+	$(INSTALL_DATA) include/compat/xs_lib.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs_lib.h
 	ln -sf xenstore-compat/xs.h  $(DESTDIR)$(INCLUDEDIR)/xs.h
 	ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(INCLUDEDIR)/xs_lib.h
 
diff --git a/tools/xenstore/compat/xs.h b/tools/xenstore/compat/xs.h
deleted file mode 100644
index 99cf39b..0000000
--- a/tools/xenstore/compat/xs.h
+++ /dev/null
@@ -1,2 +0,0 @@ 
-#warning xs.h is deprecated use xenstore.h instead
-#include <xenstore.h>
diff --git a/tools/xenstore/compat/xs_lib.h b/tools/xenstore/compat/xs_lib.h
deleted file mode 100644
index ad81b54..0000000
--- a/tools/xenstore/compat/xs_lib.h
+++ /dev/null
@@ -1,2 +0,0 @@ 
-#warning xs_lib.h is deprecated use xenstore_lib.h instead
-#include <xenstore_lib.h>
diff --git a/tools/xenstore/include/compat/xs.h b/tools/xenstore/include/compat/xs.h
new file mode 100644
index 0000000..99cf39b
--- /dev/null
+++ b/tools/xenstore/include/compat/xs.h
@@ -0,0 +1,2 @@ 
+#warning xs.h is deprecated use xenstore.h instead
+#include <xenstore.h>
diff --git a/tools/xenstore/include/compat/xs_lib.h b/tools/xenstore/include/compat/xs_lib.h
new file mode 100644
index 0000000..ad81b54
--- /dev/null
+++ b/tools/xenstore/include/compat/xs_lib.h
@@ -0,0 +1,2 @@ 
+#warning xs_lib.h is deprecated use xenstore_lib.h instead
+#include <xenstore_lib.h>
diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
new file mode 100644
index 0000000..fdf5e76
--- /dev/null
+++ b/tools/xenstore/include/xenstore.h
@@ -0,0 +1,257 @@ 
+/* 
+    Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef XENSTORE_H
+#define XENSTORE_H
+
+#include <xenstore_lib.h>
+
+#define XBT_NULL 0
+
+#define XS_OPEN_READONLY	1UL<<0
+#define XS_OPEN_SOCKETONLY      1UL<<1
+
+/*
+ * Setting XS_UNWATCH_FILTER arranges that after xs_unwatch, no
+ * related watch events will be delivered via xs_read_watch.  But
+ * this relies on the couple token, subpath is unique.
+ *
+ * XS_UNWATCH_FILTER clear          XS_UNWATCH_FILTER set
+ *
+ * Even after xs_unwatch, "stale"   After xs_unwatch returns, no
+ * instances of the watch event     watch events with the same
+ * may be delivered.                token and with the same subpath
+ *                                  will be delivered.
+ *
+ * A path and a subpath can be      The application must avoid
+ * register with the same token.    registering a path (/foo/) and
+ *                                  a subpath (/foo/bar) with the
+ *                                  same path until a successful
+ *                                  xs_unwatch for the first watch
+ *                                  has returned.
+ */
+#define XS_UNWATCH_FILTER     1UL<<2
+
+struct xs_handle;
+typedef uint32_t xs_transaction_t;
+
+/* IMPORTANT: For details on xenstore protocol limits, see
+ * docs/misc/xenstore.txt in the Xen public source repository, and use the
+ * XENSTORE_*_MAX limit macros defined in xen/io/xs_wire.h.
+ */
+
+/* On failure, these routines set errno. */
+
+/* Open a connection to the xs daemon.
+ * Attempts to make a connection over the socket interface, 
+ * and if it fails, then over the  xenbus interface.
+ * Mode 0 specifies read-write access, XS_OPEN_READONLY for
+ * read-only access.
+ * Returns a handle or NULL.
+ */
+struct xs_handle *xs_open(unsigned long flags);
+
+/* Close the connection to the xs daemon. */
+void xs_close(struct xs_handle *xsh);
+
+/* Connect to the xs daemon.
+ * Returns a handle or NULL.
+ * Deprecated, please use xs_open(0) instead
+ */
+struct xs_handle *xs_daemon_open(void);
+struct xs_handle *xs_domain_open(void);
+
+/* Connect to the xs daemon (readonly for non-root clients).
+ * Returns a handle or NULL.
+ * Deprecated, please use xs_open(XS_OPEN_READONLY) instead
+ */
+struct xs_handle *xs_daemon_open_readonly(void);
+
+/* Close the connection to the xs daemon.
+ * Deprecated, please use xs_close() instead
+ */
+void xs_daemon_close(struct xs_handle *);
+
+/* Throw away the connection to the xs daemon, for use after fork(). */
+void xs_daemon_destroy_postfork(struct xs_handle *);
+
+/* Get contents of a directory.
+ * Returns a malloced array: call free() on it after use.
+ * Num indicates size.
+ */
+char **xs_directory(struct xs_handle *h, xs_transaction_t t,
+		    const char *path, unsigned int *num);
+
+/* Get the value of a single file, nul terminated.
+ * Returns a malloced value: call free() on it after use.
+ * len indicates length in bytes, not including terminator.
+ */
+void *xs_read(struct xs_handle *h, xs_transaction_t t,
+	      const char *path, unsigned int *len);
+
+/* Write the value of a single file.
+ * Returns false on failure.
+ */
+bool xs_write(struct xs_handle *h, xs_transaction_t t,
+	      const char *path, const void *data, unsigned int len);
+
+/* Create a new directory.
+ * Returns false on failure, or success if it already exists.
+ */
+bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
+	      const char *path);
+
+/* Destroy a file or directory (and children).
+ * Returns false on failure, or if it doesn't exist.
+ */
+bool xs_rm(struct xs_handle *h, xs_transaction_t t,
+	   const char *path);
+
+/* Restrict a xenstore handle so that it acts as if it had the
+ * permissions of domain @domid.  The handle must currently be
+ * using domain 0's credentials.
+ *
+ * Returns false on failure, in which case the handle continues
+ * to use the old credentials, or true on success.
+ */
+bool xs_restrict(struct xs_handle *h, unsigned domid);
+
+/* Get permissions of node (first element is owner, first perms is "other").
+ * Returns malloced array, or NULL: call free() after use.
+ */
+struct xs_permissions *xs_get_permissions(struct xs_handle *h,
+					  xs_transaction_t t,
+					  const char *path, unsigned int *num);
+
+/* Set permissions of node (must be owner).
+ * Returns false on failure.
+ */
+bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
+			const char *path, struct xs_permissions *perms,
+			unsigned int num_perms);
+
+/* Watch a node for changes (poll on fd to detect, or call read_watch()).
+ * When the node (or any child) changes, fd will become readable.
+ * Token is returned when watch is read, to allow matching.
+ * Returns false on failure.
+ */
+bool xs_watch(struct xs_handle *h, const char *path, const char *token);
+
+/* Return the FD to poll on to see if a watch has fired. */
+int xs_fileno(struct xs_handle *h);
+
+/* Check for node changes.  On success, returns a non-NULL pointer ret
+ * such that ret[0] and ret[1] are valid C strings, namely the
+ * triggering path (see docs/misc/xenstore.txt) and the token (from
+ * xs_watch).  On error return value is NULL setting errno.
+ * 
+ * Callers should, after xs_fileno has become readable, repeatedly
+ * call xs_check_watch until it returns NULL and sets errno to EAGAIN.
+ * (If the fd became readable, xs_check_watch is allowed to make it no
+ * longer show up as readable even if future calls to xs_check_watch
+ * will return more watch events.)
+ *
+ * After the caller is finished with the returned information it
+ * should be freed all in one go with free(ret).
+ */
+char **xs_check_watch(struct xs_handle *h);
+
+/* Find out what node change was on (will block if nothing pending).
+ * Returns array containing the path and token. Use XS_WATCH_* to access these
+ * elements. Call free() after use.
+ */
+char **xs_read_watch(struct xs_handle *h, unsigned int *num);
+
+/* Remove a watch on a node: implicitly acks any outstanding watch.
+ * Returns false on failure (no watch on that node).
+ */
+bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
+
+/* Start a transaction: changes by others will not be seen during this
+ * transaction, and changes will not be visible to others until end.
+ * Returns NULL on failure.
+ */
+xs_transaction_t xs_transaction_start(struct xs_handle *h);
+
+/* End a transaction.
+ * If abandon is true, transaction is discarded instead of committed.
+ * Returns false on failure: if errno == EAGAIN, you have to restart
+ * transaction.
+ */
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
+			bool abort);
+
+/* Introduce a new domain.
+ * This tells the store daemon about a shared memory page, event channel and
+ * store path associated with a domain: the domain uses these to communicate.
+ */
+bool xs_introduce_domain(struct xs_handle *h,
+			 unsigned int domid,
+			 unsigned long mfn,
+                         unsigned int eventchn); 
+
+/* Set the target of a domain
+ * This tells the store daemon that a domain is targetting another one, so
+ * it should let it tinker with it.
+ */
+bool xs_set_target(struct xs_handle *h,
+		   unsigned int domid,
+		   unsigned int target);
+
+/* Resume a domain.
+ * Clear the shutdown flag for this domain in the store.
+ */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
+
+/* Release a domain.
+ * Tells the store domain to release the memory page to the domain.
+ */
+bool xs_release_domain(struct xs_handle *h, unsigned int domid);
+
+/* Query the home path of a domain.  Call free() after use.
+ */
+char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
+
+/* Returns true if child is either equal to parent, or a node underneath
+ * parent; or false otherwise.  Done by string comparison, so relative and
+ * absolute pathnames never in a parent/child relationship by this
+ * definition.  Cannot fail.
+ */
+bool xs_path_is_subpath(const char *parent, const char *child);
+
+/* Return whether the domain specified has been introduced to xenstored.
+ */
+bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
+
+/* Only useful for DEBUG versions */
+char *xs_debug_command(struct xs_handle *h, const char *cmd,
+		       void *data, unsigned int len);
+
+int xs_suspend_evtchn_port(int domid);
+#endif /* XENSTORE_H */
+
+/*
+ * Local variables:
+ *  c-file-style: "linux"
+ *  indent-tabs-mode: t
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff --git a/tools/xenstore/include/xenstore_lib.h b/tools/xenstore/include/xenstore_lib.h
new file mode 100644
index 0000000..5c2baf6
--- /dev/null
+++ b/tools/xenstore/include/xenstore_lib.h
@@ -0,0 +1,85 @@ 
+/* 
+    Common routines between Xen store user library and daemon.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef XENSTORE_LIB_H
+#define XENSTORE_LIB_H
+
+#include <stdbool.h>
+#include <limits.h>
+#include <errno.h>
+#include <stdint.h>
+#include <xen/io/xs_wire.h>
+
+/* Bitmask of permissions. */
+enum xs_perm_type {
+	XS_PERM_NONE = 0,
+	XS_PERM_READ = 1,
+	XS_PERM_WRITE = 2,
+	/* Internal use. */
+	XS_PERM_ENOENT_OK = 4,
+	XS_PERM_OWNER = 8,
+};
+
+struct xs_permissions
+{
+	unsigned int id;
+	enum xs_perm_type perms;
+};
+
+/* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
+#define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
+
+/* Path for various daemon things: env vars can override. */
+const char *xs_daemon_rootdir(void);
+const char *xs_daemon_rundir(void);
+const char *xs_daemon_socket(void);
+const char *xs_daemon_socket_ro(void);
+const char *xs_domain_dev(void);
+const char *xs_daemon_tdb(void);
+
+/* Simple write function: loops for you. */
+bool xs_write_all(int fd, const void *data, unsigned int len);
+
+/* Convert strings to permissions.  False if a problem. */
+bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
+			 const char *strings);
+
+/* Convert permissions to a string (up to len MAX_STRLEN(unsigned int)+1). */
+bool xs_perm_to_string(const struct xs_permissions *perm,
+                       char *buffer, size_t buf_len);
+
+/* Given a string and a length, count how many strings (nul terms). */
+unsigned int xs_count_strings(const char *strings, unsigned int len);
+
+/* Sanitising (quoting) possibly-binary strings. */
+struct expanding_buffer {
+	char *buf;
+	int avail;
+};
+
+/* Ensure that given expanding buffer has at least min_avail characters. */
+char *expanding_buffer_ensure(struct expanding_buffer *, int min_avail);
+
+/* sanitise_value() may return NULL if malloc fails. */
+char *sanitise_value(struct expanding_buffer *, const char *val, unsigned len);
+
+/* *out_len_r on entry is ignored; out must be at least strlen(in)+1 bytes. */
+void unsanitise_value(char *out, unsigned *out_len_r, const char *in);
+
+#endif /* XENSTORE_LIB_H */
diff --git a/tools/xenstore/xenstore.h b/tools/xenstore/xenstore.h
deleted file mode 100644
index fdf5e76..0000000
--- a/tools/xenstore/xenstore.h
+++ /dev/null
@@ -1,257 +0,0 @@ 
-/* 
-    Xen Store Daemon providing simple tree-like database.
-    Copyright (C) 2005 Rusty Russell IBM Corporation
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef XENSTORE_H
-#define XENSTORE_H
-
-#include <xenstore_lib.h>
-
-#define XBT_NULL 0
-
-#define XS_OPEN_READONLY	1UL<<0
-#define XS_OPEN_SOCKETONLY      1UL<<1
-
-/*
- * Setting XS_UNWATCH_FILTER arranges that after xs_unwatch, no
- * related watch events will be delivered via xs_read_watch.  But
- * this relies on the couple token, subpath is unique.
- *
- * XS_UNWATCH_FILTER clear          XS_UNWATCH_FILTER set
- *
- * Even after xs_unwatch, "stale"   After xs_unwatch returns, no
- * instances of the watch event     watch events with the same
- * may be delivered.                token and with the same subpath
- *                                  will be delivered.
- *
- * A path and a subpath can be      The application must avoid
- * register with the same token.    registering a path (/foo/) and
- *                                  a subpath (/foo/bar) with the
- *                                  same path until a successful
- *                                  xs_unwatch for the first watch
- *                                  has returned.
- */
-#define XS_UNWATCH_FILTER     1UL<<2
-
-struct xs_handle;
-typedef uint32_t xs_transaction_t;
-
-/* IMPORTANT: For details on xenstore protocol limits, see
- * docs/misc/xenstore.txt in the Xen public source repository, and use the
- * XENSTORE_*_MAX limit macros defined in xen/io/xs_wire.h.
- */
-
-/* On failure, these routines set errno. */
-
-/* Open a connection to the xs daemon.
- * Attempts to make a connection over the socket interface, 
- * and if it fails, then over the  xenbus interface.
- * Mode 0 specifies read-write access, XS_OPEN_READONLY for
- * read-only access.
- * Returns a handle or NULL.
- */
-struct xs_handle *xs_open(unsigned long flags);
-
-/* Close the connection to the xs daemon. */
-void xs_close(struct xs_handle *xsh);
-
-/* Connect to the xs daemon.
- * Returns a handle or NULL.
- * Deprecated, please use xs_open(0) instead
- */
-struct xs_handle *xs_daemon_open(void);
-struct xs_handle *xs_domain_open(void);
-
-/* Connect to the xs daemon (readonly for non-root clients).
- * Returns a handle or NULL.
- * Deprecated, please use xs_open(XS_OPEN_READONLY) instead
- */
-struct xs_handle *xs_daemon_open_readonly(void);
-
-/* Close the connection to the xs daemon.
- * Deprecated, please use xs_close() instead
- */
-void xs_daemon_close(struct xs_handle *);
-
-/* Throw away the connection to the xs daemon, for use after fork(). */
-void xs_daemon_destroy_postfork(struct xs_handle *);
-
-/* Get contents of a directory.
- * Returns a malloced array: call free() on it after use.
- * Num indicates size.
- */
-char **xs_directory(struct xs_handle *h, xs_transaction_t t,
-		    const char *path, unsigned int *num);
-
-/* Get the value of a single file, nul terminated.
- * Returns a malloced value: call free() on it after use.
- * len indicates length in bytes, not including terminator.
- */
-void *xs_read(struct xs_handle *h, xs_transaction_t t,
-	      const char *path, unsigned int *len);
-
-/* Write the value of a single file.
- * Returns false on failure.
- */
-bool xs_write(struct xs_handle *h, xs_transaction_t t,
-	      const char *path, const void *data, unsigned int len);
-
-/* Create a new directory.
- * Returns false on failure, or success if it already exists.
- */
-bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
-	      const char *path);
-
-/* Destroy a file or directory (and children).
- * Returns false on failure, or if it doesn't exist.
- */
-bool xs_rm(struct xs_handle *h, xs_transaction_t t,
-	   const char *path);
-
-/* Restrict a xenstore handle so that it acts as if it had the
- * permissions of domain @domid.  The handle must currently be
- * using domain 0's credentials.
- *
- * Returns false on failure, in which case the handle continues
- * to use the old credentials, or true on success.
- */
-bool xs_restrict(struct xs_handle *h, unsigned domid);
-
-/* Get permissions of node (first element is owner, first perms is "other").
- * Returns malloced array, or NULL: call free() after use.
- */
-struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-					  xs_transaction_t t,
-					  const char *path, unsigned int *num);
-
-/* Set permissions of node (must be owner).
- * Returns false on failure.
- */
-bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
-			const char *path, struct xs_permissions *perms,
-			unsigned int num_perms);
-
-/* Watch a node for changes (poll on fd to detect, or call read_watch()).
- * When the node (or any child) changes, fd will become readable.
- * Token is returned when watch is read, to allow matching.
- * Returns false on failure.
- */
-bool xs_watch(struct xs_handle *h, const char *path, const char *token);
-
-/* Return the FD to poll on to see if a watch has fired. */
-int xs_fileno(struct xs_handle *h);
-
-/* Check for node changes.  On success, returns a non-NULL pointer ret
- * such that ret[0] and ret[1] are valid C strings, namely the
- * triggering path (see docs/misc/xenstore.txt) and the token (from
- * xs_watch).  On error return value is NULL setting errno.
- * 
- * Callers should, after xs_fileno has become readable, repeatedly
- * call xs_check_watch until it returns NULL and sets errno to EAGAIN.
- * (If the fd became readable, xs_check_watch is allowed to make it no
- * longer show up as readable even if future calls to xs_check_watch
- * will return more watch events.)
- *
- * After the caller is finished with the returned information it
- * should be freed all in one go with free(ret).
- */
-char **xs_check_watch(struct xs_handle *h);
-
-/* Find out what node change was on (will block if nothing pending).
- * Returns array containing the path and token. Use XS_WATCH_* to access these
- * elements. Call free() after use.
- */
-char **xs_read_watch(struct xs_handle *h, unsigned int *num);
-
-/* Remove a watch on a node: implicitly acks any outstanding watch.
- * Returns false on failure (no watch on that node).
- */
-bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
-
-/* Start a transaction: changes by others will not be seen during this
- * transaction, and changes will not be visible to others until end.
- * Returns NULL on failure.
- */
-xs_transaction_t xs_transaction_start(struct xs_handle *h);
-
-/* End a transaction.
- * If abandon is true, transaction is discarded instead of committed.
- * Returns false on failure: if errno == EAGAIN, you have to restart
- * transaction.
- */
-bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
-			bool abort);
-
-/* Introduce a new domain.
- * This tells the store daemon about a shared memory page, event channel and
- * store path associated with a domain: the domain uses these to communicate.
- */
-bool xs_introduce_domain(struct xs_handle *h,
-			 unsigned int domid,
-			 unsigned long mfn,
-                         unsigned int eventchn); 
-
-/* Set the target of a domain
- * This tells the store daemon that a domain is targetting another one, so
- * it should let it tinker with it.
- */
-bool xs_set_target(struct xs_handle *h,
-		   unsigned int domid,
-		   unsigned int target);
-
-/* Resume a domain.
- * Clear the shutdown flag for this domain in the store.
- */
-bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
-
-/* Release a domain.
- * Tells the store domain to release the memory page to the domain.
- */
-bool xs_release_domain(struct xs_handle *h, unsigned int domid);
-
-/* Query the home path of a domain.  Call free() after use.
- */
-char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
-
-/* Returns true if child is either equal to parent, or a node underneath
- * parent; or false otherwise.  Done by string comparison, so relative and
- * absolute pathnames never in a parent/child relationship by this
- * definition.  Cannot fail.
- */
-bool xs_path_is_subpath(const char *parent, const char *child);
-
-/* Return whether the domain specified has been introduced to xenstored.
- */
-bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
-
-/* Only useful for DEBUG versions */
-char *xs_debug_command(struct xs_handle *h, const char *cmd,
-		       void *data, unsigned int len);
-
-int xs_suspend_evtchn_port(int domid);
-#endif /* XENSTORE_H */
-
-/*
- * Local variables:
- *  c-file-style: "linux"
- *  indent-tabs-mode: t
- *  c-indent-level: 8
- *  c-basic-offset: 8
- *  tab-width: 8
- * End:
- */
diff --git a/tools/xenstore/xenstore_lib.h b/tools/xenstore/xenstore_lib.h
deleted file mode 100644
index 5c2baf6..0000000
--- a/tools/xenstore/xenstore_lib.h
+++ /dev/null
@@ -1,85 +0,0 @@ 
-/* 
-    Common routines between Xen store user library and daemon.
-    Copyright (C) 2005 Rusty Russell IBM Corporation
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef XENSTORE_LIB_H
-#define XENSTORE_LIB_H
-
-#include <stdbool.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdint.h>
-#include <xen/io/xs_wire.h>
-
-/* Bitmask of permissions. */
-enum xs_perm_type {
-	XS_PERM_NONE = 0,
-	XS_PERM_READ = 1,
-	XS_PERM_WRITE = 2,
-	/* Internal use. */
-	XS_PERM_ENOENT_OK = 4,
-	XS_PERM_OWNER = 8,
-};
-
-struct xs_permissions
-{
-	unsigned int id;
-	enum xs_perm_type perms;
-};
-
-/* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
-#define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
-
-/* Path for various daemon things: env vars can override. */
-const char *xs_daemon_rootdir(void);
-const char *xs_daemon_rundir(void);
-const char *xs_daemon_socket(void);
-const char *xs_daemon_socket_ro(void);
-const char *xs_domain_dev(void);
-const char *xs_daemon_tdb(void);
-
-/* Simple write function: loops for you. */
-bool xs_write_all(int fd, const void *data, unsigned int len);
-
-/* Convert strings to permissions.  False if a problem. */
-bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
-			 const char *strings);
-
-/* Convert permissions to a string (up to len MAX_STRLEN(unsigned int)+1). */
-bool xs_perm_to_string(const struct xs_permissions *perm,
-                       char *buffer, size_t buf_len);
-
-/* Given a string and a length, count how many strings (nul terms). */
-unsigned int xs_count_strings(const char *strings, unsigned int len);
-
-/* Sanitising (quoting) possibly-binary strings. */
-struct expanding_buffer {
-	char *buf;
-	int avail;
-};
-
-/* Ensure that given expanding buffer has at least min_avail characters. */
-char *expanding_buffer_ensure(struct expanding_buffer *, int min_avail);
-
-/* sanitise_value() may return NULL if malloc fails. */
-char *sanitise_value(struct expanding_buffer *, const char *val, unsigned len);
-
-/* *out_len_r on entry is ignored; out must be at least strlen(in)+1 bytes. */
-void unsanitise_value(char *out, unsigned *out_len_r, const char *in);
-
-#endif /* XENSTORE_LIB_H */