From: Due to its roots in OS/2, JFS has always tried to convert pathnames into unicode. Unfortunately, it never had a reliable idea of what the incoming character set was, so it defaulted to CONFIG_NLS_DEFAULT. This behavior was confusing and many users have requested that JFS have a more sane behavior. This patch changes the default behavior to store the incoming bytes directly without translation. This is consistent with the behavior when the default value of CONFIG_NLS_DEFAULT (iso8859-1) was defined. The default behavior can be overridden by using the iocharset mount option. --- 25-akpm/Documentation/filesystems/jfs.txt | 19 +---------- 25-akpm/fs/jfs/jfs_unicode.c | 48 +++++++++++++++++++----------- 25-akpm/fs/jfs/super.c | 6 +-- 3 files changed, 36 insertions(+), 37 deletions(-) diff -puN Documentation/filesystems/jfs.txt~jfs-02-sane-filename-handling Documentation/filesystems/jfs.txt --- 25/Documentation/filesystems/jfs.txt~jfs-02-sane-filename-handling Thu Feb 12 14:40:55 2004 +++ 25-akpm/Documentation/filesystems/jfs.txt Thu Feb 12 14:40:55 2004 @@ -12,10 +12,9 @@ Barry Arndt barndt@us.ibm.com The following mount options are supported: iocharset=name Character set to use for converting from Unicode to - ASCII. The default is compiled into the kernel as - CONFIG_NLS_DEFAULT. Use iocharset=utf8 for UTF8 - translations. This requires CONFIG_NLS_UTF8 to be set - in the kernel .config file. + ASCII. The default is to do no conversion. Use + iocharset=utf8 for UTF8 translations. This requires + CONFIG_NLS_UTF8 to be set in the kernel .config file. resize=value Resize the volume to blocks. JFS only supports growing a volume, not shrinking it. This option is only @@ -36,18 +35,6 @@ errors=continue Keep going on a filesys errors=remount-ro Default. Remount the filesystem read-only on an error. errors=panic Panic and halt the machine if an error occurs. -JFS TODO list: - -Plans for our near term development items - - - enhance support for logfile on dedicated partition - -Longer term work items - - - implement defrag utility, for online defragmenting - - add quota support - - add support for block sizes (512,1024,2048) - Please send bugs, comments, cards and letters to shaggy@austin.ibm.com. The JFS mailing list can be subscribed to by using the link labeled diff -puN fs/jfs/jfs_unicode.c~jfs-02-sane-filename-handling fs/jfs/jfs_unicode.c --- 25/fs/jfs/jfs_unicode.c~jfs-02-sane-filename-handling Thu Feb 12 14:40:55 2004 +++ 25-akpm/fs/jfs/jfs_unicode.c Thu Feb 12 14:40:55 2004 @@ -1,5 +1,5 @@ /* - * Copyright (c) International Business Machines Corp., 2000-2002 + * Copyright (C) International Business Machines Corp., 2000-2004 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,16 +35,22 @@ int jfs_strfromUCS_le(char *to, const wc int i; int outlen = 0; - for (i = 0; (i < len) && from[i]; i++) { - int charlen; - charlen = - codepage->uni2char(le16_to_cpu(from[i]), &to[outlen], - NLS_MAX_CHARSET_SIZE); - if (charlen > 0) { - outlen += charlen; - } else { - to[outlen++] = '?'; + if (codepage) { + for (i = 0; (i < len) && from[i]; i++) { + int charlen; + charlen = + codepage->uni2char(le16_to_cpu(from[i]), + &to[outlen], + NLS_MAX_CHARSET_SIZE); + if (charlen > 0) + outlen += charlen; + else + to[outlen++] = '?'; } + } else { + for (i = 0; (i < len) && from[i]; i++) + to[i] = (char) (le16_to_cpu(from[i])); + outlen = i; } to[outlen] = 0; return outlen; @@ -62,14 +68,22 @@ int jfs_strtoUCS(wchar_t * to, int charlen; int i; - for (i = 0; len && *from; i++, from += charlen, len -= charlen) { - charlen = codepage->char2uni(from, len, &to[i]); - if (charlen < 1) { - jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen); - jfs_err("charset = %s, char = 0x%x", - codepage->charset, (unsigned char) *from); - return charlen; + if (codepage) { + for (i = 0; len && *from; i++, from += charlen, len -= charlen) + { + charlen = codepage->char2uni(from, len, &to[i]); + if (charlen < 1) { + jfs_err("jfs_strtoUCS: char2uni returned %d.", + charlen); + jfs_err("charset = %s, char = 0x%x", + codepage->charset, + (unsigned char) *from); + return charlen; + } } + } else { + for (i = 0; (i < len) && from[i]; i++) + to[i] = (wchar_t) from[i]; } to[i] = 0; diff -puN fs/jfs/super.c~jfs-02-sane-filename-handling fs/jfs/super.c --- 25/fs/jfs/super.c~jfs-02-sane-filename-handling Thu Feb 12 14:40:55 2004 +++ 25-akpm/fs/jfs/super.c Thu Feb 12 14:40:55 2004 @@ -195,7 +195,8 @@ static void jfs_put_super(struct super_b rc = jfs_umount(sb); if (rc) jfs_err("jfs_umount failed with return code %d", rc); - unload_nls(sbi->nls_tab); + if (sbi->nls_tab) + unload_nls(sbi->nls_tab); sbi->nls_tab = NULL; kfree(sbi); @@ -435,9 +436,6 @@ static int jfs_fill_super(struct super_b if (!sb->s_root) goto out_no_root; - if (!sbi->nls_tab) - sbi->nls_tab = load_nls_default(); - /* logical blocks are represented by 40 bits in pxd_t, etc. */ sb->s_maxbytes = ((u64) sb->s_blocksize) << 40; #if BITS_PER_LONG == 32 _