Commit Graph
24 Commits
Author SHA1 Message Date
Roger Pau Monne 7ff99b232e libs/xenstore: set correct FreeBSD device
The path to the xenstore FreeBSD device is /dev/xen/xenstore.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-13 10:49:56 +00:00
Juergen Gross c875931063 xenstore: make functions static
Move functions used in only one source to the file where they are used
and make them static.

Remove some prototypes from headers which are no longer in use.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:32:37 +00:00
Wei Liu 153db2f820 libxenstore: honour XEN_RUN_STORED
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2016-06-17 11:27:21 +01:00
Jonathan Creekmore 9c89dc9520 libxenstore: prefer using the character device
With the addition of FMODE_ATOMIC_POS in the Linux 3.14 kernel,
concurrent blocking file accesses to a single open file descriptor can
cause a deadlock trying to grab the file position lock. If a watch has
been set up, causing a read_thread to blocking read on the file
descriptor, then future writes that would cause the background read to
complete will block waiting on the file position lock before they can
execute. This race condition only occurs when libxenstore is accessing
the xenstore daemon through the /proc/xen/xenbus file and not through
the unix domain socket, which is the case when the xenstore daemon is
running as a stub domain or when oxenstored is passed
--disable-socket. Accessing the daemon from the true character device
also does not exhibit this problem.

On Linux, prefer using the character device file over the proc file if
the character device exists.

Signed-off-by: Jonathan Creekmore <jonathan.creekmore@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-09-01 12:41:35 +01:00
Ian Campbell 443701ef0c Replace FSF street address with canonical URL
As recommended in http://www.gnu.org/licenses/gpl-howto.en.html.

This is the result of:
$ git grep -El Mass\|Temple\|Franklin | xargs ./fsf.pl

