Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17666497 authored by Ulf Magnusson's avatar Ulf Magnusson Committed by Jonathan Corbet
Browse files

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: default avatarUlf Magnusson <ulfalizer@gmail.com>
[jc: moved the new text to a different paragraph]
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 9ba41327
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -191,8 +191,9 @@ 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