X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fjfs_unicode.c;h=c7de6f5bbefc1da43b269ffe54ddec707ba7b0a1;hb=refs%2Fheads%2Fvserver;hp=974077fe124ba250c2e44dde1b3638f86d51fc18;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/jfs/jfs_unicode.c b/fs/jfs/jfs_unicode.c index 974077fe1..c7de6f5bb 100644 --- a/fs/jfs/jfs_unicode.c +++ b/fs/jfs/jfs_unicode.c @@ -3,16 +3,16 @@ * * 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 - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -29,7 +29,7 @@ * FUNCTION: Convert little-endian unicode string to character string * */ -int jfs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ +int jfs_strfromUCS_le(char *to, const __le16 * from, int len, struct nls_table *codepage) { int i; @@ -51,17 +51,18 @@ int jfs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ } } else { for (i = 0; (i < len) && from[i]; i++) { - if (le16_to_cpu(from[i]) & 0xff00) { - if (warn) { + if (unlikely(le16_to_cpu(from[i]) & 0xff00)) { + to[i] = '?'; + if (unlikely(warn)) { warn--; warn_again--; printk(KERN_ERR - "non-latin1 character 0x%x found in JFS file name\n", - le16_to_cpu(from[i])); + "non-latin1 character 0x%x found in JFS file name\n", + le16_to_cpu(from[i])); printk(KERN_ERR "mount with iocharset=utf8 to access\n"); } - to[i] = '?'; + } else to[i] = (char) (le16_to_cpu(from[i])); @@ -123,7 +124,7 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry) kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS); if (uniName->name == NULL) - return -ENOSPC; + return -ENOMEM; uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name, length, nls_tab);