diff options
Diffstat (limited to 'fs/hfs/super.c')
| -rw-r--r-- | fs/hfs/super.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index ab783f6afa3b..c5074aeafcae 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
| @@ -15,8 +15,11 @@ | |||
| 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> |
| 20 | #include <linux/nls.h> | ||
| 19 | #include <linux/parser.h> | 21 | #include <linux/parser.h> |
| 22 | #include <linux/seq_file.h> | ||
| 20 | #include <linux/vfs.h> | 23 | #include <linux/vfs.h> |
| 21 | 24 | ||
| 22 | #include "hfs_fs.h" | 25 | #include "hfs_fs.h" |
| @@ -111,6 +114,32 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 111 | return 0; | 114 | return 0; |
| 112 | } | 115 | } |
| 113 | 116 | ||
| 117 | static int hfs_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
| 118 | { | ||
| 119 | struct hfs_sb_info *sbi = HFS_SB(mnt->mnt_sb); | ||
| 120 | |||
| 121 | if (sbi->s_creator != cpu_to_be32(0x3f3f3f3f)) | ||
| 122 | seq_printf(seq, ",creator=%.4s", (char *)&sbi->s_creator); | ||
| 123 | if (sbi->s_type != cpu_to_be32(0x3f3f3f3f)) | ||
| 124 | seq_printf(seq, ",type=%.4s", (char *)&sbi->s_type); | ||
| 125 | seq_printf(seq, ",uid=%u,gid=%u", sbi->s_uid, sbi->s_gid); | ||
| 126 | if (sbi->s_file_umask != 0133) | ||
| 127 | seq_printf(seq, ",file_umask=%o", sbi->s_file_umask); | ||
| 128 | if (sbi->s_dir_umask != 0022) | ||
| 129 | seq_printf(seq, ",dir_umask=%o", sbi->s_dir_umask); | ||
| 130 | if (sbi->part >= 0) | ||
| 131 | seq_printf(seq, ",part=%u", sbi->part); | ||
| 132 | if (sbi->session >= 0) | ||
| 133 | seq_printf(seq, ",session=%u", sbi->session); | ||
| 134 | if (sbi->nls_disk) | ||
| 135 | seq_printf(seq, ",codepage=%s", sbi->nls_disk->charset); | ||
| 136 | if (sbi->nls_io) | ||
| 137 | seq_printf(seq, ",iocharset=%s", sbi->nls_io->charset); | ||
| 138 | if (sbi->s_quiet) | ||
| 139 | seq_printf(seq, ",quiet"); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 114 | static struct inode *hfs_alloc_inode(struct super_block *sb) | 143 | static struct inode *hfs_alloc_inode(struct super_block *sb) |
| 115 | { | 144 | { |
| 116 | struct hfs_inode_info *i; | 145 | struct hfs_inode_info *i; |
| @@ -133,11 +162,13 @@ static struct super_operations hfs_super_operations = { | |||
| 133 | .write_super = hfs_write_super, | 162 | .write_super = hfs_write_super, |
| 134 | .statfs = hfs_statfs, | 163 | .statfs = hfs_statfs, |
| 135 | .remount_fs = hfs_remount, | 164 | .remount_fs = hfs_remount, |
| 165 | .show_options = hfs_show_options, | ||
| 136 | }; | 166 | }; |
| 137 | 167 | ||
| 138 | enum { | 168 | enum { |
| 139 | opt_uid, opt_gid, opt_umask, opt_file_umask, opt_dir_umask, | 169 | opt_uid, opt_gid, opt_umask, opt_file_umask, opt_dir_umask, |
| 140 | opt_part, opt_session, opt_type, opt_creator, opt_quiet, | 170 | opt_part, opt_session, opt_type, opt_creator, opt_quiet, |
| 171 | opt_codepage, opt_iocharset, | ||
| 141 | opt_err | 172 | opt_err |
| 142 | }; | 173 | }; |
| 143 | 174 | ||
| @@ -152,6 +183,8 @@ static match_table_t tokens = { | |||
| 152 | { opt_type, "type=%s" }, | 183 | { opt_type, "type=%s" }, |
| 153 | { opt_creator, "creator=%s" }, | 184 | { opt_creator, "creator=%s" }, |
| 154 | { opt_quiet, "quiet" }, | 185 | { opt_quiet, "quiet" }, |
| 186 | { opt_codepage, "codepage=%s" }, | ||
| 187 | { opt_iocharset, "iocharset=%s" }, | ||
| 155 | { opt_err, NULL } | 188 | { opt_err, NULL } |
| 156 | }; | 189 | }; |
| 157 | 190 | ||
| @@ -257,11 +290,46 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) | |||
| 257 | case opt_quiet: | 290 | case opt_quiet: |
| 258 | hsb->s_quiet = 1; | 291 | hsb->s_quiet = 1; |
| 259 | break; | 292 | break; |
| 293 | case opt_codepage: | ||
| 294 | if (hsb->nls_disk) { | ||
| 295 | printk("HFS+-fs: unable to change codepage\n"); | ||
| 296 | return 0; | ||
| 297 | } | ||
| 298 | p = match_strdup(&args[0]); | ||
| 299 | hsb->nls_disk = load_nls(p); | ||
| 300 | if (!hsb->nls_disk) { | ||
| 301 | printk("HFS+-fs: unable to load codepage \"%s\"\n", p); | ||
| 302 | kfree(p); | ||
| 303 | return 0; | ||
| 304 | } | ||
| 305 | kfree(p); | ||
| 306 | break; | ||
| 307 | case opt_iocharset: | ||
| 308 | if (hsb->nls_io) { | ||
| 309 | printk("HFS: unable to change iocharset\n"); | ||
| 310 | return 0; | ||
| 311 | } | ||
| 312 | p = match_strdup(&args[0]); | ||
| 313 | hsb->nls_io = load_nls(p); | ||
| 314 | if (!hsb->nls_io) { | ||
| 315 | printk("HFS: unable to load iocharset \"%s\"\n", p); | ||
| 316 | kfree(p); | ||
| 317 | return 0; | ||
| 318 | } | ||
| 319 | kfree(p); | ||
| 320 | break; | ||
| 260 | default: | 321 | default: |
| 261 | return 0; | 322 | return 0; |
| 262 | } | 323 | } |
| 263 | } | 324 | } |
| 264 | 325 | ||
| 326 | if (hsb->nls_disk && !hsb->nls_io) { | ||
| 327 | hsb->nls_io = load_nls_default(); | ||
| 328 | if (!hsb->nls_io) { | ||
| 329 | printk("HFS: unable to load default iocharset\n"); | ||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | } | ||
| 265 | hsb->s_dir_umask &= 0777; | 333 | hsb->s_dir_umask &= 0777; |
| 266 | hsb->s_file_umask &= 0577; | 334 | hsb->s_file_umask &= 0577; |
| 267 | 335 | ||
