diff options
author | NeilBrown <neilb@suse.de> | 2014-10-14 16:57:26 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-07 10:54:38 -0800 |
commit | 4ef67a8c95f32ed0c8c6ed5fe01d1dd16358350e (patch) | |
tree | 82e66c1da3bbe63345edb27d7e64e3245df729ee /drivers/base/core.c | |
parent | 2b75869bba676c248d8d25ae6d2bd9221dfffdb6 (diff) |
sysfs/kernfs: make read requests on pre-alloc files use the buffer.
To match the previous patch which used the pre-alloc buffer for
writes, this patch causes reads to use the same buffer.
This is not strictly necessary as the current seq_read() will allocate
on first read, so user-space can trigger the required pre-alloc. But
consistency is valuable.
The read function is somewhat simpler than seq_read() and, for example,
does not support reading from an offset into the file: reads must be
at the start of the file.
As seq_read() does not use the prealloc buffer, ->seq_show is
incompatible with ->prealloc and caused an EINVAL return from open().
sysfs code which calls into kernfs always chooses the correct function.
As the buffer is shared with writes and other reads, the mutex is
extended to cover the copy_to_user.
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
0 files changed, 0 insertions, 0 deletions