mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
fs: orangefs: replace scnprintf() with sysfs_emit()
Documentation/filesystems/sysfs.rst mentions that show() should only use sysfs_emit() or sysfs_emit_at() when formating the value to be returned to user space. So replace scnprintf() with sysfs_emit(). Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
parent
cdfa130465
commit
313bf5b79e
1 changed files with 10 additions and 18 deletions
|
@ -217,36 +217,31 @@ static ssize_t sysfs_int_show(struct kobject *kobj,
|
|||
|
||||
if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
|
||||
if (!strcmp(attr->attr.name, "op_timeout_secs")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%d\n",
|
||||
op_timeout_secs);
|
||||
goto out;
|
||||
} else if (!strcmp(attr->attr.name,
|
||||
"slot_timeout_secs")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%d\n",
|
||||
slot_timeout_secs);
|
||||
goto out;
|
||||
} else if (!strcmp(attr->attr.name,
|
||||
"cache_timeout_msecs")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%d\n",
|
||||
orangefs_cache_timeout_msecs);
|
||||
goto out;
|
||||
} else if (!strcmp(attr->attr.name,
|
||||
"dcache_timeout_msecs")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%d\n",
|
||||
orangefs_dcache_timeout_msecs);
|
||||
goto out;
|
||||
} else if (!strcmp(attr->attr.name,
|
||||
"getattr_timeout_msecs")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%d\n",
|
||||
orangefs_getattr_timeout_msecs);
|
||||
goto out;
|
||||
|
@ -256,14 +251,12 @@ static ssize_t sysfs_int_show(struct kobject *kobj,
|
|||
|
||||
} else if (!strcmp(kobj->name, STATS_KOBJ_ID)) {
|
||||
if (!strcmp(attr->attr.name, "reads")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%lu\n",
|
||||
orangefs_stats.reads);
|
||||
goto out;
|
||||
} else if (!strcmp(attr->attr.name, "writes")) {
|
||||
rc = scnprintf(buf,
|
||||
PAGE_SIZE,
|
||||
rc = sysfs_emit(buf,
|
||||
"%lu\n",
|
||||
orangefs_stats.writes);
|
||||
goto out;
|
||||
|
@ -497,19 +490,18 @@ out:
|
|||
if (strcmp(kobj->name, PC_KOBJ_ID)) {
|
||||
if (new_op->upcall.req.param.op ==
|
||||
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
|
||||
rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
|
||||
rc = sysfs_emit(buf, "%d %d\n",
|
||||
(int)new_op->downcall.resp.param.u.
|
||||
value32[0],
|
||||
(int)new_op->downcall.resp.param.u.
|
||||
value32[1]);
|
||||
} else {
|
||||
rc = scnprintf(buf, PAGE_SIZE, "%d\n",
|
||||
rc = sysfs_emit(buf, "%d\n",
|
||||
(int)new_op->downcall.resp.param.u.value64);
|
||||
}
|
||||
} else {
|
||||
rc = scnprintf(
|
||||
rc = sysfs_emit(
|
||||
buf,
|
||||
PAGE_SIZE,
|
||||
"%s",
|
||||
new_op->downcall.resp.perf_count.buffer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue