diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-05-21 14:29:29 -0400 |
---|---|---|
committer | Dave Kleikamp <dave.kleikamp@oracle.com> | 2014-06-03 15:14:00 -0400 |
commit | bb5e50aaa80564268f950d1b2f764455afbfea82 (patch) | |
tree | 1bb0c17abc0b51204ca7d683aadd735ee31b4e93 /fs/jfs | |
parent | 4f65b6dbc7e8e35369e3f0b9bc80e703c3ad9dbf (diff) |
fs/jfs/super.c: convert simple_str to kstr
This patch replaces obsolete simple_str functions by kstr
use kstrtouint for
-uid_t ( __kernel_uid32_t )
-gid_t ( __kernel_gid32_t )
-jfs_sb_info->umask
-jfs_sb_info->minblks_trim
(all unsigned int)
newLVSize is s64 -> use kstrtol
Current parse_options behaviour stays the same ie it doesn't return kstr
rc but just 0 if function failed (parse_options callsites
return -EINVAL when there's anything wrong).
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/super.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index d1096fed5a62..adf8cb045b9e 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -272,7 +272,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
272 | case Opt_resize: | 272 | case Opt_resize: |
273 | { | 273 | { |
274 | char *resize = args[0].from; | 274 | char *resize = args[0].from; |
275 | *newLVSize = simple_strtoull(resize, &resize, 0); | 275 | int rc = kstrtoll(resize, 0, newLVSize); |
276 | |||
277 | if (rc) | ||
278 | goto cleanup; | ||
276 | break; | 279 | break; |
277 | } | 280 | } |
278 | case Opt_resize_nosize: | 281 | case Opt_resize_nosize: |
@@ -326,7 +329,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
326 | case Opt_uid: | 329 | case Opt_uid: |
327 | { | 330 | { |
328 | char *uid = args[0].from; | 331 | char *uid = args[0].from; |
329 | uid_t val = simple_strtoul(uid, &uid, 0); | 332 | uid_t val; |
333 | int rc = kstrtouint(uid, 0, &val); | ||
334 | |||
335 | if (rc) | ||
336 | goto cleanup; | ||
330 | sbi->uid = make_kuid(current_user_ns(), val); | 337 | sbi->uid = make_kuid(current_user_ns(), val); |
331 | if (!uid_valid(sbi->uid)) | 338 | if (!uid_valid(sbi->uid)) |
332 | goto cleanup; | 339 | goto cleanup; |
@@ -336,7 +343,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
336 | case Opt_gid: | 343 | case Opt_gid: |
337 | { | 344 | { |
338 | char *gid = args[0].from; | 345 | char *gid = args[0].from; |
339 | gid_t val = simple_strtoul(gid, &gid, 0); | 346 | gid_t val; |
347 | int rc = kstrtouint(gid, 0, &val); | ||
348 | |||
349 | if (rc) | ||
350 | goto cleanup; | ||
340 | sbi->gid = make_kgid(current_user_ns(), val); | 351 | sbi->gid = make_kgid(current_user_ns(), val); |
341 | if (!gid_valid(sbi->gid)) | 352 | if (!gid_valid(sbi->gid)) |
342 | goto cleanup; | 353 | goto cleanup; |
@@ -346,7 +357,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
346 | case Opt_umask: | 357 | case Opt_umask: |
347 | { | 358 | { |
348 | char *umask = args[0].from; | 359 | char *umask = args[0].from; |
349 | sbi->umask = simple_strtoul(umask, &umask, 8); | 360 | int rc = kstrtouint(umask, 8, &sbi->umask); |
361 | |||
362 | if (rc) | ||
363 | goto cleanup; | ||
350 | if (sbi->umask & ~0777) { | 364 | if (sbi->umask & ~0777) { |
351 | pr_err("JFS: Invalid value of umask\n"); | 365 | pr_err("JFS: Invalid value of umask\n"); |
352 | goto cleanup; | 366 | goto cleanup; |
@@ -377,13 +391,15 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
377 | { | 391 | { |
378 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | 392 | struct request_queue *q = bdev_get_queue(sb->s_bdev); |
379 | char *minblks_trim = args[0].from; | 393 | char *minblks_trim = args[0].from; |
394 | int rc; | ||
380 | if (blk_queue_discard(q)) { | 395 | if (blk_queue_discard(q)) { |
381 | *flag |= JFS_DISCARD; | 396 | *flag |= JFS_DISCARD; |
382 | sbi->minblks_trim = simple_strtoull( | 397 | rc = kstrtouint(minblks_trim, 0, |
383 | minblks_trim, &minblks_trim, 0); | 398 | &sbi->minblks_trim); |
384 | } else { | 399 | if (rc) |
400 | goto cleanup; | ||
401 | } else | ||
385 | pr_err("JFS: discard option not supported on device\n"); | 402 | pr_err("JFS: discard option not supported on device\n"); |
386 | } | ||
387 | break; | 403 | break; |
388 | } | 404 | } |
389 | 405 | ||