Commit b29bebd6 authored by Jingoo Han's avatar Jingoo Han Committed by NeilBrown

md: replace strict_strto*() with kstrto*()

The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 90f5f7ad
...@@ -2002,9 +2002,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -2002,9 +2002,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
} else { } else {
int rv; int rv;
if (buf[0] == '+') if (buf[0] == '+')
rv = strict_strtoll(buf+1, 10, &offset); rv = kstrtoll(buf+1, 10, &offset);
else else
rv = strict_strtoll(buf, 10, &offset); rv = kstrtoll(buf, 10, &offset);
if (rv) if (rv)
return rv; return rv;
if (offset == 0) if (offset == 0)
...@@ -2139,7 +2139,7 @@ static ssize_t ...@@ -2139,7 +2139,7 @@ static ssize_t
backlog_store(struct mddev *mddev, const char *buf, size_t len) backlog_store(struct mddev *mddev, const char *buf, size_t len)
{ {
unsigned long backlog; unsigned long backlog;
int rv = strict_strtoul(buf, 10, &backlog); int rv = kstrtoul(buf, 10, &backlog);
if (rv) if (rv)
return rv; return rv;
if (backlog > COUNTER_MAX) if (backlog > COUNTER_MAX)
...@@ -2165,7 +2165,7 @@ chunksize_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -2165,7 +2165,7 @@ chunksize_store(struct mddev *mddev, const char *buf, size_t len)
unsigned long csize; unsigned long csize;
if (mddev->bitmap) if (mddev->bitmap)
return -EBUSY; return -EBUSY;
rv = strict_strtoul(buf, 10, &csize); rv = kstrtoul(buf, 10, &csize);
if (rv) if (rv)
return rv; return rv;
if (csize < 512 || if (csize < 512 ||
......
...@@ -504,7 +504,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv, ...@@ -504,7 +504,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
* First, parse the in-order required arguments * First, parse the in-order required arguments
* "chunk_size" is the only argument of this type. * "chunk_size" is the only argument of this type.
*/ */
if ((strict_strtoul(argv[0], 10, &value) < 0)) { if ((kstrtoul(argv[0], 10, &value) < 0)) {
rs->ti->error = "Bad chunk size"; rs->ti->error = "Bad chunk size";
return -EINVAL; return -EINVAL;
} else if (rs->raid_type->level == 1) { } else if (rs->raid_type->level == 1) {
...@@ -585,7 +585,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv, ...@@ -585,7 +585,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
continue; continue;
} }
if (strict_strtoul(argv[i], 10, &value) < 0) { if (kstrtoul(argv[i], 10, &value) < 0) {
rs->ti->error = "Bad numerical argument given in raid params"; rs->ti->error = "Bad numerical argument given in raid params";
return -EINVAL; return -EINVAL;
} }
...@@ -1181,7 +1181,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) ...@@ -1181,7 +1181,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
argv++; argv++;
/* number of RAID parameters */ /* number of RAID parameters */
if (strict_strtoul(argv[0], 10, &num_raid_params) < 0) { if (kstrtoul(argv[0], 10, &num_raid_params) < 0) {
ti->error = "Cannot understand number of RAID parameters"; ti->error = "Cannot understand number of RAID parameters";
return -EINVAL; return -EINVAL;
} }
...@@ -1194,7 +1194,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) ...@@ -1194,7 +1194,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
return -EINVAL; return -EINVAL;
} }
if ((strict_strtoul(argv[num_raid_params], 10, &num_raid_devs) < 0) || if ((kstrtoul(argv[num_raid_params], 10, &num_raid_devs) < 0) ||
(num_raid_devs >= INT_MAX)) { (num_raid_devs >= INT_MAX)) {
ti->error = "Cannot understand number of raid devices"; ti->error = "Cannot understand number of raid devices";
return -EINVAL; return -EINVAL;
......
...@@ -2867,7 +2867,7 @@ static ssize_t ...@@ -2867,7 +2867,7 @@ static ssize_t
offset_store(struct md_rdev *rdev, const char *buf, size_t len) offset_store(struct md_rdev *rdev, const char *buf, size_t len)
{ {
unsigned long long offset; unsigned long long offset;
if (strict_strtoull(buf, 10, &offset) < 0) if (kstrtoull(buf, 10, &offset) < 0)
return -EINVAL; return -EINVAL;
if (rdev->mddev->pers && rdev->raid_disk >= 0) if (rdev->mddev->pers && rdev->raid_disk >= 0)
return -EBUSY; return -EBUSY;
...@@ -2895,7 +2895,7 @@ static ssize_t new_offset_store(struct md_rdev *rdev, ...@@ -2895,7 +2895,7 @@ static ssize_t new_offset_store(struct md_rdev *rdev,
unsigned long long new_offset; unsigned long long new_offset;
struct mddev *mddev = rdev->mddev; struct mddev *mddev = rdev->mddev;
if (strict_strtoull(buf, 10, &new_offset) < 0) if (kstrtoull(buf, 10, &new_offset) < 0)
return -EINVAL; return -EINVAL;
if (mddev->sync_thread) if (mddev->sync_thread)
...@@ -2961,7 +2961,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors) ...@@ -2961,7 +2961,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors)
unsigned long long blocks; unsigned long long blocks;
sector_t new; sector_t new;
if (strict_strtoull(buf, 10, &blocks) < 0) if (kstrtoull(buf, 10, &blocks) < 0)
return -EINVAL; return -EINVAL;
if (blocks & 1ULL << (8 * sizeof(blocks) - 1)) if (blocks & 1ULL << (8 * sizeof(blocks) - 1))
...@@ -3069,7 +3069,7 @@ static ssize_t recovery_start_store(struct md_rdev *rdev, const char *buf, size_ ...@@ -3069,7 +3069,7 @@ static ssize_t recovery_start_store(struct md_rdev *rdev, const char *buf, size_
if (cmd_match(buf, "none")) if (cmd_match(buf, "none"))
recovery_start = MaxSector; recovery_start = MaxSector;
else if (strict_strtoull(buf, 10, &recovery_start)) else if (kstrtoull(buf, 10, &recovery_start))
return -EINVAL; return -EINVAL;
if (rdev->mddev->pers && if (rdev->mddev->pers &&
...@@ -3497,7 +3497,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3497,7 +3497,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
if (clevel[len-1] == '\n') if (clevel[len-1] == '\n')
len--; len--;
clevel[len] = 0; clevel[len] = 0;
if (strict_strtol(clevel, 10, &level)) if (kstrtol(clevel, 10, &level))
level = LEVEL_NONE; level = LEVEL_NONE;
if (request_module("md-%s", clevel) != 0) if (request_module("md-%s", clevel) != 0)
...@@ -4356,7 +4356,7 @@ sync_force_parallel_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -4356,7 +4356,7 @@ sync_force_parallel_store(struct mddev *mddev, const char *buf, size_t len)
{ {
long n; long n;
if (strict_strtol(buf, 10, &n)) if (kstrtol(buf, 10, &n))
return -EINVAL; return -EINVAL;
if (n != 0 && n != 1) if (n != 0 && n != 1)
...@@ -4424,7 +4424,7 @@ static ssize_t ...@@ -4424,7 +4424,7 @@ static ssize_t
min_sync_store(struct mddev *mddev, const char *buf, size_t len) min_sync_store(struct mddev *mddev, const char *buf, size_t len)
{ {
unsigned long long min; unsigned long long min;
if (strict_strtoull(buf, 10, &min)) if (kstrtoull(buf, 10, &min))
return -EINVAL; return -EINVAL;
if (min > mddev->resync_max) if (min > mddev->resync_max)
return -EINVAL; return -EINVAL;
...@@ -4461,7 +4461,7 @@ max_sync_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -4461,7 +4461,7 @@ max_sync_store(struct mddev *mddev, const char *buf, size_t len)
mddev->resync_max = MaxSector; mddev->resync_max = MaxSector;
else { else {
unsigned long long max; unsigned long long max;
if (strict_strtoull(buf, 10, &max)) if (kstrtoull(buf, 10, &max))
return -EINVAL; return -EINVAL;
if (max < mddev->resync_min) if (max < mddev->resync_min)
return -EINVAL; return -EINVAL;
......
...@@ -4924,7 +4924,7 @@ raid5_store_stripe_cache_size(struct mddev *mddev, const char *page, size_t len) ...@@ -4924,7 +4924,7 @@ raid5_store_stripe_cache_size(struct mddev *mddev, const char *page, size_t len)
if (!conf) if (!conf)
return -ENODEV; return -ENODEV;
if (strict_strtoul(page, 10, &new)) if (kstrtoul(page, 10, &new))
return -EINVAL; return -EINVAL;
err = raid5_set_cache_size(mddev, new); err = raid5_set_cache_size(mddev, new);
if (err) if (err)
...@@ -4957,7 +4957,7 @@ raid5_store_preread_threshold(struct mddev *mddev, const char *page, size_t len) ...@@ -4957,7 +4957,7 @@ raid5_store_preread_threshold(struct mddev *mddev, const char *page, size_t len)
if (!conf) if (!conf)
return -ENODEV; return -ENODEV;
if (strict_strtoul(page, 10, &new)) if (kstrtoul(page, 10, &new))
return -EINVAL; return -EINVAL;
if (new > conf->max_nr_stripes) if (new > conf->max_nr_stripes)
return -EINVAL; return -EINVAL;
......
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