Commit 6da80894cc11b5c0d79130a194789bab043a9b4b
Committed by
Linus Torvalds
1 parent
b76db73540
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 72 additions and 4 deletions Side-by-side Diff
fs/udf/super.c
... | ... | @@ -53,6 +53,8 @@ |
53 | 53 | #include <linux/vfs.h> |
54 | 54 | #include <linux/vmalloc.h> |
55 | 55 | #include <linux/errno.h> |
56 | +#include <linux/mount.h> | |
57 | +#include <linux/seq_file.h> | |
56 | 58 | #include <asm/byteorder.h> |
57 | 59 | |
58 | 60 | #include <linux/udf_fs.h> |
... | ... | @@ -71,6 +73,8 @@ |
71 | 73 | #define VDS_POS_TERMINATING_DESC 6 |
72 | 74 | #define VDS_POS_LENGTH 7 |
73 | 75 | |
76 | +#define UDF_DEFAULT_BLOCKSIZE 2048 | |
77 | + | |
74 | 78 | static char error_buf[1024]; |
75 | 79 | |
76 | 80 | /* These are the "meat" - everything else is stuffing */ |
... | ... | @@ -95,6 +99,7 @@ |
95 | 99 | static void udf_close_lvid(struct super_block *); |
96 | 100 | static unsigned int udf_count_free(struct super_block *); |
97 | 101 | static int udf_statfs(struct dentry *, struct kstatfs *); |
102 | +static int udf_show_options(struct seq_file *, struct vfsmount *); | |
98 | 103 | |
99 | 104 | struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) |
100 | 105 | { |
... | ... | @@ -181,6 +186,7 @@ |
181 | 186 | .write_super = udf_write_super, |
182 | 187 | .statfs = udf_statfs, |
183 | 188 | .remount_fs = udf_remount_fs, |
189 | + .show_options = udf_show_options, | |
184 | 190 | }; |
185 | 191 | |
186 | 192 | struct udf_options { |
... | ... | @@ -247,6 +253,61 @@ |
247 | 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 | 312 | * udf_parse_options |
252 | 313 | * |
253 | 314 | |
... | ... | @@ -339,13 +400,14 @@ |
339 | 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 | 406 | char *p; |
345 | 407 | int option; |
346 | 408 | |
347 | 409 | uopt->novrs = 0; |
348 | - uopt->blocksize = 2048; | |
410 | + uopt->blocksize = UDF_DEFAULT_BLOCKSIZE; | |
349 | 411 | uopt->partition = 0xFFFF; |
350 | 412 | uopt->session = 0xFFFFFFFF; |
351 | 413 | uopt->lastblock = 0; |
352 | 414 | |
... | ... | @@ -415,11 +477,15 @@ |
415 | 477 | if (match_int(args, &option)) |
416 | 478 | return 0; |
417 | 479 | uopt->session = option; |
480 | + if (!remount) | |
481 | + uopt->flags |= (1 << UDF_FLAG_SESSION_SET); | |
418 | 482 | break; |
419 | 483 | case Opt_lastblock: |
420 | 484 | if (match_int(args, &option)) |
421 | 485 | return 0; |
422 | 486 | uopt->lastblock = option; |
487 | + if (!remount) | |
488 | + uopt->flags |= (1 << UDF_FLAG_LASTBLOCK_SET); | |
423 | 489 | break; |
424 | 490 | case Opt_anchor: |
425 | 491 | if (match_int(args, &option)) |
... | ... | @@ -497,7 +563,7 @@ |
497 | 563 | uopt.gid = sbi->s_gid; |
498 | 564 | uopt.umask = sbi->s_umask; |
499 | 565 | |
500 | - if (!udf_parse_options(options, &uopt)) | |
566 | + if (!udf_parse_options(options, &uopt, true)) | |
501 | 567 | return -EINVAL; |
502 | 568 | |
503 | 569 | sbi->s_flags = uopt.flags; |
... | ... | @@ -1679,7 +1745,7 @@ |
1679 | 1745 | |
1680 | 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 | 1749 | goto error_out; |
1684 | 1750 | |
1685 | 1751 | if (uopt.flags & (1 << UDF_FLAG_UTF8) && |
fs/udf/udf_sb.h
... | ... | @@ -26,6 +26,8 @@ |
26 | 26 | #define UDF_FLAG_GID_IGNORE 14 |
27 | 27 | #define UDF_FLAG_UID_SET 15 |
28 | 28 | #define UDF_FLAG_GID_SET 16 |
29 | +#define UDF_FLAG_SESSION_SET 17 | |
30 | +#define UDF_FLAG_LASTBLOCK_SET 18 | |
29 | 31 | |
30 | 32 | #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 |
31 | 33 | #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 |