Skip to content

Commit 86a1da6

Browse files
dhowellsAl Viro
authored andcommitted
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>
1 parent 677018a commit 86a1da6

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

fs/isofs/inode.c

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/parser.h>
2424
#include <linux/mpage.h>
2525
#include <linux/user_namespace.h>
26+
#include <linux/seq_file.h>
2627

2728
#include "isofs.h"
2829
#include "zisofs.h"
@@ -57,6 +58,7 @@ static void isofs_put_super(struct super_block *sb)
5758

5859
static int isofs_read_inode(struct inode *, int relocated);
5960
static int isofs_statfs (struct dentry *, struct kstatfs *);
61+
static int isofs_show_options(struct seq_file *, struct dentry *);
6062

6163
static struct kmem_cache *isofs_inode_cachep;
6264

@@ -123,7 +125,7 @@ static const struct super_operations isofs_sops = {
123125
.put_super = isofs_put_super,
124126
.statfs = isofs_statfs,
125127
.remount_fs = isofs_remount,
126-
.show_options = generic_show_options,
128+
.show_options = isofs_show_options,
127129
};
128130

129131

@@ -472,6 +474,48 @@ static int parse_options(char *options, struct iso9660_options *popt)
472474
return 1;
473475
}
474476

477+
/*
478+
* Display the mount options in /proc/mounts.
479+
*/
480+
static 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+
475519
/*
476520
* look if the driver can tell the multi session redirection value
477521
*
@@ -583,8 +627,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
583627
int table, error = -EINVAL;
584628
unsigned int vol_desc_start;
585629

586-
save_mount_options(s, data);
587-
588630
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
589631
if (!sbi)
590632
return -ENOMEM;
@@ -605,6 +647,8 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
605647
opt.blocksize = sb_min_blocksize(s, opt.blocksize);
606648

607649
sbi->s_high_sierra = 0; /* default is iso9660 */
650+
sbi->s_session = opt.session;
651+
sbi->s_sbsector = opt.sbsector;
608652

609653
vol_desc_start = (opt.sbsector != -1) ?
610654
opt.sbsector : isofs_get_last_session(s,opt.session);
@@ -911,6 +955,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
911955
table += 2;
912956
if (opt.check == 'r')
913957
table++;
958+
sbi->s_check = opt.check;
914959

915960
if (table)
916961
s->s_d_op = &isofs_dentry_ops[table - 1];

fs/isofs/isofs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ struct isofs_sb_info {
3636
unsigned long s_max_size;
3737

3838
int s_rock_offset; /* offset of SUSP fields within SU area */
39+
s32 s_sbsector;
3940
unsigned char s_joliet_level;
4041
unsigned char s_mapping;
42+
unsigned char s_check;
43+
unsigned char s_session;
4144
unsigned int s_high_sierra:1;
4245
unsigned int s_rock:2;
4346
unsigned int s_utf8:1;

0 commit comments

Comments
 (0)