ia64/xen-unstable

changeset 6265:5a97aa8698d9

Add support to xenbus_gather to scan for strings and return them in allocated memory.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 18 19:24:42 2005 +0000 (2005-08-18)
parents a028975ecc05
children dfbeb7da829f
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Aug 18 19:21:09 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Aug 18 19:24:42 2005 +0000
     1.3 @@ -187,6 +187,7 @@ static char *join(const char *dir, const
     1.4  	static char buffer[4096];
     1.5  
     1.6  	BUG_ON(down_trylock(&xenbus_lock) == 0);
     1.7 +	/* XXX FIXME: might not be correct if name == "" */
     1.8  	BUG_ON(strlen(dir) + strlen("/") + strlen(name) + 1 > sizeof(buffer));
     1.9  
    1.10  	strcpy(buffer, dir);
    1.11 @@ -399,9 +400,12 @@ int xenbus_gather(const char *dir, ...)
    1.12  			ret = PTR_ERR(p);
    1.13  			break;
    1.14  		}
    1.15 -		if (sscanf(p, fmt, result) == 0)
    1.16 -			ret = -EINVAL;
    1.17 -		kfree(p);
    1.18 +		if (fmt) {
    1.19 +			if (sscanf(p, fmt, result) == 0)
    1.20 +				ret = -EINVAL;
    1.21 +			kfree(p);
    1.22 +		} else
    1.23 +			*(char **)result = p;
    1.24  	}
    1.25  	va_end(ap);
    1.26  	return ret;