From: Roman Zippel This adds support for show_options. It also fixes some namespace polution in the hfsplus driver. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton --- fs/hfs/super.c | 25 +++++++++++++++++++++++++ fs/hfsplus/hfsplus_fs.h | 5 +++-- fs/hfsplus/options.c | 26 ++++++++++++++++++++++++-- fs/hfsplus/super.c | 5 +++-- 4 files changed, 55 insertions(+), 6 deletions(-) diff -puN fs/hfsplus/hfsplus_fs.h~hfs-show_options-support fs/hfsplus/hfsplus_fs.h --- devel/fs/hfsplus/hfsplus_fs.h~hfs-show_options-support 2005-08-01 16:46:53.000000000 -0700 +++ devel-akpm/fs/hfsplus/hfsplus_fs.h 2005-08-01 16:46:53.000000000 -0700 @@ -343,8 +343,9 @@ ssize_t hfsplus_getxattr(struct dentry * ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); /* options.c */ -int parse_options(char *, struct hfsplus_sb_info *); -void fill_defaults(struct hfsplus_sb_info *); +int hfsplus_parse_options(char *, struct hfsplus_sb_info *); +void hfsplus_fill_defaults(struct hfsplus_sb_info *); +int hfsplus_show_options(struct seq_file *, struct vfsmount *); /* tables.c */ extern u16 hfsplus_case_fold_table[]; diff -puN fs/hfsplus/options.c~hfs-show_options-support fs/hfsplus/options.c --- devel/fs/hfsplus/options.c~hfs-show_options-support 2005-08-01 16:46:53.000000000 -0700 +++ devel-akpm/fs/hfsplus/options.c 2005-08-01 16:46:53.000000000 -0700 @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include "hfsplus_fs.h" enum { @@ -38,7 +40,7 @@ static match_table_t tokens = { }; /* Initialize an options object to reasonable defaults */ -void fill_defaults(struct hfsplus_sb_info *opts) +void hfsplus_fill_defaults(struct hfsplus_sb_info *opts) { if (!opts) return; @@ -63,7 +65,7 @@ static inline int match_fourchar(substri /* Parse options from mount. Returns 0 on failure */ /* input is the options passed to mount() as a string */ -int parse_options(char *input, struct hfsplus_sb_info *sbi) +int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) { char *p; substring_t args[MAX_OPT_ARGS]; @@ -160,3 +162,23 @@ done: return 1; } + +int hfsplus_show_options(struct seq_file *seq, struct vfsmount *mnt) +{ + struct hfsplus_sb_info *sbi = &HFSPLUS_SB(mnt->mnt_sb); + + if (sbi->creator != HFSPLUS_DEF_CR_TYPE) + seq_printf(seq, ",creator=%.4s", (char *)&sbi->creator); + if (sbi->type != HFSPLUS_DEF_CR_TYPE) + seq_printf(seq, ",type=%.4s", (char *)&sbi->type); + seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask, sbi->uid, sbi->gid); + if (sbi->part >= 0) + seq_printf(seq, ",part=%u", sbi->part); + if (sbi->session >= 0) + seq_printf(seq, ",session=%u", sbi->session); + if (sbi->nls) + seq_printf(seq, ",nls=%s", sbi->nls->charset); + if (sbi->flags & HFSPLUS_SB_NODECOMPOSE) + seq_printf(seq, ",nodecompose"); + return 0; +} diff -puN fs/hfsplus/super.c~hfs-show_options-support fs/hfsplus/super.c --- devel/fs/hfsplus/super.c~hfs-show_options-support 2005-08-01 16:46:53.000000000 -0700 +++ devel-akpm/fs/hfsplus/super.c 2005-08-01 16:46:53.000000000 -0700 @@ -277,6 +277,7 @@ static struct super_operations hfsplus_s .write_super = hfsplus_write_super, .statfs = hfsplus_statfs, .remount_fs = hfsplus_remount, + .show_options = hfsplus_show_options, }; static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) @@ -297,8 +298,8 @@ static int hfsplus_fill_super(struct sup memset(sbi, 0, sizeof(HFSPLUS_SB(sb))); sb->s_fs_info = sbi; INIT_HLIST_HEAD(&sbi->rsrc_inodes); - fill_defaults(sbi); - if (!parse_options(data, sbi)) { + hfsplus_fill_defaults(sbi); + if (!hfsplus_parse_options(data, sbi)) { if (!silent) printk("HFS+-fs: unable to parse mount options\n"); err = -EINVAL; diff -puN fs/hfs/super.c~hfs-show_options-support fs/hfs/super.c --- devel/fs/hfs/super.c~hfs-show_options-support 2005-08-01 16:46:53.000000000 -0700 +++ devel-akpm/fs/hfs/super.c 2005-08-01 16:46:53.000000000 -0700 @@ -15,8 +15,10 @@ #include #include #include +#include #include #include +#include #include #include "hfs_fs.h" @@ -111,6 +113,28 @@ static int hfs_remount(struct super_bloc return 0; } +static int hfs_show_options(struct seq_file *seq, struct vfsmount *mnt) +{ + struct hfs_sb_info *sbi = HFS_SB(mnt->mnt_sb); + + if (sbi->s_creator != cpu_to_be32(0x3f3f3f3f)) + seq_printf(seq, ",creator=%.4s", (char *)&sbi->s_creator); + if (sbi->s_type != cpu_to_be32(0x3f3f3f3f)) + seq_printf(seq, ",type=%.4s", (char *)&sbi->s_type); + seq_printf(seq, ",uid=%u,gid=%u", sbi->s_uid, sbi->s_gid); + if (sbi->s_file_umask != 0133) + seq_printf(seq, ",file_umask=%o", sbi->s_file_umask); + if (sbi->s_dir_umask != 0022) + seq_printf(seq, ",dir_umask=%o", sbi->s_dir_umask); + if (sbi->part >= 0) + seq_printf(seq, ",part=%u", sbi->part); + if (sbi->session >= 0) + seq_printf(seq, ",session=%u", sbi->session); + if (sbi->s_quiet) + seq_printf(seq, ",quiet"); + return 0; +} + static struct inode *hfs_alloc_inode(struct super_block *sb) { struct hfs_inode_info *i; @@ -133,6 +157,7 @@ static struct super_operations hfs_super .write_super = hfs_write_super, .statfs = hfs_statfs, .remount_fs = hfs_remount, + .show_options = hfs_show_options, }; enum { _