diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-09-06 18:18:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:50 -0400 |
commit | 328b9227865026268261a24a97a578907b280415 (patch) | |
tree | 1e0cad4f422252a9c3add879cf847afbb9786cfe /fs/hfs/super.c | |
parent | 717dd80e999cdc84fb611decec5c5054d37c40d2 (diff) |
[PATCH] hfs: NLS support
This adds NLS support to HFS. Using the kernel options iocharset and codepage
it's possible to map the disk encoding to a local mapping. If these options
are not used, it falls back to the old direct mapping.
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/hfs/super.c')
-rw-r--r-- | fs/hfs/super.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index fd78414ee7e4..c5074aeafcae 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/blkdev.h> | 17 | #include <linux/blkdev.h> |
18 | #include <linux/mount.h> | 18 | #include <linux/mount.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/nls.h> | ||
20 | #include <linux/parser.h> | 21 | #include <linux/parser.h> |
21 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
22 | #include <linux/vfs.h> | 23 | #include <linux/vfs.h> |
@@ -130,6 +131,10 @@ static int hfs_show_options(struct seq_file *seq, struct vfsmount *mnt) | |||
130 | seq_printf(seq, ",part=%u", sbi->part); | 131 | seq_printf(seq, ",part=%u", sbi->part); |
131 | if (sbi->session >= 0) | 132 | if (sbi->session >= 0) |
132 | seq_printf(seq, ",session=%u", sbi->session); | 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); | ||
133 | if (sbi->s_quiet) | 138 | if (sbi->s_quiet) |
134 | seq_printf(seq, ",quiet"); | 139 | seq_printf(seq, ",quiet"); |
135 | return 0; | 140 | return 0; |
@@ -163,6 +168,7 @@ static struct super_operations hfs_super_operations = { | |||
163 | enum { | 168 | enum { |
164 | 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, |
165 | 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, | ||
166 | opt_err | 172 | opt_err |
167 | }; | 173 | }; |
168 | 174 | ||
@@ -177,6 +183,8 @@ static match_table_t tokens = { | |||
177 | { opt_type, "type=%s" }, | 183 | { opt_type, "type=%s" }, |
178 | { opt_creator, "creator=%s" }, | 184 | { opt_creator, "creator=%s" }, |
179 | { opt_quiet, "quiet" }, | 185 | { opt_quiet, "quiet" }, |
186 | { opt_codepage, "codepage=%s" }, | ||
187 | { opt_iocharset, "iocharset=%s" }, | ||
180 | { opt_err, NULL } | 188 | { opt_err, NULL } |
181 | }; | 189 | }; |
182 | 190 | ||
@@ -282,11 +290,46 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) | |||
282 | case opt_quiet: | 290 | case opt_quiet: |
283 | hsb->s_quiet = 1; | 291 | hsb->s_quiet = 1; |
284 | 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; | ||
285 | default: | 321 | default: |
286 | return 0; | 322 | return 0; |
287 | } | 323 | } |
288 | } | 324 | } |
289 | 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 | } | ||
290 | hsb->s_dir_umask &= 0777; | 333 | hsb->s_dir_umask &= 0777; |
291 | hsb->s_file_umask &= 0577; | 334 | hsb->s_file_umask &= 0577; |
292 | 335 | ||