diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-02-08 07:21:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:41 -0500 |
commit | 6da80894cc11b5c0d79130a194789bab043a9b4b (patch) | |
tree | c996a98101f71465c04e7296e53bdb60ceae34f0 | |
parent | b76db735407a26c1036fdfef249ddc35eb969bc4 (diff) |
mount options: fix udf
Add a .show_options super operation to udf.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/udf/super.c | 74 | ||||
-rw-r--r-- | fs/udf/udf_sb.h | 2 |
2 files changed, 72 insertions, 4 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 3afe7647f94a..f3ac4abfc946 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -53,6 +53,8 @@ | |||
53 | #include <linux/vfs.h> | 53 | #include <linux/vfs.h> |
54 | #include <linux/vmalloc.h> | 54 | #include <linux/vmalloc.h> |
55 | #include <linux/errno.h> | 55 | #include <linux/errno.h> |
56 | #include <linux/mount.h> | ||
57 | #include <linux/seq_file.h> | ||
56 | #include <asm/byteorder.h> | 58 | #include <asm/byteorder.h> |
57 | 59 | ||
58 | #include <linux/udf_fs.h> | 60 | #include <linux/udf_fs.h> |
@@ -71,6 +73,8 @@ | |||
71 | #define VDS_POS_TERMINATING_DESC 6 | 73 | #define VDS_POS_TERMINATING_DESC 6 |
72 | #define VDS_POS_LENGTH 7 | 74 | #define VDS_POS_LENGTH 7 |
73 | 75 | ||
76 | #define UDF_DEFAULT_BLOCKSIZE 2048 | ||
77 | |||
74 | static char error_buf[1024]; | 78 | static char error_buf[1024]; |
75 | 79 | ||
76 | /* These are the "meat" - everything else is stuffing */ | 80 | /* These are the "meat" - everything else is stuffing */ |
@@ -95,6 +99,7 @@ static void udf_open_lvid(struct super_block *); | |||
95 | static void udf_close_lvid(struct super_block *); | 99 | static void udf_close_lvid(struct super_block *); |
96 | static unsigned int udf_count_free(struct super_block *); | 100 | static unsigned int udf_count_free(struct super_block *); |
97 | static int udf_statfs(struct dentry *, struct kstatfs *); | 101 | static int udf_statfs(struct dentry *, struct kstatfs *); |
102 | static int udf_show_options(struct seq_file *, struct vfsmount *); | ||
98 | 103 | ||
99 | struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) | 104 | struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) |
100 | { | 105 | { |
@@ -181,6 +186,7 @@ static const struct super_operations udf_sb_ops = { | |||
181 | .write_super = udf_write_super, | 186 | .write_super = udf_write_super, |
182 | .statfs = udf_statfs, | 187 | .statfs = udf_statfs, |
183 | .remount_fs = udf_remount_fs, | 188 | .remount_fs = udf_remount_fs, |
189 | .show_options = udf_show_options, | ||
184 | }; | 190 | }; |
185 | 191 | ||
186 | struct udf_options { | 192 | struct udf_options { |
@@ -247,6 +253,61 @@ static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count) | |||
247 | return 0; | 253 | return 0; |
248 | } | 254 | } |
249 | 255 | ||
256 | static int udf_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
257 | { | ||
258 | struct super_block *sb = mnt->mnt_sb; | ||
259 | struct udf_sb_info *sbi = UDF_SB(sb); | ||
260 | |||
261 | if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT)) | ||
262 | seq_puts(seq, ",nostrict"); | ||
263 | if (sb->s_blocksize != UDF_DEFAULT_BLOCKSIZE) | ||
264 | seq_printf(seq, ",bs=%lu", sb->s_blocksize); | ||
265 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UNHIDE)) | ||
266 | seq_puts(seq, ",unhide"); | ||
267 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UNDELETE)) | ||
268 | seq_puts(seq, ",undelete"); | ||
269 | if (!UDF_QUERY_FLAG(sb, UDF_FLAG_USE_AD_IN_ICB)) | ||
270 | seq_puts(seq, ",noadinicb"); | ||
271 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_USE_SHORT_AD)) | ||
272 | seq_puts(seq, ",shortad"); | ||
273 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_FORGET)) | ||
274 | seq_puts(seq, ",uid=forget"); | ||
275 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_IGNORE)) | ||
276 | seq_puts(seq, ",uid=ignore"); | ||
277 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_FORGET)) | ||
278 | seq_puts(seq, ",gid=forget"); | ||
279 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE)) | ||
280 | seq_puts(seq, ",gid=ignore"); | ||
281 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET)) | ||
282 | seq_printf(seq, ",uid=%u", sbi->s_uid); | ||
283 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) | ||
284 | seq_printf(seq, ",gid=%u", sbi->s_gid); | ||
285 | if (sbi->s_umask != 0) | ||
286 | seq_printf(seq, ",umask=%o", sbi->s_umask); | ||
287 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) | ||
288 | seq_printf(seq, ",session=%u", sbi->s_session); | ||
289 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) | ||
290 | seq_printf(seq, ",lastblock=%u", sbi->s_last_block); | ||
291 | /* | ||
292 | * s_anchor[2] could be zeroed out in case there is no anchor | ||
293 | * in the specified block, but then the "anchor=N" option | ||
294 | * originally given by the user wasn't effective, so it's OK | ||
295 | * if we don't show it. | ||
296 | */ | ||
297 | if (sbi->s_anchor[2] != 0) | ||
298 | seq_printf(seq, ",anchor=%u", sbi->s_anchor[2]); | ||
299 | /* | ||
300 | * volume, partition, fileset and rootdir seem to be ignored | ||
301 | * currently | ||
302 | */ | ||
303 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) | ||
304 | seq_puts(seq, ",utf8"); | ||
305 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP) && sbi->s_nls_map) | ||
306 | seq_printf(seq, ",iocharset=%s", sbi->s_nls_map->charset); | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
250 | /* | 311 | /* |
251 | * udf_parse_options | 312 | * udf_parse_options |
252 | * | 313 | * |
@@ -339,13 +400,14 @@ static match_table_t tokens = { | |||
339 | {Opt_err, NULL} | 400 | {Opt_err, NULL} |
340 | }; | 401 | }; |
341 | 402 | ||
342 | static int udf_parse_options(char *options, struct udf_options *uopt) | 403 | static int udf_parse_options(char *options, struct udf_options *uopt, |
404 | bool remount) | ||
343 | { | 405 | { |
344 | char *p; | 406 | char *p; |
345 | int option; | 407 | int option; |
346 | 408 | ||
347 | uopt->novrs = 0; | 409 | uopt->novrs = 0; |
348 | uopt->blocksize = 2048; | 410 | uopt->blocksize = UDF_DEFAULT_BLOCKSIZE; |
349 | uopt->partition = 0xFFFF; | 411 | uopt->partition = 0xFFFF; |
350 | uopt->session = 0xFFFFFFFF; | 412 | uopt->session = 0xFFFFFFFF; |
351 | uopt->lastblock = 0; | 413 | uopt->lastblock = 0; |
@@ -415,11 +477,15 @@ static int udf_parse_options(char *options, struct udf_options *uopt) | |||
415 | if (match_int(args, &option)) | 477 | if (match_int(args, &option)) |
416 | return 0; | 478 | return 0; |
417 | uopt->session = option; | 479 | uopt->session = option; |
480 | if (!remount) | ||
481 | uopt->flags |= (1 << UDF_FLAG_SESSION_SET); | ||
418 | break; | 482 | break; |
419 | case Opt_lastblock: | 483 | case Opt_lastblock: |
420 | if (match_int(args, &option)) | 484 | if (match_int(args, &option)) |
421 | return 0; | 485 | return 0; |
422 | uopt->lastblock = option; | 486 | uopt->lastblock = option; |
487 | if (!remount) | ||
488 | uopt->flags |= (1 << UDF_FLAG_LASTBLOCK_SET); | ||
423 | break; | 489 | break; |
424 | case Opt_anchor: | 490 | case Opt_anchor: |
425 | if (match_int(args, &option)) | 491 | if (match_int(args, &option)) |
@@ -497,7 +563,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) | |||
497 | uopt.gid = sbi->s_gid; | 563 | uopt.gid = sbi->s_gid; |
498 | uopt.umask = sbi->s_umask; | 564 | uopt.umask = sbi->s_umask; |
499 | 565 | ||
500 | if (!udf_parse_options(options, &uopt)) | 566 | if (!udf_parse_options(options, &uopt, true)) |
501 | return -EINVAL; | 567 | return -EINVAL; |
502 | 568 | ||
503 | sbi->s_flags = uopt.flags; | 569 | sbi->s_flags = uopt.flags; |
@@ -1679,7 +1745,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1679 | 1745 | ||
1680 | mutex_init(&sbi->s_alloc_mutex); | 1746 | mutex_init(&sbi->s_alloc_mutex); |
1681 | 1747 | ||
1682 | if (!udf_parse_options((char *)options, &uopt)) | 1748 | if (!udf_parse_options((char *)options, &uopt, false)) |
1683 | goto error_out; | 1749 | goto error_out; |
1684 | 1750 | ||
1685 | if (uopt.flags & (1 << UDF_FLAG_UTF8) && | 1751 | if (uopt.flags & (1 << UDF_FLAG_UTF8) && |
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index d9adb0fff84c..737d1c604eea 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #define UDF_FLAG_GID_IGNORE 14 | 26 | #define UDF_FLAG_GID_IGNORE 14 |
27 | #define UDF_FLAG_UID_SET 15 | 27 | #define UDF_FLAG_UID_SET 15 |
28 | #define UDF_FLAG_GID_SET 16 | 28 | #define UDF_FLAG_GID_SET 16 |
29 | #define UDF_FLAG_SESSION_SET 17 | ||
30 | #define UDF_FLAG_LASTBLOCK_SET 18 | ||
29 | 31 | ||
30 | #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 | 32 | #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 |
31 | #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 | 33 | #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 |