On Thu, Jul 28, 2005 at 12:49:21AM -0400, Jon Smirl wrote: > @@ -207,6 +208,28 @@ flush_write_buffer(struct dentry * dentr > struct attribute * attr = to_attr(dentry); > struct kobject * kobj = to_kobj(dentry->d_parent); > struct sysfs_ops * ops = buffer->ops; > + char *x, *y, *z; > + > + /* locate leading white space */ > + x = buffer->page; > + while (isspace(*x) && (x - buffer->page < count)) > + x++; Ok, I can follow this. For example buffer->page = " foo " then x = "foo " at the end of that . > + /* locate trailng white space */ > + z = y = x; > + while (y - buffer->page < count) { > + y++; > + z = y; > + while (isspace(*y) && (y - buffer->page < count)) { > + y++; > + } > + } > + count = z - x; Hm, I _think_ this works, but I need someone else to verify this... Anyone else? > + > + /* strip the white space */ > + if (buffer->page != x) > + memmove(buffer->page, x, count); > + buffer->page[count] = '\0'; Why move the buffer? Why not just pass in a pointer to the start of the "non-whitespace filled" buffer to the store() function? thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- References:
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Greg KH <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Greg KH <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Greg KH <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Greg KH <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- From: Jon Smirl <[email protected]>
- Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- Prev by Date: Re: Fix up qla2xxx configuration bogosity
- Next by Date: Re: system freezes for 0.2 to 0.5 seconds when reading /proc/acpi/thermal_zone/THRM/temperature
- Previous by thread: Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- Next by thread: Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
- Index(es):