From 4f947e17894a2e58a02fa6c1c712e7691a179212 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 21 Jul 2009 15:30:18 +0100 Subject: [PATCH] add low level functions from the root (read/write). [PATCH 3/3] This is a series of patch to complete the xenstore interface in qemu. 1: create a callback mecanism for xenstore watches. 2: add per domain low level xenstore functions (read/chmod/write/watch). 3: add low level functions from the root (read/write). Signed-off-by: Jean Guyader --- qemu-xen.h | 3 +++ xenstore.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/qemu-xen.h b/qemu-xen.h index 5e30c610..29b8161b 100644 --- a/qemu-xen.h +++ b/qemu-xen.h @@ -101,6 +101,9 @@ int xenstore_dom_write(int domid, const char *key, const char *value); void xenstore_dom_watch(int domid, const char *key, xenstore_callback ftp, void *opaque); void xenstore_dom_chmod(int domid, const char *key, const char *perms); +char *xenstore_read(const char *path); +int xenstore_write(const char *path, const char *val); + /* `danger' means that this parameter, variable or function refers to * an area of xenstore which is writeable by the guest and thus must * not be trusted by qemu code. For variables containing xenstore diff --git a/xenstore.c b/xenstore.c index 1ad6dc91..bb5f8483 100644 --- a/xenstore.c +++ b/xenstore.c @@ -1562,3 +1562,20 @@ int xenstore_dom_write(int domid, const char *key, const char *value) free(buf); return rc; } + +char *xenstore_read(const char *path) +{ + char *value = NULL; + unsigned int len; + + if (xsh == NULL) + return NULL; + return xs_read(xsh, XBT_NULL, path, &len); +} + +int xenstore_write(const char *path, const char *val) +{ + if (xsh == NULL) + return 1; + return xs_write(xsh, XBT_NULL, path, val, strlen(val)); +} -- 2.39.5