* [PATCH] sysfs.txt: mention that store method buffers are null-terminated
@ 2015-09-07 17:06 ulfalizer.lkml
2015-09-12 20:19 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: ulfalizer.lkml @ 2015-09-07 17:06 UTC (permalink / raw)
To: corbet; +Cc: gregkh, shane.seymour, ulfalizer, linux-doc, linux-kernel
From: Ulf Magnusson <ulfalizer@gmail.com>
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>
---
Documentation/filesystems/sysfs.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 9494afb..575e997 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -198,6 +198,9 @@ implementations:
entire file, modify the values it wishes to change, then write the
entire buffer back.
+ A terminating null is added after the data on stores. This makes
+ functions like sysfs_streq() safe to use.
+
Attribute method implementations should operate on an identical
buffer when reading and writing values.
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sysfs.txt: mention that store method buffers are null-terminated
2015-09-07 17:06 [PATCH] sysfs.txt: mention that store method buffers are null-terminated ulfalizer.lkml
@ 2015-09-12 20:19 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2015-09-12 20:19 UTC (permalink / raw)
To: ulfalizer.lkml; +Cc: gregkh, shane.seymour, ulfalizer, linux-doc, linux-kernel
On Mon, 7 Sep 2015 19:06:14 +0200
ulfalizer.lkml@gmail.com wrote:
> Without knowing this, the use of sysfs_streq() becomes puzzling.
>
> The termination happens in kernfs_fop_write().
Applied to the docs tree. I moved it up a paragraph, though, since it
better fits the flow of the document there.
Thanks,
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-12 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07 17:06 [PATCH] sysfs.txt: mention that store method buffers are null-terminated ulfalizer.lkml
2015-09-12 20:19 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®