]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/commitdiff
add low level functions from the root (read/write). [PATCH 3/3]
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 21 Jul 2009 14:30:18 +0000 (15:30 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 21 Jul 2009 14:30:18 +0000 (15:30 +0100)
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 <jean.guyader@citrix.com>
qemu-xen.h
xenstore.c

index 5e30c6104339017fcf8ee7b6e7125fab9742d0a7..29b8161b84af6d8cfd9d892b0b6d08b7c01f7f63 100644 (file)
@@ -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
index 1ad6dc91421f8995105236c78e6d0e0eecb26818..bb5f848368a6f3f909d20175462e332524d1c4f3 100644 (file)
@@ -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));
+}