diff options
author | Omar Sandoval <osandov@fb.com> | 2017-05-04 03:31:26 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-05-04 10:23:20 -0400 |
commit | 71b90511cb170dd3e13b640cc1a453b2dd92e023 (patch) | |
tree | fa2a1fd30e70b8fee6236864cb15e0b318072d0d | |
parent | c7e4145ae11b45931f117aa64c26be6cf58302df (diff) |
blk-mq-debugfs: don't open code strstrip()
Slightly more readable, plus we also strip leading spaces.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/blk-mq-debugfs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 2a19237455d4..109ae9f3d400 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c | |||
@@ -111,17 +111,16 @@ static ssize_t blk_queue_flags_store(struct file *file, const char __user *buf, | |||
111 | size_t count, loff_t *ppos) | 111 | size_t count, loff_t *ppos) |
112 | { | 112 | { |
113 | struct request_queue *q = file_inode(file)->i_private; | 113 | struct request_queue *q = file_inode(file)->i_private; |
114 | char op[16] = { }, *s; | 114 | char opbuf[16] = { }, *op; |
115 | 115 | ||
116 | if (count >= sizeof(op)) { | 116 | if (count >= sizeof(opbuf)) { |
117 | pr_err("%s: operation too long\n", __func__); | 117 | pr_err("%s: operation too long\n", __func__); |
118 | goto inval; | 118 | goto inval; |
119 | } | 119 | } |
120 | 120 | ||
121 | if (copy_from_user(op, buf, count)) | 121 | if (copy_from_user(opbuf, buf, count)) |
122 | return -EFAULT; | 122 | return -EFAULT; |
123 | s = op; | 123 | op = strstrip(opbuf); |
124 | strsep(&s, " \t\n"); /* strip trailing whitespace */ | ||
125 | if (strcmp(op, "run") == 0) { | 124 | if (strcmp(op, "run") == 0) { |
126 | blk_mq_run_hw_queues(q, true); | 125 | blk_mq_run_hw_queues(q, true); |
127 | } else if (strcmp(op, "start") == 0) { | 126 | } else if (strcmp(op, "start") == 0) { |