diff options
author | Lukas Czerner <lczerner@redhat.com> | 2013-04-11 23:37:19 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-04-11 23:37:19 -0400 |
commit | e1091b157c330a21bb0eaa881efe0489a1697ed7 (patch) | |
tree | c6e21fba69f6d306777096f1f14ad94c7d8990ea | |
parent | 7e8b12c60ad38fb90a162df4e6fc120e3bee104e (diff) |
ext4: Use kstrtoul() instead of parse_strtoul()
In parse_strtoul() we're still using deprecated simple_strtoul(). Remove
parse_strtoul() altogether and replace it with kstrtoul()
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/super.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f355c28fa080..bfa29ecfb47a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2394,19 +2394,6 @@ static int parse_strtoull(const char *buf, | |||
2394 | return ret; | 2394 | return ret; |
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | static int parse_strtoul(const char *buf, | ||
2398 | unsigned long max, unsigned long *value) | ||
2399 | { | ||
2400 | char *endp; | ||
2401 | |||
2402 | *value = simple_strtoul(skip_spaces(buf), &endp, 0); | ||
2403 | endp = skip_spaces(endp); | ||
2404 | if (*endp || *value > max) | ||
2405 | return -EINVAL; | ||
2406 | |||
2407 | return 0; | ||
2408 | } | ||
2409 | |||
2410 | static ssize_t delayed_allocation_blocks_show(struct ext4_attr *a, | 2397 | static ssize_t delayed_allocation_blocks_show(struct ext4_attr *a, |
2411 | struct ext4_sb_info *sbi, | 2398 | struct ext4_sb_info *sbi, |
2412 | char *buf) | 2399 | char *buf) |
@@ -2446,11 +2433,13 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a, | |||
2446 | const char *buf, size_t count) | 2433 | const char *buf, size_t count) |
2447 | { | 2434 | { |
2448 | unsigned long t; | 2435 | unsigned long t; |
2436 | int ret; | ||
2449 | 2437 | ||
2450 | if (parse_strtoul(buf, 0x40000000, &t)) | 2438 | ret = kstrtoul(skip_spaces(buf), 0, &t); |
2451 | return -EINVAL; | 2439 | if (ret) |
2440 | return ret; | ||
2452 | 2441 | ||
2453 | if (t && !is_power_of_2(t)) | 2442 | if (t && (!is_power_of_2(t) || t > 0x40000000)) |
2454 | return -EINVAL; | 2443 | return -EINVAL; |
2455 | 2444 | ||
2456 | sbi->s_inode_readahead_blks = t; | 2445 | sbi->s_inode_readahead_blks = t; |
@@ -2471,9 +2460,11 @@ static ssize_t sbi_ui_store(struct ext4_attr *a, | |||
2471 | { | 2460 | { |
2472 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset); | 2461 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset); |
2473 | unsigned long t; | 2462 | unsigned long t; |
2463 | int ret; | ||
2474 | 2464 | ||
2475 | if (parse_strtoul(buf, 0xffffffff, &t)) | 2465 | ret = kstrtoul(skip_spaces(buf), 0, &t); |
2476 | return -EINVAL; | 2466 | if (ret) |
2467 | return ret; | ||
2477 | *ui = t; | 2468 | *ui = t; |
2478 | return count; | 2469 | return count; |
2479 | } | 2470 | } |