diff options
| author | Patrick Mochel <mochel@osdl.org> | 2003-01-09 04:03:50 -0600 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2003-01-09 04:03:50 -0600 |
| commit | 71074f8cd54cdeae46f26b8e5928fcea4380d1b3 (patch) | |
| tree | 53569ef12c37b6dce09f9cf0d39afb983379a13f /include | |
| parent | ec9526e9bf77953ade39ae63af9351b4a14177cc (diff) | |
sysfs: Improve read/write buffer filling/flushing semantics.
These are sysfs internal changes only, though they have positive external
effects.
A new data type (struct sysfs_buffer) is defined to describe and maintain
state of the data for an attribute file. This object is allocated and
initialized when the file is opened. It contains a page-sized buffer that
is allocated during the first read or write.
For read(), the buffer is filled when it is allocated by calling the
attribute's show() method. This only happens when a read occurs from offset
0 in the file. For all read()s, the portion of the file requested is copied
to userspace. This finally fixes a long-standing bug in partial read()s.
For write(), the buffer is filled when it is allocated by copying the user-
supplied buffer from userspace into it. This buffer is then passed to the
attribute's store() method. This is not much different than what was present
before.
Note that partial-writes are not-supported. There is no way to know if a
user process is doing a partial write, and has more buffer to write. So, we
take the easy route and assume that the entire buffer is passed during the
first write.
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
