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: Jingoo Han <jg1.han@samsung.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
90f5f7ad4f
commit
b29bebd66d
|
@ -2002,9 +2002,9 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
|
|||
} else {
|
||||
int rv;
|
||||
if (buf[0] == '+')
|
||||
rv = strict_strtoll(buf+1, 10, &offset);
|
||||
rv = kstrtoll(buf+1, 10, &offset);
|
||||
else
|
||||
rv = strict_strtoll(buf, 10, &offset);
|
||||
rv = kstrtoll(buf, 10, &offset);
|
||||
if (rv)
|
||||
return rv;
|
||||
if (offset == 0)
|
||||
|
@ -2139,7 +2139,7 @@ static ssize_t
|
|||
backlog_store(struct mddev *mddev, const char *buf, size_t len)
|
||||
{
|
||||
unsigned long backlog;
|
||||
int rv = strict_strtoul(buf, 10, &backlog);
|
||||
int rv = kstrtoul(buf, 10, &backlog);
|
||||
if (rv)
|
||||
return rv;
|
||||
if (backlog > COUNTER_MAX)
|
||||
|
@ -2165,7 +2165,7 @@ chunksize_store(struct mddev *mddev, const char *buf, size_t len)
|
|||
unsigned long csize;
|
||||
if (mddev->bitmap)
|
||||
return -EBUSY;
|
||||
rv = strict_strtoul(buf, 10, &csize);
|
||||
rv = kstrtoul(buf, 10, &csize);
|
||||
if (rv)
|
||||
return rv;
|
||||
if (csize < 512 ||
|
||||
|
|
|
@ -504,7 +504,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
|
|||
* First, parse the in-order required arguments
|
||||
* "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";
|
||||
return -EINVAL;
|
||||
} else if (rs->raid_type->level == 1) {
|
||||
|
@ -585,7 +585,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
|
|||
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";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1181,7 +1181,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||
argv++;
|
||||
|
||||
/* 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";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1194,7 +1194,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||
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)) {
|
||||
ti->error = "Cannot understand number of raid devices";
|
||||
return -EINVAL;
|
||||
|
|
|
@ -2867,7 +2867,7 @@ static ssize_t
|
|||
offset_store(struct md_rdev *rdev, const char *buf, size_t len)
|
||||
{
|
||||
unsigned long long offset;
|
||||
if (strict_strtoull(buf, 10, &offset) < 0)
|
||||
if (kstrtoull(buf, 10, &offset) < 0)
|
||||
return -EINVAL;
|
||||
if (rdev->mddev->pers && rdev->raid_disk >= 0)
|
||||
return -EBUSY;
|
||||
|
@ -2895,7 +2895,7 @@ static ssize_t new_offset_store(struct md_rdev *rdev,
|
|||
unsigned long long new_offset;
|
||||
struct mddev *mddev = rdev->mddev;
|
||||
|
||||
if (strict_strtoull(buf, 10, &new_offset) < 0)
|
||||
if (kstrtoull(buf, 10, &new_offset) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (mddev->sync_thread)
|
||||
|
@ -2961,7 +2961,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors)
|
|||
unsigned long long blocks;
|
||||
sector_t new;
|
||||
|
||||
if (strict_strtoull(buf, 10, &blocks) < 0)
|
||||
if (kstrtoull(buf, 10, &blocks) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
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_
|
|||
|
||||
if (cmd_match(buf, "none"))
|
||||
recovery_start = MaxSector;
|
||||
else if (strict_strtoull(buf, 10, &recovery_start))
|
||||
else if (kstrtoull(buf, 10, &recovery_start))
|
||||
return -EINVAL;
|
||||
|
||||
if (rdev->mddev->pers &&
|
||||
|
@ -3497,7 +3497,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
|
|||
if (clevel[len-1] == '\n')
|
||||
len--;
|
||||
clevel[len] = 0;
|
||||
if (strict_strtol(clevel, 10, &level))
|
||||
if (kstrtol(clevel, 10, &level))
|
||||
level = LEVEL_NONE;
|
||||
|
||||
if (request_module("md-%s", clevel) != 0)
|
||||
|
@ -4356,7 +4356,7 @@ sync_force_parallel_store(struct mddev *mddev, const char *buf, size_t len)
|
|||
{
|
||||
long n;
|
||||
|
||||
if (strict_strtol(buf, 10, &n))
|
||||
if (kstrtol(buf, 10, &n))
|
||||
return -EINVAL;
|
||||
|
||||
if (n != 0 && n != 1)
|
||||
|
@ -4424,7 +4424,7 @@ static ssize_t
|
|||
min_sync_store(struct mddev *mddev, const char *buf, size_t len)
|
||||
{
|
||||
unsigned long long min;
|
||||
if (strict_strtoull(buf, 10, &min))
|
||||
if (kstrtoull(buf, 10, &min))
|
||||
return -EINVAL;
|
||||
if (min > mddev->resync_max)
|
||||
return -EINVAL;
|
||||
|
@ -4461,7 +4461,7 @@ max_sync_store(struct mddev *mddev, const char *buf, size_t len)
|
|||
mddev->resync_max = MaxSector;
|
||||
else {
|
||||
unsigned long long max;
|
||||
if (strict_strtoull(buf, 10, &max))
|
||||
if (kstrtoull(buf, 10, &max))
|
||||
return -EINVAL;
|
||||
if (max < mddev->resync_min)
|
||||
return -EINVAL;
|
||||
|
|
|
@ -4924,7 +4924,7 @@ raid5_store_stripe_cache_size(struct mddev *mddev, const char *page, size_t len)
|
|||
if (!conf)
|
||||
return -ENODEV;
|
||||
|
||||
if (strict_strtoul(page, 10, &new))
|
||||
if (kstrtoul(page, 10, &new))
|
||||
return -EINVAL;
|
||||
err = raid5_set_cache_size(mddev, new);
|
||||
if (err)
|
||||
|
@ -4957,7 +4957,7 @@ raid5_store_preread_threshold(struct mddev *mddev, const char *page, size_t len)
|
|||
if (!conf)
|
||||
return -ENODEV;
|
||||
|
||||
if (strict_strtoul(page, 10, &new))
|
||||
if (kstrtoul(page, 10, &new))
|
||||
return -EINVAL;
|
||||
if (new > conf->max_nr_stripes)
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue