summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-09-07 19:06:14 +0200
committerJonathan Corbet <corbet@lwn.net>2015-09-13 14:38:51 -0600
commit17666497fe631fef483afd38824c5dabdd764b90 (patch)
tree58e663e6ca7e2df102005202574b332d0723b6e9
parent9ba41327d8d01df54be1e6f1c246b123b009fa55 (diff)
sysfs.txt: mention that store method buffers are null-terminated
Without knowing this, the use of sysfs_streq() becomes puzzling. The termination happens in kernfs_fop_write(). Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> [jc: moved the new text to a different paragraph] Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r--Documentation/filesystems/sysfs.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 78170ed7bfde..24da7b32c489 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -191,9 +191,10 @@ implementations:
be called again, rearmed, to fill the buffer.
- On write(2), sysfs expects the entire buffer to be passed during the
- first write. Sysfs then passes the entire buffer to the store()
- method.
-
+ first write. Sysfs then passes the entire buffer to the store() method.
+ A terminating null is added after the data on stores. This makes
+ functions like sysfs_streq() safe to use.
+
When writing sysfs files, userspace processes should first read the
entire file, modify the values it wishes to change, then write the
entire buffer back.