summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-07-05 11:25:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-07-11 06:06:18 -0400
commit86a1da6d30ad727c2a9cc5d6a51bff6d830036b5 (patch)
tree716a42cb62930fa8caf36aa748991f31e2de4012
parent677018a6ce620c8ca85abae1a07a41d66247d420 (diff)
isofs: Implement show_options
Implement the show_options superblock op for omfs as part of a bid to get rid of s_options and generic_show_options() to make it easier to implement a context-based mount where the mount options can be passed individually over a file descriptor. Signed-off-by: David Howells <dhowells@redhat.com> cc: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/isofs/inode.c51
-rw-r--r--fs/isofs/isofs.h3
2 files changed, 51 insertions, 3 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 020ba0936146..f80ee600d1bc 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -23,6 +23,7 @@
23#include <linux/parser.h> 23#include <linux/parser.h>
24#include <linux/mpage.h> 24#include <linux/mpage.h>
25#include <linux/user_namespace.h> 25#include <linux/user_namespace.h>
26#include <linux/seq_file.h>
26 27
27#include "isofs.h" 28#include "isofs.h"
28#include "zisofs.h" 29#include "zisofs.h"
@@ -57,6 +58,7 @@ static void isofs_put_super(struct super_block *sb)
57 58
58static int isofs_read_inode(struct inode *, int relocated); 59static int isofs_read_inode(struct inode *, int relocated);
59static int isofs_statfs (struct dentry *, struct kstatfs *); 60static int isofs_statfs (struct dentry *, struct kstatfs *);
61static int isofs_show_options(struct seq_file *, struct dentry *);
60 62
61static struct kmem_cache *isofs_inode_cachep; 63static struct kmem_cache *isofs_inode_cachep;
62 64
@@ -123,7 +125,7 @@ static const struct super_operations isofs_sops = {
123 .put_super = isofs_put_super, 125 .put_super = isofs_put_super,
124 .statfs = isofs_statfs, 126 .statfs = isofs_statfs,
125 .remount_fs = isofs_remount, 127 .remount_fs = isofs_remount,
126 .show_options = generic_show_options, 128 .show_options = isofs_show_options,
127}; 129};
128 130
129 131
@@ -473,6 +475,48 @@ static int parse_options(char *options, struct iso9660_options *popt)
473} 475}
474 476
475/* 477/*
478 * Display the mount options in /proc/mounts.
479 */
480static int isofs_show_options(struct seq_file *m, struct dentry *root)
481{
482 struct isofs_sb_info *sbi = ISOFS_SB(root->d_sb);
483
484 if (!sbi->s_rock) seq_puts(m, ",norock");
485 else if (!sbi->s_joliet_level) seq_puts(m, ",nojoliet");
486 if (sbi->s_cruft) seq_puts(m, ",cruft");
487 if (sbi->s_hide) seq_puts(m, ",hide");
488 if (sbi->s_nocompress) seq_puts(m, ",nocompress");
489 if (sbi->s_overriderockperm) seq_puts(m, ",overriderockperm");
490 if (sbi->s_showassoc) seq_puts(m, ",showassoc");
491 if (sbi->s_utf8) seq_puts(m, ",utf8");
492
493 if (sbi->s_check) seq_printf(m, ",check=%c", sbi->s_check);
494 if (sbi->s_mapping) seq_printf(m, ",map=%c", sbi->s_mapping);
495 if (sbi->s_session != -1) seq_printf(m, ",session=%u", sbi->s_session);
496 if (sbi->s_sbsector != -1) seq_printf(m, ",sbsector=%u", sbi->s_sbsector);
497
498 if (root->d_sb->s_blocksize != 1024)
499 seq_printf(m, ",blocksize=%lu", root->d_sb->s_blocksize);
500
501 if (sbi->s_uid_set)
502 seq_printf(m, ",uid=%u",
503 from_kuid_munged(&init_user_ns, sbi->s_uid));
504 if (sbi->s_gid_set)
505 seq_printf(m, ",gid=%u",
506 from_kgid_munged(&init_user_ns, sbi->s_gid));
507
508 if (sbi->s_dmode != ISOFS_INVALID_MODE)
509 seq_printf(m, ",dmode=%o", sbi->s_dmode);
510 if (sbi->s_fmode != ISOFS_INVALID_MODE)
511 seq_printf(m, ",fmode=%o", sbi->s_fmode);
512
513 if (sbi->s_nls_iocharset &&
514 strcmp(sbi->s_nls_iocharset->charset, CONFIG_NLS_DEFAULT) != 0)
515 seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset);
516 return 0;
517}
518
519/*
476 * look if the driver can tell the multi session redirection value 520 * look if the driver can tell the multi session redirection value
477 * 521 *
478 * don't change this if you don't know what you do, please! 522 * don't change this if you don't know what you do, please!
@@ -583,8 +627,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
583 int table, error = -EINVAL; 627 int table, error = -EINVAL;
584 unsigned int vol_desc_start; 628 unsigned int vol_desc_start;
585 629
586 save_mount_options(s, data);
587
588 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 630 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
589 if (!sbi) 631 if (!sbi)
590 return -ENOMEM; 632 return -ENOMEM;
@@ -605,6 +647,8 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
605 opt.blocksize = sb_min_blocksize(s, opt.blocksize); 647 opt.blocksize = sb_min_blocksize(s, opt.blocksize);
606 648
607 sbi->s_high_sierra = 0; /* default is iso9660 */ 649 sbi->s_high_sierra = 0; /* default is iso9660 */
650 sbi->s_session = opt.session;
651 sbi->s_sbsector = opt.sbsector;
608 652
609 vol_desc_start = (opt.sbsector != -1) ? 653 vol_desc_start = (opt.sbsector != -1) ?
610 opt.sbsector : isofs_get_last_session(s,opt.session); 654 opt.sbsector : isofs_get_last_session(s,opt.session);
@@ -911,6 +955,7 @@ root_found:
911 table += 2; 955 table += 2;
912 if (opt.check == 'r') 956 if (opt.check == 'r')
913 table++; 957 table++;
958 sbi->s_check = opt.check;
914 959
915 if (table) 960 if (table)
916 s->s_d_op = &isofs_dentry_ops[table - 1]; 961 s->s_d_op = &isofs_dentry_ops[table - 1];
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 0ac4c1f73fbd..133a456b0425 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -36,8 +36,11 @@ struct isofs_sb_info {
36 unsigned long s_max_size; 36 unsigned long s_max_size;
37 37
38 int s_rock_offset; /* offset of SUSP fields within SU area */ 38 int s_rock_offset; /* offset of SUSP fields within SU area */
39 s32 s_sbsector;
39 unsigned char s_joliet_level; 40 unsigned char s_joliet_level;
40 unsigned char s_mapping; 41 unsigned char s_mapping;
42 unsigned char s_check;
43 unsigned char s_session;
41 unsigned int s_high_sierra:1; 44 unsigned int s_high_sierra:1;
42 unsigned int s_rock:2; 45 unsigned int s_rock:2;
43 unsigned int s_utf8:1; 46 unsigned int s_utf8:1;