diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-09-06 18:18:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:50 -0400 |
commit | 717dd80e999cdc84fb611decec5c5054d37c40d2 (patch) | |
tree | 871c103741512a24a01f38a875a841bca8153208 /fs | |
parent | a5e3985fa014029eb6795664c704953720cc7f7d (diff) |
[PATCH] hfs: show_options support
This adds support for show_options. It also fixes some namespace polution in
the hfsplus driver.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hfs/super.c | 25 | ||||
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 5 | ||||
-rw-r--r-- | fs/hfsplus/options.c | 26 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 5 |
4 files changed, 55 insertions, 6 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index ab783f6afa3b..fd78414ee7e4 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -15,8 +15,10 @@ | |||
15 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/blkdev.h> | 17 | #include <linux/blkdev.h> |
18 | #include <linux/mount.h> | ||
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/parser.h> | 20 | #include <linux/parser.h> |
21 | #include <linux/seq_file.h> | ||
20 | #include <linux/vfs.h> | 22 | #include <linux/vfs.h> |
21 | 23 | ||
22 | #include "hfs_fs.h" | 24 | #include "hfs_fs.h" |
@@ -111,6 +113,28 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) | |||
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||
116 | static int hfs_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
117 | { | ||
118 | struct hfs_sb_info *sbi = HFS_SB(mnt->mnt_sb); | ||
119 | |||
120 | if (sbi->s_creator != cpu_to_be32(0x3f3f3f3f)) | ||
121 | seq_printf(seq, ",creator=%.4s", (char *)&sbi->s_creator); | ||
122 | if (sbi->s_type != cpu_to_be32(0x3f3f3f3f)) | ||
123 | seq_printf(seq, ",type=%.4s", (char *)&sbi->s_type); | ||
124 | seq_printf(seq, ",uid=%u,gid=%u", sbi->s_uid, sbi->s_gid); | ||
125 | if (sbi->s_file_umask != 0133) | ||
126 | seq_printf(seq, ",file_umask=%o", sbi->s_file_umask); | ||
127 | if (sbi->s_dir_umask != 0022) | ||
128 | seq_printf(seq, ",dir_umask=%o", sbi->s_dir_umask); | ||
129 | if (sbi->part >= 0) | ||
130 | seq_printf(seq, ",part=%u", sbi->part); | ||
131 | if (sbi->session >= 0) | ||
132 | seq_printf(seq, ",session=%u", sbi->session); | ||
133 | if (sbi->s_quiet) | ||
134 | seq_printf(seq, ",quiet"); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
114 | static struct inode *hfs_alloc_inode(struct super_block *sb) | 138 | static struct inode *hfs_alloc_inode(struct super_block *sb) |
115 | { | 139 | { |
116 | struct hfs_inode_info *i; | 140 | struct hfs_inode_info *i; |
@@ -133,6 +157,7 @@ static struct super_operations hfs_super_operations = { | |||
133 | .write_super = hfs_write_super, | 157 | .write_super = hfs_write_super, |
134 | .statfs = hfs_statfs, | 158 | .statfs = hfs_statfs, |
135 | .remount_fs = hfs_remount, | 159 | .remount_fs = hfs_remount, |
160 | .show_options = hfs_show_options, | ||
136 | }; | 161 | }; |
137 | 162 | ||
138 | enum { | 163 | enum { |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 533094a570df..2bc0cdd30e56 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -343,8 +343,9 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | |||
343 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); | 343 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); |
344 | 344 | ||
345 | /* options.c */ | 345 | /* options.c */ |
346 | int parse_options(char *, struct hfsplus_sb_info *); | 346 | int hfsplus_parse_options(char *, struct hfsplus_sb_info *); |
347 | void fill_defaults(struct hfsplus_sb_info *); | 347 | void hfsplus_fill_defaults(struct hfsplus_sb_info *); |
348 | int hfsplus_show_options(struct seq_file *, struct vfsmount *); | ||
348 | 349 | ||
349 | /* tables.c */ | 350 | /* tables.c */ |
350 | extern u16 hfsplus_case_fold_table[]; | 351 | extern u16 hfsplus_case_fold_table[]; |
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 1cca0102c98d..cca0818aa4ca 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/parser.h> | 14 | #include <linux/parser.h> |
15 | #include <linux/nls.h> | 15 | #include <linux/nls.h> |
16 | #include <linux/mount.h> | ||
17 | #include <linux/seq_file.h> | ||
16 | #include "hfsplus_fs.h" | 18 | #include "hfsplus_fs.h" |
17 | 19 | ||
18 | enum { | 20 | enum { |
@@ -38,7 +40,7 @@ static match_table_t tokens = { | |||
38 | }; | 40 | }; |
39 | 41 | ||
40 | /* Initialize an options object to reasonable defaults */ | 42 | /* Initialize an options object to reasonable defaults */ |
41 | void fill_defaults(struct hfsplus_sb_info *opts) | 43 | void hfsplus_fill_defaults(struct hfsplus_sb_info *opts) |
42 | { | 44 | { |
43 | if (!opts) | 45 | if (!opts) |
44 | return; | 46 | return; |
@@ -63,7 +65,7 @@ static inline int match_fourchar(substring_t *arg, u32 *result) | |||
63 | 65 | ||
64 | /* Parse options from mount. Returns 0 on failure */ | 66 | /* Parse options from mount. Returns 0 on failure */ |
65 | /* input is the options passed to mount() as a string */ | 67 | /* input is the options passed to mount() as a string */ |
66 | int parse_options(char *input, struct hfsplus_sb_info *sbi) | 68 | int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) |
67 | { | 69 | { |
68 | char *p; | 70 | char *p; |
69 | substring_t args[MAX_OPT_ARGS]; | 71 | substring_t args[MAX_OPT_ARGS]; |
@@ -160,3 +162,23 @@ done: | |||
160 | 162 | ||
161 | return 1; | 163 | return 1; |
162 | } | 164 | } |
165 | |||
166 | int hfsplus_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
167 | { | ||
168 | struct hfsplus_sb_info *sbi = &HFSPLUS_SB(mnt->mnt_sb); | ||
169 | |||
170 | if (sbi->creator != HFSPLUS_DEF_CR_TYPE) | ||
171 | seq_printf(seq, ",creator=%.4s", (char *)&sbi->creator); | ||
172 | if (sbi->type != HFSPLUS_DEF_CR_TYPE) | ||
173 | seq_printf(seq, ",type=%.4s", (char *)&sbi->type); | ||
174 | seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask, sbi->uid, sbi->gid); | ||
175 | if (sbi->part >= 0) | ||
176 | seq_printf(seq, ",part=%u", sbi->part); | ||
177 | if (sbi->session >= 0) | ||
178 | seq_printf(seq, ",session=%u", sbi->session); | ||
179 | if (sbi->nls) | ||
180 | seq_printf(seq, ",nls=%s", sbi->nls->charset); | ||
181 | if (sbi->flags & HFSPLUS_SB_NODECOMPOSE) | ||
182 | seq_printf(seq, ",nodecompose"); | ||
183 | return 0; | ||
184 | } | ||
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index d55ad67b8e42..b0689955daea 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -277,6 +277,7 @@ static struct super_operations hfsplus_sops = { | |||
277 | .write_super = hfsplus_write_super, | 277 | .write_super = hfsplus_write_super, |
278 | .statfs = hfsplus_statfs, | 278 | .statfs = hfsplus_statfs, |
279 | .remount_fs = hfsplus_remount, | 279 | .remount_fs = hfsplus_remount, |
280 | .show_options = hfsplus_show_options, | ||
280 | }; | 281 | }; |
281 | 282 | ||
282 | static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | 283 | static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) |
@@ -297,8 +298,8 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
297 | memset(sbi, 0, sizeof(HFSPLUS_SB(sb))); | 298 | memset(sbi, 0, sizeof(HFSPLUS_SB(sb))); |
298 | sb->s_fs_info = sbi; | 299 | sb->s_fs_info = sbi; |
299 | INIT_HLIST_HEAD(&sbi->rsrc_inodes); | 300 | INIT_HLIST_HEAD(&sbi->rsrc_inodes); |
300 | fill_defaults(sbi); | 301 | hfsplus_fill_defaults(sbi); |
301 | if (!parse_options(data, sbi)) { | 302 | if (!hfsplus_parse_options(data, sbi)) { |
302 | if (!silent) | 303 | if (!silent) |
303 | printk("HFS+-fs: unable to parse mount options\n"); | 304 | printk("HFS+-fs: unable to parse mount options\n"); |
304 | err = -EINVAL; | 305 | err = -EINVAL; |