From: Jonathan Cameron <jic23@cam.ac.uk>
To: linux-kernel@vger.kernel.org
Cc: greg@kroah.com, rusty@rustcorp.com.au, adobriyan@gmail.com,
Jonathan Cameron <jic23@cam.ac.uk>
Subject: [PATCH 2/3] debugfs: move to new usr_strtobool
Date: Thu, 24 Mar 2011 13:23:44 +0000 [thread overview]
Message-ID: <1300973025-32497-3-git-send-email-jic23@cam.ac.uk> (raw)
In-Reply-To: <1300973025-32497-1-git-send-email-jic23@cam.ac.uk>
No functional chagnes requires that we eat errors from usr_strtobool.
If people want to not do this, then it should be at a later date.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
fs/debugfs/file.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 89d394d..1f0e3ef 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -428,26 +428,18 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
char buf[32];
- int buf_size;
+ int buf_size, ret;
+ bool bv;
u32 *val = file->private_data;
buf_size = min(count, (sizeof(buf)-1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
- switch (buf[0]) {
- case 'y':
- case 'Y':
- case '1':
- *val = 1;
- break;
- case 'n':
- case 'N':
- case '0':
- *val = 0;
- break;
- }
-
+ ret = usr_strtobool(buf, &bv);
+ if (!ret)
+ *val = bv;
+
return count;
}
--
1.7.3.4
next prev parent reply other threads:[~2011-03-24 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 13:23 [RFC PATCH 0/3 V2] Introduce usr_strtobool (previously kstrtobool) Jonathan Cameron
2011-03-24 13:23 ` [PATCH 1/3] Add a usr_strtobool function matching semantics of existing in kernel equivalents Jonathan Cameron
2011-04-19 1:36 ` Rusty Russell
2011-04-19 11:31 ` Jonathan Cameron
2011-03-24 13:23 ` Jonathan Cameron [this message]
2011-03-24 13:23 ` [PATCH 3/3] params.c: Use new usr_strtobool function to process boolean inputs Jonathan Cameron
2011-04-15 13:27 ` [RFC PATCH 0/3 V2] Introduce usr_strtobool (previously kstrtobool) Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300973025-32497-3-git-send-email-jic23@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=adobriyan@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®