diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-02-08 07:21:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:40 -0500 |
commit | 6d9c1fd425e6e1f0998218104cc046589e3af3d8 (patch) | |
tree | 28e718a93d74c5b87d1494a604a97352e44ade12 /fs/hpfs/super.c | |
parent | dd2cc4dff3b08ab54c4c177a080046bcc84ac41d (diff) |
mount options: fix hpfs
Add a .show_options super operation to hpfs.
Use generic_show_options() and save the complete option string in
hpfs_fill_super() and hpfs_remount_fs().
Also add a small fix: hpfs_remount_fs() should return -EINVAL on
error, instead of 1, which is not an error value.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs/super.c')
-rw-r--r-- | fs/hpfs/super.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 00971d999964..f63a699ec659 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -386,6 +386,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
386 | int lowercase, conv, eas, chk, errs, chkdsk, timeshift; | 386 | int lowercase, conv, eas, chk, errs, chkdsk, timeshift; |
387 | int o; | 387 | int o; |
388 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 388 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
389 | char *new_opts = kstrdup(data, GFP_KERNEL); | ||
389 | 390 | ||
390 | *flags |= MS_NOATIME; | 391 | *flags |= MS_NOATIME; |
391 | 392 | ||
@@ -398,15 +399,15 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
398 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, | 399 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, |
399 | &eas, &chk, &errs, &chkdsk, ×hift))) { | 400 | &eas, &chk, &errs, &chkdsk, ×hift))) { |
400 | printk("HPFS: bad mount options.\n"); | 401 | printk("HPFS: bad mount options.\n"); |
401 | return 1; | 402 | goto out_err; |
402 | } | 403 | } |
403 | if (o == 2) { | 404 | if (o == 2) { |
404 | hpfs_help(); | 405 | hpfs_help(); |
405 | return 1; | 406 | goto out_err; |
406 | } | 407 | } |
407 | if (timeshift != sbi->sb_timeshift) { | 408 | if (timeshift != sbi->sb_timeshift) { |
408 | printk("HPFS: timeshift can't be changed using remount.\n"); | 409 | printk("HPFS: timeshift can't be changed using remount.\n"); |
409 | return 1; | 410 | goto out_err; |
410 | } | 411 | } |
411 | 412 | ||
412 | unmark_dirty(s); | 413 | unmark_dirty(s); |
@@ -419,7 +420,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
419 | 420 | ||
420 | if (!(*flags & MS_RDONLY)) mark_dirty(s); | 421 | if (!(*flags & MS_RDONLY)) mark_dirty(s); |
421 | 422 | ||
423 | kfree(s->s_options); | ||
424 | s->s_options = new_opts; | ||
425 | |||
422 | return 0; | 426 | return 0; |
427 | |||
428 | out_err: | ||
429 | kfree(new_opts); | ||
430 | return -EINVAL; | ||
423 | } | 431 | } |
424 | 432 | ||
425 | /* Super operations */ | 433 | /* Super operations */ |
@@ -432,6 +440,7 @@ static const struct super_operations hpfs_sops = | |||
432 | .put_super = hpfs_put_super, | 440 | .put_super = hpfs_put_super, |
433 | .statfs = hpfs_statfs, | 441 | .statfs = hpfs_statfs, |
434 | .remount_fs = hpfs_remount_fs, | 442 | .remount_fs = hpfs_remount_fs, |
443 | .show_options = generic_show_options, | ||
435 | }; | 444 | }; |
436 | 445 | ||
437 | static int hpfs_fill_super(struct super_block *s, void *options, int silent) | 446 | static int hpfs_fill_super(struct super_block *s, void *options, int silent) |
@@ -454,6 +463,8 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
454 | 463 | ||
455 | int o; | 464 | int o; |
456 | 465 | ||
466 | save_mount_options(s, options); | ||
467 | |||
457 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 468 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
458 | if (!sbi) | 469 | if (!sbi) |
459 | return -ENOMEM; | 470 | return -ENOMEM; |