docs/zh_CN: update sysfs.txt about show() usage
Subsystems (2)
PATCH 1/1 docs/zh_CN: update sysfs.txt about show() usage
Update the show() usage according to the English version.
Signed-off-by Chen Zhou <[email protected]>
--- Documentation/translations/zh_CN/filesystems/sysfs.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/translations/zh_CN/filesystems/sysfs.txt +4 -2
@@ -213,10 +213,12 @@ Sysfs 将会为每次读写操作调用一次这个方法。这使得这些方 - 缓冲区应总是 PAGE_SIZE 大小。对于i386,这个值为4096。 -- show() 方法应该返回写入缓冲区的字节数,也就是 snprintf()的 +- show() 方法应该返回写入缓冲区的字节数,也就是 scnprintf()的 返回值。 -- show() 应始终使用 snprintf()。 +- show() 方法在将格式化返回值返回用户空间的时候,禁止使用snprintf()。 + 如果可以保证不会发生缓冲区溢出,可以使用sprintf(),否则必须使用 + scnprintf()。 - store() 应返回缓冲区的已用字节数。如果整个缓存都已填满,只需返回 count 参数。
Signature · 1 line
2.20.1
Reviewed-by Alex Shi <[email protected]>
Thanks
Alex
Quoted 27 lines · Chen Zhou
Update the
show()usage according to the English version.Signed-off-by Chen Zhou <[email protected]>--- Documentation/translations/zh_CN/filesystems/sysfs.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)Documentation/translations/zh_CN/filesystems/sysfs.txt +4
-2@@ -213,10 +213,12 @@ Sysfs 将会为每次读写操作调用一次这个方法。这使得这些方 - 缓冲区应总是 PAGE_SIZE 大小。对于i386,这个值为4096。 -- show() 方法应该返回写入缓冲区的字节数,也就是 snprintf()的 +- show() 方法应该返回写入缓冲区的字节数,也就是 scnprintf()的 返回值。 -- show() 应始终使用 snprintf()。 +- show() 方法在将格式化返回值返回用户空间的时候,禁止使用snprintf()。 + 如果可以保证不会发生缓冲区溢出,可以使用sprintf(),否则必须使用 + scnprintf()。 - store() 应返回缓冲区的已用字节数。如果整个缓存都已填满,只需返回 count 参数。
Quoted 6 lines · On Wed, 10 Jun 2020 10:53:33 +0800 Chen Zhou <[email protected]> wrote:
Update the
show()usage according to the English version.Signed-off-by Chen Zhou <[email protected]>--- Documentation/translations/zh_CN/filesystems/sysfs.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Applied, thanks.
jon