Where fsf.pl is:
    #!/usr/bin/perl -w -pi.bak -0777
    my $repl = 'If not, see <http://www.gnu.org/licenses/>.';
    my $br = qr/(?:\s*\n\s*(?:[\*\#]|\/\/|\.\\" )?\s*|\s+)/;

    my $inwt = qr/[Ii]f${br}not,${br}write${br}(?:to${br})?the${br}Free${br}Software${br}Foundation,(?:${br}Inc\.,)?/;

    my $mass = qr/675${br}Mass${br}Ave,?${br}Cambridge,?${br}MA${br}02139,?${br}USA,?\.?/;
    my $franklin = qr/51${br}Franklin${br}St(?:reet)?(?:,${br}| - )Fifth${br}Floor,?${br}Boston,?${br}MA,?${br}02110-1301,?${br}USA,?\.?/;
    my $temple = qr/59${br}Temple${br}Place(?:,${br}| - )Suite${br}330,?${br}Boston,?${br}MA,?${br}021110?-1307,?${br}USA,?\.?/;

    s|$inwt$br$mass|$repl|m;
    s|$inwt$br$franklin|$repl|m;
    s|$inwt$br$temple|$repl|m;

The only remaining mentions of these addresses are in COPYING files which I
haven't touched.

Some of the changed files are imports from elsewhere, however
filtering them out is tricky, I think it is tolerable to have these
files be modified here and then perhaps reverted on the next sync,
since it's only 1-2 lines and obvious what is going on.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2015-07-29 11:14:07 +01:00
Wei Liu 441256a532 rump kernels: use new platform macro
Starting from rump kernel changeset 91d5623 ("Renaming platform macros,
app-tools and autoconf target string"), __RUMPUSER_XEN__ and __RUMPAPP__
are deleted. We are supposed to use __RUMPRUN__ instead.

We still keep __RUMPUSER_XEN__ for now in order to make xen-unstable
pass osstest push gate. I will remove __RUMPUSER_XEN__ later.

Related discussion:
http://thread.gmane.org/gmane.comp.rumpkernel.user/739

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2015-02-04 16:49:01 +00:00
Olaf Hering 2d174ed71c tools: use XEN_LIB_STORED instead of /var/lib/xenstored
Remove hardcoded /var/lib/xenstored instead of using the existing
XEN_LIB_STORED variable.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
[ ijc -- ran autogen.sh as requested ]
2014-10-06 17:00:23 +01:00
Ian Jackson 665e2160f6 xenstore: rump kernels: Look for /dev/xen/xenbus
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2014-07-14 16:07:50 +01:00
Ian Campbell debddaa56c nstore: rename public xenstore headers
The xenstore header xs.h is producing conflicts with other software[1].

xs is a too short identifier and does not matche the library. Renaming
the headers to xenstore.h and xenstore_lib.h is the easiest way to make
them easy recognizable and prevent furthe problems.

[1]: http://bugs.debian.org/668550

[ Also update QEMU_TAG, to bring in corresponding change to
qemu-xen-traditional. -iwj ]

Signed-off-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

--HG--
rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h
rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h
2012-05-14 17:15:36 +01:00
Keir Fraser e0c77842c7 xenstore: Resolve gcc4.5 type error
Without this, gcc 4.5 complains with,
error: case value '3' not in enumerated type 'const enum xs_perm_type'

Signed-off-by: Charles Arnold <carnold@novell.com>
2010-03-06 13:31:42 +00:00
Keir Fraser dd36792405 xenstore: deprecating but \-quoting binary data.
Presently it's not clear what the allowable character set is for
values in xenstore.  The current command-line tools just pass values
to printf("%s",...) so implicitly assume that it's 7-bit printable
ASCII (since the interpretation of 8-bit characters would be unclear).
However there are rumours of programs which dump binary data into
xenstore and/or bugs involving nul bytes being added to the ends of
xenstore values (and even of some drivers insisting on a spurious
nul).

There isn't all that much useful documentation about xenstore.  There
is a doc detailing which xenstore keys may be used and what their
meanings are (interface.tex) but it is very out of date, amongst other
reasons because it's in format which is not very easy to update when
adding functionality to the code and because there is no way to check
programs' behaviour in xenstore against the spec.  I think the
xenstore part of interface.tex should be replaced with a new document
in a simpler format, which should amonst other things be sufficiently
machine-readable that automatic testing could reveal at least basic
out-of-spec behaviours like setting or using undocumented keys.

This new document ought to specify the allowable character set of both
keys and values, and ought to specify the xenstored protocol as well.

It seems to me that the appropriate character set for xenstore values
is 7-bit printing ASCII (0x20..0x7e).  Values should not have a
trailing nul byte `on the wire' but of course the xs library interface
should continue to add an additional nul beyond the quoted length for
the convenience of callers.

That is consistent with nearly all of the existing uses and makes the
whole system much more tractable compared to an explicit expectation
that binary data will be stored.  (For example, if we like binary data
in xenstore, why are uuids represented in their printable hex
encoding?)  xenstore data is supposedly non-performance-critical
metadata for use by control plane machinery so the overhead of
printing and parsing text strings is hardly a problem.

Applications which set binary values should be deprecated but to avoid
breaking those applications xenstored should continue indefinitely to
be binary-transparent.

Under these circumstances it can only be regarded as a bug that the
current command-line tools are lossy in the presence of binary data.
Not only does this make them break for those now-deprecated uses, but
it also prevents them from being used to detect and debug problems
relating to the exact byte strings being recorded in xenstore.

As a first step towards the utopia I describe above, this patch
causes xenstore-read and -ls to \-escape the values of xenstore
keys, and xenstore-write to un-\-escape them.  The escaping is a
subset of that permitted by C89; only \t \r \n \\ and hex and octal
are used and recognised.  (So no \f, \a etc.)

This change will not change the representation by these tools of
values which contain only 7-bit printing ASCII characters unless they
contain \'s.

Values which contain \'s will need to be quoted on entry and dequoted
on exit if being manipulated by xenstore-*.  The only values likely to
be affected are paths in Windows guest filesystems and in practice we
believe that any such filename which is actually relevant to anything
will be set other than via xenstore-write.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-05 11:05:47 +00:00
Keir Fraser bdeaa9684d A few small fixes for xenstored:
- Proper sizeof parameter to snprintf
 - Return proper xs_domain_dev for netbsd.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-10-22 14:22:39 +01:00
Keir Fraser f056fc9b80 xenstore: sprintf->snprintf, and fix for OpenBSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-10-05 14:11:36 +01:00
kfraser@localhost.localdomain b9488ab5f5 [SOLARIS] Create kernel-interface implementations for libxc and xenstored.
Additionally, on Solaris, tell the kernel when xenstored is running.

Signed-off-by: John Levon <john.levon@sun.com>
2006-10-17 18:21:25 +01:00
vhanquez@kneesa.uk.xensource.com acd5a62ae9 Try to create runtime xenstored's directories at startup time.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
2006-05-11 15:01:54 +01:00
kaf24@firebug.cl.cam.ac.uk d8263e8dba Fix Xen public interfaces and the tools to consistently
use stdint-format bitsize types (uint32_t and friends).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-12 11:07:37 +01:00
Rusty Russell f11f68cd11 Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-09-23 14:25:01 +01:00
cl349@firebug.cl.cam.ac.uk bd843d47d8 Always allow overriding where clients connect through XENSTORED_PATH.
Detect if we're connecting to a socket or to the domain device and
open accordingly.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-12 21:42:26 +00:00
cl349@firebug.cl.cam.ac.uk a916bf616c Add support in libxenstore for using the xenbus_dev store connection.
Also add simple read/write/rm clients for command line access to the
store (using the xenbus_dev store connection).
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-03 16:54:38 +00:00
kaf24@firebug.cl.cam.ac.uk 0996bc07b9 1) More testing: include tests which I forgot in previous patch, remove
xs_watch_stress, reduce cycles in "make check" random test.
2) xs_crashme: corrupt random packets going to xenstored, watch it
crash.
3) Handle second input from before we finished output on first one.
4) Fix bug where one-arg operations are given zero args.
5) Fix bug where SET_PERMS fails after blocking on transaction.
6) Fix memory leak when DIRECTORY op given no argument.
7) Fail on first memory leak, for better testing.
8) Fix missing waiting_for_ack initialization for new connections.
9) Ensure all input and output is handled for domains so we don't stall.
10) Fix overrun bug in xs_count_strings on non-nul-terminated strings.
11) New test for clients which write without waiting for response.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-08-08 09:13:19 +00:00
kaf24@firebug.cl.cam.ac.uk 165c0d1741 libxenstore (used to access the daemon) should be licensed under LGPL.
There are several people I am aware of interested in writing non-GPL
tools, and this code is trivial, so they'd just end up writing their
own.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-08-04 08:57:37 +00:00
cl349@firebug.cl.cam.ac.uk 4ddc54b2db bitkeeper revision 1.1713.3.5 (42b2a4e2r6SNlC_nq2hAkXEQjEFAmA)
Many files:
  - watch now takes a token, returned when reading watch
  - More tests
  - Fix domain shared page communication (flush output)
  - Add "home" path for domains
  - More permissions checks in various functions
  - Simplify watch acknowledgement code and fix occasional bug
xs_watch_stress.c, 12readonly.sh, 11domain-watch.sh, 10domain-homedir.sh:
  new file
xs_stress.c, xs_lib.h, xs_lib.c:
  Cleanup whitespace.
ignore:
  Add tools/xenstore/xs_watch_stress
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-06-17 10:24:34 +00:00
kaf24@firebug.cl.cam.ac.uk 31519ad1fd bitkeeper revision 1.1705.1.13 (42a99a6dV4rHEyZ-t7znDZXeW50z5Q)
Some functions of xenstore library dont have xs_ as prefix. This patch
fixes the problem.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
2005-06-10 13:49:33 +00:00
cl349@firebug.cl.cam.ac.uk 29c9e570b1 bitkeeper revision 1.1662.1.15 (42a5968eiZE_DjdIFPjxvzLw6ACvCQ)
Add xenstore daemon and library.
Makefile:
  Add xenstore subdirectory.
  Remove xs_stress on clean.
Many files:
  new file
ignore:
  Update ignore list for xenstore.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (authored)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-06-07 12:43:58 +00:00