direct-io.hg

changeset 5668:0e6073537c4a

Remove confusion about terminating nul character.
author cl349@firebug.cl.cam.ac.uk
date Tue Jul 05 08:46:46 2005 +0000 (2005-07-05)
parents 30e0940a2982
children ff5d7ccd8d69
files linux-2.6.11-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Jul 05 08:44:29 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Jul 05 08:46:46 2005 +0000
     1.3 @@ -136,7 +136,7 @@ int xenbus_read_string(const char *dir, 
     1.4  
     1.5  int xenbus_write_string(const char *dir, const char *name, const char *val)
     1.6  {
     1.7 -	return xenbus_write(dir, name, val, strlen(val) + 1);
     1.8 +	return xenbus_write(dir, name, val, strlen(val));
     1.9  }
    1.10  
    1.11  int xenbus_read_ulong(const char *dir, const char *name, unsigned long *val)
    1.12 @@ -155,7 +155,7 @@ int xenbus_read_ulong(const char *dir, c
    1.13  		goto free_data;
    1.14  	}
    1.15  	*val = simple_strtoul(data, &end, 10);
    1.16 -	if (end != data + data_n - 1) {
    1.17 +	if (end != data + data_n) {
    1.18  		printk("XENBUS: Path %s/%s, bad parse of '%s' as ulong\n",
    1.19  		       dir, name, data);
    1.20  		err = -EINVAL;
    1.21 @@ -173,7 +173,7 @@ int xenbus_write_ulong(const char *dir, 
    1.22  	char data[32] = {};
    1.23  
    1.24  	snprintf(data, sizeof(data), "%lu", val);
    1.25 -	return xenbus_write(dir, name, data, strlen(data) + 1);
    1.26 +	return xenbus_write(dir, name, data, strlen(data));
    1.27  }
    1.28  
    1.29  int xenbus_read_long(const char *dir, const char *name, long *val)
    1.30 @@ -192,7 +192,7 @@ int xenbus_read_long(const char *dir, co
    1.31  		goto free_data;
    1.32  	}
    1.33  	*val = simple_strtol(data, &end, 10);
    1.34 -	if (end != data + data_n - 1) {
    1.35 +	if (end != data + data_n) {
    1.36  		printk("XENBUS: Path %s/%s, bad parse of '%s' as long\n",
    1.37  		       dir, name, data);
    1.38  		err = -EINVAL;
    1.39 @@ -210,7 +210,7 @@ int xenbus_write_long(const char *dir, c
    1.40  	char data[32] = {};
    1.41  
    1.42  	snprintf(data, sizeof(data), "%li", val);
    1.43 -	return xenbus_write(dir, name, data, strlen(data) + 1);
    1.44 +	return xenbus_write(dir, name, data, strlen(data));
    1.45  }
    1.46  
    1.47  /* Number of characters in string form of a MAC address. */
    1.48 @@ -272,7 +272,7 @@ int xenbus_read_mac(const char *dir, con
    1.49  		err = -ENOENT;
    1.50  		goto free_data;
    1.51  	}
    1.52 -	err = mac_aton(data, data_n - 1, mac);
    1.53 +	err = mac_aton(data, data_n, mac);
    1.54  	if (err) {
    1.55  		printk("XENBUS: Path %s/%s, bad parse of '%s' as mac\n",
    1.56  		       dir, name, data);
    1.57 @@ -288,12 +288,11 @@ int xenbus_read_mac(const char *dir, con
    1.58  
    1.59  int xenbus_write_mac(const char *dir, const char *name, const unsigned char mac[6])
    1.60  {
    1.61 -	char buf[MAC_LENGTH + 1] = {};
    1.62 +	char buf[MAC_LENGTH] = {};
    1.63  	int buf_n = sizeof(buf);
    1.64  	
    1.65  	snprintf(buf, buf_n, "%02x:%02x:%02x:%02x:%02x:%02x",
    1.66  		 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    1.67 -	buf[buf_n - 1] = '\0';
    1.68  	return xenbus_write(dir, name, buf, buf_n);
    1.69  }
    1.70