Commit 71b90511 authored by Omar Sandoval's avatar Omar Sandoval Committed by Jens Axboe

blk-mq-debugfs: don't open code strstrip()

Slightly more readable, plus we also strip leading spaces.
Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c7e4145a
...@@ -111,17 +111,16 @@ static ssize_t blk_queue_flags_store(struct file *file, const char __user *buf, ...@@ -111,17 +111,16 @@ static ssize_t blk_queue_flags_store(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct request_queue *q = file_inode(file)->i_private; struct request_queue *q = file_inode(file)->i_private;
char op[16] = { }, *s; char opbuf[16] = { }, *op;
if (count >= sizeof(op)) { if (count >= sizeof(opbuf)) {
pr_err("%s: operation too long\n", __func__); pr_err("%s: operation too long\n", __func__);
goto inval; goto inval;
} }
if (copy_from_user(op, buf, count)) if (copy_from_user(opbuf, buf, count))
return -EFAULT; return -EFAULT;
s = op; op = strstrip(opbuf);
strsep(&s, " \t\n"); /* strip trailing whitespace */
if (strcmp(op, "run") == 0) { if (strcmp(op, "run") == 0) {
blk_mq_run_hw_queues(q, true); blk_mq_run_hw_queues(q, true);
} else if (strcmp(op, "start") == 0) { } else if (strcmp(op, "start") == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment