Skip to content

Commit 3ab7947

Browse files
dhowellsAl Viro
authored andcommitted
befs: Implement show_options
Implement the show_options superblock op for befs 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: Luis de Bethencourt <luisbg@osg.samsung.com> cc: Salah Triki <salah.triki@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent a66ca41 commit 3ab7947

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

fs/befs/linuxvfs.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/sched.h>
2121
#include <linux/cred.h>
2222
#include <linux/exportfs.h>
23+
#include <linux/seq_file.h>
2324

2425
#include "befs.h"
2526
#include "btree.h"
@@ -53,6 +54,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
5354
static void befs_put_super(struct super_block *);
5455
static int befs_remount(struct super_block *, int *, char *);
5556
static int befs_statfs(struct dentry *, struct kstatfs *);
57+
static int befs_show_options(struct seq_file *, struct dentry *);
5658
static int parse_options(char *, struct befs_mount_options *);
5759
static struct dentry *befs_fh_to_dentry(struct super_block *sb,
5860
struct fid *fid, int fh_len, int fh_type);
@@ -66,7 +68,7 @@ static const struct super_operations befs_sops = {
6668
.put_super = befs_put_super, /* uninit super */
6769
.statfs = befs_statfs, /* statfs */
6870
.remount_fs = befs_remount,
69-
.show_options = generic_show_options,
71+
.show_options = befs_show_options,
7072
};
7173

7274
/* slab cache for befs_inode_info objects */
@@ -771,6 +773,24 @@ parse_options(char *options, struct befs_mount_options *opts)
771773
return 1;
772774
}
773775

776+
static int befs_show_options(struct seq_file *m, struct dentry *root)
777+
{
778+
struct befs_sb_info *befs_sb = BEFS_SB(root->d_sb);
779+
struct befs_mount_options *opts = &befs_sb->mount_opts;
780+
781+
if (!uid_eq(opts->uid, GLOBAL_ROOT_UID))
782+
seq_printf(m, ",uid=%u",
783+
from_kuid_munged(&init_user_ns, opts->uid));
784+
if (!gid_eq(opts->gid, GLOBAL_ROOT_GID))
785+
seq_printf(m, ",gid=%u",
786+
from_kgid_munged(&init_user_ns, opts->gid));
787+
if (opts->iocharset)
788+
seq_printf(m, ",charset=%s", opts->iocharset);
789+
if (opts->debug)
790+
seq_puts(m, ",debug");
791+
return 0;
792+
}
793+
774794
/* This function has the responsibiltiy of getting the
775795
* filesystem ready for unmounting.
776796
* Basically, we free everything that we allocated in
@@ -804,8 +824,6 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
804824
const off_t x86_sb_off = 512;
805825
int blocksize;
806826

807-
save_mount_options(sb, data);
808-
809827
sb->s_fs_info = kzalloc(sizeof(*befs_sb), GFP_KERNEL);
810828
if (sb->s_fs_info == NULL)
811829
goto unacquire_none;

0 commit comments

Comments
 (0)