aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore
Commit message (Collapse)AuthorAgeFilesLines
...
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-5/+6
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: Make sure that libxs reports an error if xenstored dropsKeir Fraser2010-05-271-3/+33
| | | | | | | the connection, rather than getting stuck forever. Patch from: Steven Smith <steven.smith@eu.citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* xenstore: Fix cleanup_pop() definition for some (buggy) pthread.h headers.Keir Fraser2010-05-131-2/+8
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xs: avoid pthread_join deadlock in xs_daemon_closeKeir Fraser2010-05-121-4/+4
| | | | | | | | | | Doing a pthread_cancel and join on the reader thread while holding all the request/reply/watch mutexes can deadlock if the thread needs to take any of those mutexes to exit. Kill off the reader thread before taking any mutexes (which should be redundant if we're single-threaded at that point). Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* xs: make sure mutexes are cleaned up and memory freed if the read thread is ↵Keir Fraser2010-05-121-16/+30
| | | | | | | | | cancelled If the read thread is terminated with pthread cancel, it must make sure all memory is freed and mutexes are unlocked. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* xenstored: Always build and install.Keir Fraser2010-05-071-4/+4
| | | | | | It coexists quite happily with oxenstored. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* ocaml: remove hook to external repository.Keir Fraser2010-05-061-5/+0
| | | | Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
* xenstore,libxl: cleanup of xenstore connections across fork()Keir Fraser2010-04-122-19/+36
| | | | | | | | | | | | | | | Provide a new function xs_daemon_destroy_postfork which can be called by a libxenstore user who has called fork, to close the fd for the connection to xenstored and free the memory, without trying to do anything to any threads which libxenstore may have created. Use this new function in libxl_fork, to avoid accidental use of a xenstore connection in both parent and child. Also, fix the doc comment for libxl_spawn_spawn to have the success return codes the right way round. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstore: Resolve gcc4.5 type errorKeir Fraser2010-03-061-1/+1
| | | | | | | 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>
* xenstore: Fix memory leak in command 'xenstore rm'Keir Fraser2009-12-211-2/+4
| | | | | | | | When option '-t' is used to do tidy remove, routine xs_directory() will be called in order to check there are brother directories or not. The returned pointer should be passed to free() after this check. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* xenstore: Fix the method of get options and the usageKeir Fraser2009-12-181-6/+7
| | | | | | | | | Add long option '--flat' correspond to short option '-f', and let it just can be used for subcommand 'ls' (because in fact it's useless for subcommand 'read' and 'list'). And fix the usage of subcommands 'ls', 'list' and 'chmod'. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* Remove redundant semicolonsKeir Fraser2009-07-011-1/+1
| | | | Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
* ocaml-xenstored: Allow to build ocaml xenstored instead of C versionKeir Fraser2009-05-191-2/+9
| | | | | | | | To use, set CONFIG_OCAML_XENSTORED=y at build time. Then the build system will automatically download the remote repo to tools/ocaml-xenstored. Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
* xenstore: Add brief notice regarding xenstore protocol limits to xs.h.Keir Fraser2009-04-301-0/+5
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: Don't hardcode install pathKeir Fraser2009-03-201-2/+2
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Move the suspend event channel function to libxc, it will use theKeir Fraser2009-03-182-0/+26
| | | | | | /var/lib/xen/suspend_evtchn_lock.d to protect the access. Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
* xenstored: fix use-after free bugKeir Fraser2009-03-011-2/+4
| | | | | | | | | | | Problem: Handling requests for one connection can not only zap the connection itself, due to socket disconnects for example. It can also zap *other* connections, due to domain release requests. Especially it can zap the connection we have saved a pointer to in the "next" variable. From: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Use -MMD -MF in tools/* rather than -Wp,-M...Keir Fraser2009-01-121-6/+2
| | | | | | | | | | | | | | | | | | | | | | If you use -MMD -MF then the correct .o filename is written to the .*.d file as the compiler driver arranges everything. This was done in 19010:275abe1c5d24 for the hypervisor. In this patch we do the same elsewhere in the xen-unstable tree, particularly tools/. Specifically: * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS. * Remove -Wp,-MD... from every other Makefile * Remove setting of DEPS from every other Makefile * Ensure that every Makefile says -include $(DEPS) * Ensure that every Makefile's clean target removes $(DEPS) Some Makefiles were already halfway there, but often for a different variable name eg PROG_DEP. The variable name is now standardised in Rules.mk as DEPS. I have done a test build with this change, on Debian etch. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: Fix a memory leak in 'xs_is_domain_introduced'.Keir Fraser2008-09-111-2/+5
| | | | Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
* tools: Declare functions static where they should be, and provideKeir Fraser2008-07-154-21/+4
| | | | | | proper prototypes for others as required. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* xenstore: Fix error path broken by c/s 17816Keir Fraser2008-06-101-2/+2
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* xenstore: cleanupsKeir Fraser2008-06-102-8/+21
| | | | | | | | | | Attached patch uses calloc() for hash allocation. This makes sure, the allocated memory is always initialized. Also cleanup error handling a bit. On *BSD avoid conflicts with BSD list macros. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Fix xenstore-client.c compileKeir Fraser2008-05-011-2/+3
| | | | | | | errx() is not necessarily defined as a never-returns function. Fix lookup_mode() to account for this. Signed-off-by: John Levon <john.levon@sun.com>
* xemnstored: Fix xenstored abort when connection dropped.Keir Fraser2008-05-011-9/+21
| | | | | | | | | | | | | If a connection is dropped with pending input and output data then the connection will be dereferenced by both handle_input and handle_output resulting in a double free when the main loop dereferences the connection. Fix this issue by taking/releasing a reference over the calls to handle_input and handle_output separately and checking the result of talloc_free to see if the connection went away. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: Place return statement in the correct place to fix the build.Keir Fraser2008-04-091-2/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: fix canonicalize for metanodesKeir Fraser2008-04-092-2/+2
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* xenstore: fix Solaris compile with newer GCC versionsKeir Fraser2008-04-091-0/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: merge xenstore-ls into the multicall binary.Keir Fraser2008-04-093-190/+176
| | | | | | | This is done separately from moving the other utilities into the mutlicall since ls is slightly different and was already separate. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: make the xenstore clients a single multicall binaryKeir Fraser2008-04-092-189/+261
| | | | | | | | rather than multiply compiled source. This saves a bunch of space when statically compiling. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: support building the xenstore clients statically.Keir Fraser2008-04-092-35/+85
| | | | | | | | | | | This removes threading from libxenstore.a (but not libxenstore.so) since pthreads is incompatible with static linking and none of the command line clients require threads anyway. It is now possible to build these utilities statically with a uclibc toolchain which is useful for small userspace utility domains. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* Clean up xenstore Makefile.Keir Fraser2008-03-171-19/+14
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* libxenctrl headers should not pollute macro namespace withKeir Fraser2008-02-121-4/+4
| | | | | | | mb/rmb/wmb. Instead add a xen_ prefix. Modify Xen's public headers to expect the prefixed names instead of bare mb/rmb/wmb, but gate this expectation on a bump of __XEN_INTERFACE_VERSION__. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Add DTrace support to xenstoredKeir Fraser2008-01-315-8/+154
| | | | | | | Add USDT probes for significant xenstore operations to allow dynamic tracing. Signed-off-by: John Levon <john.levon@sun.com>
* Define CFLAGS and LDFLAGS for libxenctrl.Keir Fraser2008-01-271-4/+3
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* Move generation of public header hierarchy into the tools.Keir Fraser2008-01-261-0/+1
| | | | | | | This patch merges the two versions of public header generation currently used in the build into one. Signed-off-by: Bastian Blank <waldi@debian.org>
* New XS_SET_TARGETKeir Fraser2008-01-236-2/+90
| | | | | | | | | | | Stubdomains (and probably other domain disagregation elements too) need to be able to tinker with another domain. This adds XS_SET_TARGET so that XenStore allows domains to have permissions on files on which the "target" has permissions. This also adds xs_set_target, called by the domain builder when the 'target' option is used in the configuration. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* Add SBINDIR. Use it always.Keir Fraser2008-01-221-2/+2
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* Add BINDIR. Use it.Keir Fraser2008-01-221-4/+4
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* Add INCLUDEDIR. Use it.Keir Fraser2008-01-221-3/+3
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* Apply PREFIX directly to LIBDIR.Keir Fraser2008-01-221-5/+5
| | | | Signed-off-by: Bastian Blank <waldi@debian.org>
* xenstore size limitsKeir Fraser2007-12-144-2/+14
| | | | | | | | | | | | | | | * Documents the existing 4kby size limit on xenstore message payloads * Causes xs.c in libxenstore to fail locally rather than violating said limit (which is good because xenstored kills the client connection if it's exceeded). * Introduces some limits on path lengths in xenstored. I trust no-one is using path lengths >2kby. This is good because currently a domain client can create a 4kby relative path that the dom0 tools cannot access since they'd have to specify the somewhat longer absolute path. * Removes uses of the host's PATH_MAX (!) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Revert 16560:822d4ec5cfb1.Keir Fraser2007-12-081-2/+2
| | | | | | | | | | | | | Preference seems to be to update library versions only when the ABI changes. Only libxenctrl/libxenguest have their version number changed to 3.2.0, as a reminder that they change on pretty much every major release. libfsimage/libxenstore/libblktap have not changed substantially recently, hence the ABI has not changed, and version number stays the same as in Xen 3.1 (and before). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tools: Rationalise library soname versions.Keir Fraser2007-12-071-2/+2
| | | | | | | | | | | | | | | | * Arrange for the sonames of libxenstore, libxc, libfsimage and libblktap to be set from a single place in Config.mk. * Bumps the soname major version number to 3.2 in preparation for 3.2 rc1 after which we do not expect to have ABI changes. I have not done anything about libaio and libflask. The former is imported from elsewhere and if we're lucky will have sane versioning upstream. libflask has a very small interface and I'm hoping that the XSM authors have been keeping some ABI discipline. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: expanding_buffer variables are supposed to be static. ApartKeir Fraser2007-12-051-2/+2
| | | | | from anything else, this was guaranteeing they were initialised. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: document the xenstore protocolKeir Fraser2007-12-051-3/+12
| | | | | | | | | | | | | | | | | The attached patch adds a new text file docs/misc/xenstore.txt which describes the actual protocol implemented by xenstored. This was reverse-engineered from the actual code in tools/xenstore. I didn't bother making any automatic arrangements to ensure that the implemented and documented protocols are kept in step (for example, automatic code generation, etc.) The protocol is rather messy unfortunately and unsuitable for an xdr approach, and in any case is not likely to change very quickly. Also in this patch are a couple of comments for xenstored_core.c which help clarify the behaviour of some payload parsing helper functions. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore-ls -f for find(1)-like outputKeir Fraser2007-12-051-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current output of xenstore-ls can be quite hard to read and it is not very intractable for postprocessing with sort|diff and the like. The patch below provides a -f option which produces output with the full key pathname on each line, and which disables the value truncation and the `.'-padding when used with -p (since these latter two aren't likely to be very useful when values are preceded by long pathnames). While I was at it I added the `-s' option to the usage message, where it was previously missing. The results looks like this: ... /local/domain/1 = "" /local/domain/1/vm = "/vm/8b5fd34a-e268-fab5-9cde-c06eda21df16" /local/domain/1/device = "" /local/domain/1/device/vbd = "" /local/domain/1/device/vbd/2049 = "" /local/domain/1/device/vbd/2049/virtual-device = "2049" /local/domain/1/device/vbd/2049/device-type = "disk" /local/domain/1/device/vbd/2049/protocol = "x86_32-abi" ... Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: deprecating but \-quoting binary data.Keir Fraser2007-12-054-9/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fire watch for non-dom0 backend when frontend is removed from xenstoreKeir Fraser2007-10-261-1/+10
| | | | | in a transaction. Signed-off-by: Max Zhen <max.zhen@sun.com>
* A few small fixes for xenstored:Keir Fraser2007-10-221-3/+5
| | | | | | - Proper sizeof parameter to snprintf - Return proper xs_domain_dev for netbsd. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Fix xenstore unwatch with node name starting with "@"Keir Fraser2007-10-171-1/+1
| | | | | Watch node starting with "@" should not be canonicalized. Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>