ia64/xen-unstable

changeset 5423:61f0cf22d5cd

bitkeeper revision 1.1705.1.13 (42a99a6dV4rHEyZ-t7znDZXeW50z5Q)

Some functions of xenstore library dont have xs_ as prefix. This patch
fixes the problem.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 10 13:49:33 2005 +0000 (2005-06-10)
parents 0381e85305cf
children 4bcb6d1a8fc5
files tools/xenstore/fake_libxc.c tools/xenstore/xenstored_core.c tools/xenstore/xenstored_test.h tools/xenstore/xs.c tools/xenstore/xs_lib.c tools/xenstore/xs_lib.h tools/xenstore/xs_random.c tools/xenstore/xs_test.c
line diff
     1.1 --- a/tools/xenstore/fake_libxc.c	Fri Jun 10 11:54:48 2005 +0000
     1.2 +++ b/tools/xenstore/fake_libxc.c	Fri Jun 10 13:49:33 2005 +0000
     1.3 @@ -71,7 +71,7 @@ int xc_interface_open(void)
     1.4  		return fd;
     1.5  
     1.6  	memset(page, 0, sizeof(page));
     1.7 -	if (!write_all(fd, page, sizeof(page)))
     1.8 +	if (!xs_write_all(fd, page, sizeof(page)))
     1.9  		barf_perror("Failed to write /tmp/xcmap page");
    1.10  	
    1.11  	return fd;
     2.1 --- a/tools/xenstore/xenstored_core.c	Fri Jun 10 11:54:48 2005 +0000
     2.2 +++ b/tools/xenstore/xenstored_core.c	Fri Jun 10 13:49:33 2005 +0000
     2.3 @@ -81,7 +81,7 @@ bool test_write_all(int fd, void *conten
     2.4  		errno = ENOSPC;
     2.5  		return false;
     2.6  	}
     2.7 -	return write_all(fd, contents, len);
     2.8 +	return xs_write_all(fd, contents, len);
     2.9  }
    2.10  
    2.11  int test_mkdir(const char *dir, int perms);
    2.12 @@ -443,9 +443,9 @@ static struct xs_permissions *get_perms(
    2.13  	if (!strings)
    2.14  		return NULL;
    2.15  
    2.16 -	*num = count_strings(strings, size);
    2.17 +	*num = xs_count_strings(strings, size);
    2.18  	ret = talloc_array(node, struct xs_permissions, *num);
    2.19 -	if (!strings_to_perms(ret, *num, strings))
    2.20 +	if (!xs_strings_to_perms(ret, *num, strings))
    2.21  		corrupt(NULL, "Permissions corrupt for %s", node);
    2.22  
    2.23  	return ret;
    2.24 @@ -460,7 +460,7 @@ static char *perms_to_strings(const char
    2.25  	char buffer[MAX_STRLEN(domid_t) + 1];
    2.26  
    2.27  	for (*len = 0, i = 0; i < num; i++) {
    2.28 -		if (!perm_to_string(&perms[i], buffer))
    2.29 +		if (!xs_perm_to_string(&perms[i], buffer))
    2.30  			return NULL;
    2.31  
    2.32  		strings = talloc_realloc(node, strings, char,
    2.33 @@ -506,7 +506,7 @@ static char *tempfile(const char *path, 
    2.34  	if (!fd)
    2.35  		return NULL;
    2.36  	talloc_set_destructor(tmppath, destroy_path);
    2.37 -	if (!write_all(*fd, contents, len))
    2.38 +	if (!xs_write_all(*fd, contents, len))
    2.39  		return NULL;
    2.40  
    2.41  	return tmppath;
    2.42 @@ -721,14 +721,14 @@ static bool new_directory(struct connect
    2.43  	permstr = perms_to_strings(dir, &perms, 1, &len);
    2.44  	fd = talloc_open(node_permfile(conn->transaction, node),
    2.45  			 O_WRONLY|O_CREAT|O_EXCL, 0640);
    2.46 -	if (!fd || !write_all(*fd, permstr, len))
    2.47 +	if (!fd || !xs_write_all(*fd, permstr, len))
    2.48  		return false;
    2.49  
    2.50  	if (data) {
    2.51  		char *datapath = node_datafile(conn->transaction, node);
    2.52  
    2.53  		fd = talloc_open(datapath, O_WRONLY|O_CREAT|O_EXCL, 0640);
    2.54 -		if (!fd || !write_all(*fd, data, datalen))
    2.55 +		if (!fd || !xs_write_all(*fd, data, datalen))
    2.56  			return false;
    2.57  	}
    2.58  
    2.59 @@ -878,7 +878,7 @@ static bool do_set_perms(struct connecti
    2.60  	char *node;
    2.61  	struct xs_permissions *perms;
    2.62  
    2.63 -	num = count_strings(in->buffer, in->used);
    2.64 +	num = xs_count_strings(in->buffer, in->used);
    2.65  	if (num < 2)
    2.66  		return send_error(conn, EINVAL);
    2.67  
    2.68 @@ -898,7 +898,7 @@ static bool do_set_perms(struct connecti
    2.69  		return send_error(conn, errno);
    2.70  
    2.71  	perms = talloc_array(node, struct xs_permissions, num);
    2.72 -	if (!strings_to_perms(perms, num, in->buffer))
    2.73 +	if (!xs_strings_to_perms(perms, num, in->buffer))
    2.74  		return send_error(conn, errno);
    2.75  
    2.76  	if (!set_perms(conn->transaction, node, perms, num))
     3.1 --- a/tools/xenstore/xenstored_test.h	Fri Jun 10 11:54:48 2005 +0000
     3.2 +++ b/tools/xenstore/xenstored_test.h	Fri Jun 10 13:49:33 2005 +0000
     3.3 @@ -21,7 +21,7 @@
     3.4  
     3.5  #ifdef TESTING
     3.6  bool test_write_all(int fd, void *contents, unsigned int len);
     3.7 -#define write_all test_write_all
     3.8 +#define xs_write_all test_write_all
     3.9  
    3.10  int test_mkdir(const char *dir, int perms);
    3.11  #define mkdir test_mkdir
     4.1 --- a/tools/xenstore/xs.c	Fri Jun 10 11:54:48 2005 +0000
     4.2 +++ b/tools/xenstore/xs.c	Fri Jun 10 13:49:33 2005 +0000
     4.3 @@ -118,7 +118,7 @@ static bool read_all(int fd, void *data,
     4.4  
     4.5  #ifdef XSTEST
     4.6  #define read_all read_all_choice
     4.7 -#define write_all write_all_choice
     4.8 +#define xs_write_all write_all_choice
     4.9  #endif
    4.10  
    4.11  static int get_error(const char *errorstring)
    4.12 @@ -179,11 +179,11 @@ static void *xs_talkv(struct xs_handle *
    4.13  	ignorepipe.sa_flags = 0;
    4.14  	sigaction(SIGPIPE, &ignorepipe, &oldact);
    4.15  
    4.16 -	if (!write_all(h->fd, &msg, sizeof(msg)))
    4.17 +	if (!xs_write_all(h->fd, &msg, sizeof(msg)))
    4.18  		goto fail;
    4.19  
    4.20  	for (i = 0; i < num_vecs; i++)
    4.21 -		if (!write_all(h->fd, iovec[i].iov_base, iovec[i].iov_len))
    4.22 +		if (!xs_write_all(h->fd, iovec[i].iov_base, iovec[i].iov_len))
    4.23  			goto fail;
    4.24  
    4.25  	/* Watches can have fired before reply comes: daemon detects
    4.26 @@ -253,7 +253,7 @@ char **xs_directory(struct xs_handle *h,
    4.27  		return NULL;
    4.28  
    4.29  	/* Count the strings. */
    4.30 -	*num = count_strings(strings, len);
    4.31 +	*num = xs_count_strings(strings, len);
    4.32  
    4.33  	/* Transfer to one big alloc for easy freeing. */
    4.34  	ret = malloc(*num * sizeof(char *) + len);
    4.35 @@ -342,7 +342,7 @@ struct xs_permissions *xs_get_permission
    4.36  		return NULL;
    4.37  
    4.38  	/* Count the strings: each one perms then domid. */
    4.39 -	*num = count_strings(strings, len);
    4.40 +	*num = xs_count_strings(strings, len);
    4.41  
    4.42  	/* Transfer to one big alloc for easy freeing. */
    4.43  	ret = malloc(*num * sizeof(struct xs_permissions));
    4.44 @@ -351,7 +351,7 @@ struct xs_permissions *xs_get_permission
    4.45  		return NULL;
    4.46  	}
    4.47  
    4.48 -	if (!strings_to_perms(ret, *num, strings)) {
    4.49 +	if (!xs_strings_to_perms(ret, *num, strings)) {
    4.50  		free_no_errno(ret);
    4.51  		ret = NULL;
    4.52  	}
    4.53 @@ -376,7 +376,7 @@ bool xs_set_permissions(struct xs_handle
    4.54  	for (i = 0; i < num_perms; i++) {
    4.55  		char buffer[MAX_STRLEN(domid_t)+1];
    4.56  
    4.57 -		if (!perm_to_string(&perms[i], buffer))
    4.58 +		if (!xs_perm_to_string(&perms[i], buffer))
    4.59  			goto unwind;
    4.60  
    4.61  		iov[i+1].iov_base = strdup(buffer);
     5.1 --- a/tools/xenstore/xs_lib.c	Fri Jun 10 11:54:48 2005 +0000
     5.2 +++ b/tools/xenstore/xs_lib.c	Fri Jun 10 13:49:33 2005 +0000
     5.3 @@ -48,7 +48,7 @@ const char *xs_daemon_transactions(void)
     5.4  }
     5.5  
     5.6  /* Simple routines for writing to sockets, etc. */
     5.7 -bool write_all(int fd, const void *data, unsigned int len)
     5.8 +bool xs_write_all(int fd, const void *data, unsigned int len)
     5.9  {
    5.10  	while (len) {
    5.11  		int done;
    5.12 @@ -66,7 +66,7 @@ bool write_all(int fd, const void *data,
    5.13  }
    5.14  
    5.15  /* Convert strings to permissions.  False if a problem. */
    5.16 -bool strings_to_perms(struct xs_permissions *perms, unsigned int num,
    5.17 +bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
    5.18  		      const char *strings)
    5.19  {
    5.20  	const char *p;
    5.21 @@ -104,7 +104,7 @@ bool strings_to_perms(struct xs_permissi
    5.22  }
    5.23  
    5.24  /* Convert permissions to a string (up to len MAX_STRLEN(domid_t)+1). */
    5.25 -bool perm_to_string(const struct xs_permissions *perm, char *buffer)
    5.26 +bool xs_perm_to_string(const struct xs_permissions *perm, char *buffer)
    5.27  {
    5.28  	switch (perm->perms) {
    5.29  	case XS_PERM_WRITE:
    5.30 @@ -128,7 +128,7 @@ bool perm_to_string(const struct xs_perm
    5.31  }
    5.32  
    5.33  /* Given a string and a length, count how many strings (nul terms). */
    5.34 -unsigned int count_strings(const char *strings, unsigned int len)
    5.35 +unsigned int xs_count_strings(const char *strings, unsigned int len)
    5.36  {
    5.37  	unsigned int num;
    5.38  	const char *p;
     6.1 --- a/tools/xenstore/xs_lib.h	Fri Jun 10 11:54:48 2005 +0000
     6.2 +++ b/tools/xenstore/xs_lib.h	Fri Jun 10 13:49:33 2005 +0000
     6.3 @@ -48,16 +48,16 @@ const char *xs_daemon_store(void);
     6.4  const char *xs_daemon_transactions(void);
     6.5  
     6.6  /* Simple write function: loops for you. */
     6.7 -bool write_all(int fd, const void *data, unsigned int len);
     6.8 +bool xs_write_all(int fd, const void *data, unsigned int len);
     6.9  
    6.10  /* Convert strings to permissions.  False if a problem. */
    6.11 -bool strings_to_perms(struct xs_permissions *perms, unsigned int num,
    6.12 +bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
    6.13  		      const char *strings);
    6.14  
    6.15  /* Convert permissions to a string (up to len MAX_STRLEN(domid_t)+1). */
    6.16 -bool perm_to_string(const struct xs_permissions *perm, char *buffer);
    6.17 +bool xs_perm_to_string(const struct xs_permissions *perm, char *buffer);
    6.18  
    6.19  /* Given a string and a length, count how many strings (nul terms). */
    6.20 -unsigned int count_strings(const char *strings, unsigned int len);
    6.21 +unsigned int xs_count_strings(const char *strings, unsigned int len);
    6.22  
    6.23  #endif /* _XS_LIB_H */
     7.1 --- a/tools/xenstore/xs_random.c	Fri Jun 10 11:54:48 2005 +0000
     7.2 +++ b/tools/xenstore/xs_random.c	Fri Jun 10 13:49:33 2005 +0000
     7.3 @@ -223,10 +223,10 @@ static struct xs_permissions *file_get_p
     7.4  		release_file(perms, size);
     7.5  		return ret;
     7.6  	}
     7.7 -	*num = count_strings(perms, size);
     7.8 +	*num = xs_count_strings(perms, size);
     7.9  
    7.10  	ret = new_array(struct xs_permissions, *num);
    7.11 -	if (!strings_to_perms(ret, *num, perms))
    7.12 +	if (!xs_strings_to_perms(ret, *num, perms))
    7.13  		barf("Reading permissions from %s", permfile);
    7.14  	release_file(perms, size);
    7.15  	return ret;
    7.16 @@ -267,7 +267,7 @@ static bool file_set_perms(struct file_o
    7.17  	for (i = 0; i < num; i++) {
    7.18  		char buffer[100];
    7.19  
    7.20 -		if (!perm_to_string(&perms[i], buffer)) {
    7.21 +		if (!xs_perm_to_string(&perms[i], buffer)) {
    7.22  			int saved_errno = errno;
    7.23  			close(fd);
    7.24  			errno = saved_errno;
    7.25 @@ -536,7 +536,7 @@ static char *dump_dir(struct ops *ops,
    7.26  		ret = talloc_asprintf_append(ret, "%s%s: ", spacing, dir[i]);
    7.27  		for (j = 0; j < numperms; j++) {
    7.28  			char buffer[100];
    7.29 -			if (!perm_to_string(&perms[j], buffer))
    7.30 +			if (!xs_perm_to_string(&perms[j], buffer))
    7.31  				barf("perm to string");
    7.32  			ret = talloc_asprintf_append(ret, "%s ", buffer);
    7.33  		}
     8.1 --- a/tools/xenstore/xs_test.c	Fri Jun 10 11:54:48 2005 +0000
     8.2 +++ b/tools/xenstore/xs_test.c	Fri Jun 10 13:49:33 2005 +0000
     8.3 @@ -153,7 +153,7 @@ static bool write_all_choice(int fd, con
     8.4  {
     8.5  	if (fd == -2)
     8.6  		return write_all_shmem(fd, data, len);
     8.7 -	return write_all(fd, data, len);
     8.8 +	return xs_write_all(fd, data, len);
     8.9  }
    8.10  
    8.11  /* We want access to internal functions. */
    8.12 @@ -491,7 +491,7 @@ static void dump_dir(unsigned int handle
    8.13  		printf("%s%s: ", spacing, dir[i]);
    8.14  		for (j = 0; j < numperms; j++) {
    8.15  			char buffer[100];
    8.16 -			if (!perm_to_string(&perms[j], buffer))
    8.17 +			if (!xs_perm_to_string(&perms[j], buffer))
    8.18  				barf("perm to string");
    8.19  			printf("%s ", buffer);
    8.20  		}