ChangeSet 1.1718, 2005/06/10 14:49:33+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Some functions of xenstore library dont have xs_ as prefix. This patch
fixes the problem.
Signed-off-by: Nguyen Anh Quynh <aquynh@xxxxxxxxx>
fake_libxc.c | 2 +-
xenstored_core.c | 18 +++++++++---------
xenstored_test.h | 2 +-
xs.c | 14 +++++++-------
xs_lib.c | 8 ++++----
xs_lib.h | 8 ++++----
xs_random.c | 8 ++++----
xs_test.c | 4 ++--
8 files changed, 32 insertions(+), 32 deletions(-)
diff -Nru a/tools/xenstore/fake_libxc.c b/tools/xenstore/fake_libxc.c
--- a/tools/xenstore/fake_libxc.c 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/fake_libxc.c 2005-06-10 10:03:46 -04:00
@@ -71,7 +71,7 @@
return fd;
memset(page, 0, sizeof(page));
- if (!write_all(fd, page, sizeof(page)))
+ if (!xs_write_all(fd, page, sizeof(page)))
barf_perror("Failed to write /tmp/xcmap page");
return fd;
diff -Nru a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xenstored_core.c 2005-06-10 10:03:46 -04:00
@@ -81,7 +81,7 @@
errno = ENOSPC;
return false;
}
- return write_all(fd, contents, len);
+ return xs_write_all(fd, contents, len);
}
int test_mkdir(const char *dir, int perms);
@@ -443,9 +443,9 @@
if (!strings)
return NULL;
- *num = count_strings(strings, size);
+ *num = xs_count_strings(strings, size);
ret = talloc_array(node, struct xs_permissions, *num);
- if (!strings_to_perms(ret, *num, strings))
+ if (!xs_strings_to_perms(ret, *num, strings))
corrupt(NULL, "Permissions corrupt for %s", node);
return ret;
@@ -460,7 +460,7 @@
char buffer[MAX_STRLEN(domid_t) + 1];
for (*len = 0, i = 0; i < num; i++) {
- if (!perm_to_string(&perms[i], buffer))
+ if (!xs_perm_to_string(&perms[i], buffer))
return NULL;
strings = talloc_realloc(node, strings, char,
@@ -506,7 +506,7 @@
if (!fd)
return NULL;
talloc_set_destructor(tmppath, destroy_path);
- if (!write_all(*fd, contents, len))
+ if (!xs_write_all(*fd, contents, len))
return NULL;
return tmppath;
@@ -721,14 +721,14 @@
permstr = perms_to_strings(dir, &perms, 1, &len);
fd = talloc_open(node_permfile(conn->transaction, node),
O_WRONLY|O_CREAT|O_EXCL, 0640);
- if (!fd || !write_all(*fd, permstr, len))
+ if (!fd || !xs_write_all(*fd, permstr, len))
return false;
if (data) {
char *datapath = node_datafile(conn->transaction, node);
fd = talloc_open(datapath, O_WRONLY|O_CREAT|O_EXCL, 0640);
- if (!fd || !write_all(*fd, data, datalen))
+ if (!fd || !xs_write_all(*fd, data, datalen))
return false;
}
@@ -878,7 +878,7 @@
char *node;
struct xs_permissions *perms;
- num = count_strings(in->buffer, in->used);
+ num = xs_count_strings(in->buffer, in->used);
if (num < 2)
return send_error(conn, EINVAL);
@@ -898,7 +898,7 @@
return send_error(conn, errno);
perms = talloc_array(node, struct xs_permissions, num);
- if (!strings_to_perms(perms, num, in->buffer))
+ if (!xs_strings_to_perms(perms, num, in->buffer))
return send_error(conn, errno);
if (!set_perms(conn->transaction, node, perms, num))
diff -Nru a/tools/xenstore/xenstored_test.h b/tools/xenstore/xenstored_test.h
--- a/tools/xenstore/xenstored_test.h 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xenstored_test.h 2005-06-10 10:03:46 -04:00
@@ -21,7 +21,7 @@
#ifdef TESTING
bool test_write_all(int fd, void *contents, unsigned int len);
-#define write_all test_write_all
+#define xs_write_all test_write_all
int test_mkdir(const char *dir, int perms);
#define mkdir test_mkdir
diff -Nru a/tools/xenstore/xs.c b/tools/xenstore/xs.c
--- a/tools/xenstore/xs.c 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xs.c 2005-06-10 10:03:46 -04:00
@@ -118,7 +118,7 @@
#ifdef XSTEST
#define read_all read_all_choice
-#define write_all write_all_choice
+#define xs_write_all write_all_choice
#endif
static int get_error(const char *errorstring)
@@ -179,11 +179,11 @@
ignorepipe.sa_flags = 0;
sigaction(SIGPIPE, &ignorepipe, &oldact);
- if (!write_all(h->fd, &msg, sizeof(msg)))
+ if (!xs_write_all(h->fd, &msg, sizeof(msg)))
goto fail;
for (i = 0; i < num_vecs; i++)
- if (!write_all(h->fd, iovec[i].iov_base, iovec[i].iov_len))
+ if (!xs_write_all(h->fd, iovec[i].iov_base, iovec[i].iov_len))
goto fail;
/* Watches can have fired before reply comes: daemon detects
@@ -253,7 +253,7 @@
return NULL;
/* Count the strings. */
- *num = count_strings(strings, len);
+ *num = xs_count_strings(strings, len);
/* Transfer to one big alloc for easy freeing. */
ret = malloc(*num * sizeof(char *) + len);
@@ -342,7 +342,7 @@
return NULL;
/* Count the strings: each one perms then domid. */
- *num = count_strings(strings, len);
+ *num = xs_count_strings(strings, len);
/* Transfer to one big alloc for easy freeing. */
ret = malloc(*num * sizeof(struct xs_permissions));
@@ -351,7 +351,7 @@
return NULL;
}
- if (!strings_to_perms(ret, *num, strings)) {
+ if (!xs_strings_to_perms(ret, *num, strings)) {
free_no_errno(ret);
ret = NULL;
}
@@ -376,7 +376,7 @@
for (i = 0; i < num_perms; i++) {
char buffer[MAX_STRLEN(domid_t)+1];
- if (!perm_to_string(&perms[i], buffer))
+ if (!xs_perm_to_string(&perms[i], buffer))
goto unwind;
iov[i+1].iov_base = strdup(buffer);
diff -Nru a/tools/xenstore/xs_lib.c b/tools/xenstore/xs_lib.c
--- a/tools/xenstore/xs_lib.c 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xs_lib.c 2005-06-10 10:03:46 -04:00
@@ -48,7 +48,7 @@
}
/* Simple routines for writing to sockets, etc. */
-bool write_all(int fd, const void *data, unsigned int len)
+bool xs_write_all(int fd, const void *data, unsigned int len)
{
while (len) {
int done;
@@ -66,7 +66,7 @@
}
/* Convert strings to permissions. False if a problem. */
-bool strings_to_perms(struct xs_permissions *perms, unsigned int num,
+bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
const char *strings)
{
const char *p;
@@ -104,7 +104,7 @@
}
/* Convert permissions to a string (up to len MAX_STRLEN(domid_t)+1). */
-bool perm_to_string(const struct xs_permissions *perm, char *buffer)
+bool xs_perm_to_string(const struct xs_permissions *perm, char *buffer)
{
switch (perm->perms) {
case XS_PERM_WRITE:
@@ -128,7 +128,7 @@
}
/* Given a string and a length, count how many strings (nul terms). */
-unsigned int count_strings(const char *strings, unsigned int len)
+unsigned int xs_count_strings(const char *strings, unsigned int len)
{
unsigned int num;
const char *p;
diff -Nru a/tools/xenstore/xs_lib.h b/tools/xenstore/xs_lib.h
--- a/tools/xenstore/xs_lib.h 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xs_lib.h 2005-06-10 10:03:46 -04:00
@@ -48,16 +48,16 @@
const char *xs_daemon_transactions(void);
/* Simple write function: loops for you. */
-bool write_all(int fd, const void *data, unsigned int len);
+bool xs_write_all(int fd, const void *data, unsigned int len);
/* Convert strings to permissions. False if a problem. */
-bool strings_to_perms(struct xs_permissions *perms, unsigned int num,
+bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
const char *strings);
/* Convert permissions to a string (up to len MAX_STRLEN(domid_t)+1). */
-bool perm_to_string(const struct xs_permissions *perm, char *buffer);
+bool xs_perm_to_string(const struct xs_permissions *perm, char *buffer);
/* Given a string and a length, count how many strings (nul terms). */
-unsigned int count_strings(const char *strings, unsigned int len);
+unsigned int xs_count_strings(const char *strings, unsigned int len);
#endif /* _XS_LIB_H */
diff -Nru a/tools/xenstore/xs_random.c b/tools/xenstore/xs_random.c
--- a/tools/xenstore/xs_random.c 2005-06-10 10:03:46 -04:00
+++ b/tools/xenstore/xs_random.c 2005-06-10 10:03:46 -04:00
@@ -223,10 +223,10 @@
release_file(perms, size);
return ret;
}
- *num = count_strings(perms, size);
+ *num = xs_count_strings(perms, size);
ret = new_array(struct xs_permissions, *num);
- if (!strings_to_perms(ret, *num, perms))
+ if (!xs_strings_to_perms(ret, *num, perms))
barf("Reading permissions from %s", permfile);
release_file(perms, size);
return ret;
@@ -267,7 +267,7 @@
for (i = 0; i < num; i++) {
char buffer[100];
- if (!perm_to_string(&perms[i], buffer)) {
+ if (!xs_perm_to_string(&perms[i], buffer)) {
int saved_errno = errno;
close(fd);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|