aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xs.c
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-19 14:34:30 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-19 14:34:30 +0000
commit7fd9bccce28a7f9aaeae9f9fb64c60ee4e2fa013 (patch)
treec24c858dccf63ea7be0f2406b2615d30d9f7ffe3 /tools/xenstore/xs.c
parent265d719ce5be2eb71d3a4433b27999350a85e0db (diff)
downloadxen-7fd9bccce28a7f9aaeae9f9fb64c60ee4e2fa013.tar.gz
xen-7fd9bccce28a7f9aaeae9f9fb64c60ee4e2fa013.tar.bz2
xen-7fd9bccce28a7f9aaeae9f9fb64c60ee4e2fa013.zip
Remove iflag argument to xs_write
xs_write with O_CREAT|O_EXCL causes problems over daemon restarts, since it's not idempotent. It turns out noone really needs the flags word at all, so get rid of it. It's now as if everyone specified "O_CREAT". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/xs.c')
-rw-r--r--tools/xenstore/xs.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
index ad17e9d31a..7036774f09 100644
--- a/tools/xenstore/xs.c
+++ b/tools/xenstore/xs.c
@@ -326,32 +326,17 @@ void *xs_read(struct xs_handle *h, const char *path, unsigned int *len)
}
/* Write the value of a single file.
- * Returns false on failure. createflags can be 0, O_CREAT, or O_CREAT|O_EXCL.
+ * Returns false on failure.
*/
bool xs_write(struct xs_handle *h, const char *path,
- const void *data, unsigned int len, int createflags)
-{
- const char *flags;
- struct iovec iovec[3];
-
- /* Format: Flags (as string), path, data. */
- if (createflags == 0)
- flags = XS_WRITE_NONE;
- else if (createflags == O_CREAT)
- flags = XS_WRITE_CREATE;
- else if (createflags == (O_CREAT|O_EXCL))
- flags = XS_WRITE_CREATE_EXCL;
- else {
- errno = EINVAL;
- return false;
- }
+ const void *data, unsigned int len)
+{
+ struct iovec iovec[2];
iovec[0].iov_base = (void *)path;
iovec[0].iov_len = strlen(path) + 1;
- iovec[1].iov_base = (void *)flags;
- iovec[1].iov_len = strlen(flags) + 1;
- iovec[2].iov_base = (void *)data;
- iovec[2].iov_len = len;
+ iovec[1].iov_base = (void *)data;
+ iovec[1].iov_len = len;
return xs_bool(xs_talkv(h, XS_WRITE, iovec, ARRAY_SIZE(iovec), NULL));
}