@@ -555,7 +555,7 @@ befs_utf2nls(struct super_block *sb, const char *in,
conv_err:
befs_error(sb, "Name using character set %s contains a character that "
- "cannot be converted to unicode.", nls->charset);
+ "cannot be converted to unicode.", nls_charset_name(nls));
befs_debug(sb, "<--- %s", __func__);
kfree(result);
return -EILSEQ;
@@ -635,7 +635,7 @@ befs_nls2utf(struct super_block *sb, const char *in,
conv_err:
befs_error(sb, "Name using character set %s contains a character that "
- "cannot be converted to unicode.", nls->charset);
+ "cannot be converted to unicode.", nls_charset_name(nls));
befs_debug(sb, "<--- %s", __func__);
kfree(result);
return -EILSEQ;
@@ -153,7 +153,7 @@ cifs_mapchar(char *target, const __u16 *from, const struct nls_table *cp,
surrogate_pair:
/* convert SURROGATE_PAIR and IVS */
- if (strcmp(cp->charset, "utf8"))
+ if (strcmp(nls_charset_name(cp), "utf8"))
goto unknown;
len = utf16s_to_utf8s(from, 3, UTF16_LITTLE_ENDIAN, target, 6);
if (len <= 0)
@@ -268,7 +268,7 @@ cifs_strtoUTF16(__le16 *to, const char *from, int len,
wchar_t wchar_to; /* needed to quiet sparse */
/* special case for utf8 to handle no plane0 chars */
- if (!strcmp(codepage->charset, "utf8")) {
+ if (!strcmp(nls_charset_name(codepage), "utf8")) {
/*
* convert utf8 -> utf16, we assume we have enough space
* as caller should have assumed conversion does not overflow
@@ -527,7 +527,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
goto ctoUTF16;
/* convert SURROGATE_PAIR */
- if (strcmp(cp->charset, "utf8") || !wchar_to)
+ if (strcmp(nls_charset_name(cp), "utf8") || !wchar_to)
goto unknown;
if (*(source + i) & 0x80) {
charlen = utf8_to_utf32(source + i, 6, &u);
@@ -414,7 +414,7 @@ cifs_show_nls(struct seq_file *s, struct nls_table *cur)
/* Display iocharset= option if it's not default charset */
def = load_nls_default();
if (def != cur)
- seq_printf(s, ",iocharset=%s", cur->charset);
+ seq_printf(s, ",iocharset=%s", nls_charset_name(cur));
unload_nls(def);
}
@@ -3191,7 +3191,7 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
old->mnt_dir_mode != new->mnt_dir_mode)
return 0;
- if (strcmp(old->local_nls->charset, new->local_nls->charset))
+ if (strcmp(nls_charset_name(old->local_nls), nls_charset_name(new->local_nls)))
return 0;
if (old->actimeo != new->actimeo)
@@ -948,10 +948,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",allow_utime=%04o", opts->allow_utime);
if (sbi->nls_disk)
/* strip "cp" prefix from displayed option */
- seq_printf(m, ",codepage=%s", &sbi->nls_disk->charset[2]);
+ seq_printf(m, ",codepage=%s",
+ &nls_charset_name(sbi->nls_disk)[2]);
if (isvfat) {
if (sbi->nls_io)
- seq_printf(m, ",iocharset=%s", sbi->nls_io->charset);
+ seq_printf(m, ",iocharset=%s",
+ nls_charset_name(sbi->nls_io));
switch (opts->shortname) {
case VFAT_SFN_DISPLAY_WIN95 | VFAT_SFN_CREATE_WIN95:
@@ -151,9 +151,11 @@ static int hfs_show_options(struct seq_file *seq, struct dentry *root)
if (sbi->session >= 0)
seq_printf(seq, ",session=%u", sbi->session);
if (sbi->nls_disk)
- seq_printf(seq, ",codepage=%s", sbi->nls_disk->charset);
+ seq_printf(seq, ",codepage=%s",
+ nls_charset_name(sbi->nls_disk));
if (sbi->nls_io)
- seq_printf(seq, ",iocharset=%s", sbi->nls_io->charset);
+ seq_printf(seq, ",iocharset=%s",
+ nls_charset_name(sbi->nls_io));
if (sbi->s_quiet)
seq_printf(seq, ",quiet");
return 0;
@@ -230,7 +230,7 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
if (sbi->session >= 0)
seq_printf(seq, ",session=%u", sbi->session);
if (sbi->nls)
- seq_printf(seq, ",nls=%s", sbi->nls->charset);
+ seq_printf(seq, ",nls=%s", nls_charset_name(sbi->nls));
if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags))
seq_puts(seq, ",nodecompose");
if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
@@ -520,8 +520,9 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)
#ifdef CONFIG_JOLIET
if (sbi->s_nls_iocharset &&
- strcmp(sbi->s_nls_iocharset->charset, CONFIG_NLS_DEFAULT) != 0)
- seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset);
+ strcmp(nls_charset_name(sbi->s_nls_iocharset), CONFIG_NLS_DEFAULT) != 0)
+ seq_printf(m, ",iocharset=%s",
+ nls_charset_name(sbi->s_nls_iocharset));
#endif
return 0;
}
@@ -92,7 +92,7 @@ static int jfs_strtoUCS(wchar_t * to, const unsigned char *from, int len,
jfs_err("jfs_strtoUCS: char2uni returned %d.",
charlen);
jfs_err("charset = %s, char = 0x%x",
- codepage->charset, *from);
+ nls_charset_name(codepage), *from);
return charlen;
}
}
@@ -736,7 +736,8 @@ static int jfs_show_options(struct seq_file *seq, struct dentry *root)
if (sbi->flag & JFS_DISCARD)
seq_printf(seq, ",discard=%u", sbi->minblks_trim);
if (sbi->nls_tab)
- seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset);
+ seq_printf(seq, ",iocharset=%s",
+ nls_charset_name(sbi->nls_tab));
if (sbi->flag & JFS_ERR_CONTINUE)
seq_printf(seq, ",errors=continue");
if (sbi->flag & JFS_ERR_PANIC)
@@ -277,7 +277,7 @@ static struct nls_table *find_nls(char *charset)
struct nls_table *nls;
spin_lock(&nls_lock);
for (nls = tables; nls; nls = nls->next) {
- if (!strcmp(nls->charset, charset))
+ if (!strcmp(nls_charset_name(nls), charset))
break;
if (nls->alias && !strcmp(nls->alias, charset))
break;
@@ -2313,7 +2313,7 @@ int ntfs_show_options(struct seq_file *sf, struct dentry *root)
seq_printf(sf, ",fmask=0%o", vol->fmask);
seq_printf(sf, ",dmask=0%o", vol->dmask);
}
- seq_printf(sf, ",nls=%s", vol->nls_map->charset);
+ seq_printf(sf, ",nls=%s", nls_charset_name(vol->nls_map));
if (NVolCaseSensitive(vol))
seq_printf(sf, ",case_sensitive");
if (NVolShowSystemFiles(vol))
@@ -224,7 +224,7 @@ static bool parse_options(ntfs_volume *vol, char *opt)
}
ntfs_error(vol->sb, "NLS character set %s not "
"found. Using previous one %s.",
- v, old_nls->charset);
+ v, nls_charset_name(old_nls));
nls_map = old_nls;
} else /* nls_map */ {
unload_nls(old_nls);
@@ -274,7 +274,7 @@ static bool parse_options(ntfs_volume *vol, char *opt)
"on remount.");
return false;
} /* else (!vol->nls_map) */
- ntfs_debug("Using NLS character set %s.", nls_map->charset);
+ ntfs_debug("Using NLS character set %s.", nls_charset_name(nls_map));
vol->nls_map = nls_map;
} else /* (!nls_map) */ {
if (!vol->nls_map) {
@@ -285,7 +285,7 @@ static bool parse_options(ntfs_volume *vol, char *opt)
return false;
}
ntfs_debug("Using default NLS character set (%s).",
- vol->nls_map->charset);
+ nls_charset_name(vol->nls_map));
}
}
if (mft_zone_multiplier != -1) {
@@ -297,7 +297,7 @@ int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
if (wc_len < 0) {
ntfs_error(vol->sb, "Name using character set %s contains "
"characters that cannot be converted to "
- "Unicode.", nls->charset);
+ "Unicode.", nls_charset_name(nls));
i = -EILSEQ;
} else /* if (o >= NTFS_MAX_NAME_LEN) */ {
ntfs_error(vol->sb, "Name is too long (maximum length for a "
@@ -386,7 +386,8 @@ retry: wc = nls_uni2char(nls, le16_to_cpu(ins[i]),
conversion_err:
ntfs_error(vol->sb, "Unicode name contains characters that cannot be "
"converted to character set %s. You might want to "
- "try to use the mount option nls=utf8.", nls->charset);
+ "try to use the mount option nls=utf8.",
+ nls_charset_name(nls));
if (ns != *outs)
kfree(ns);
if (wc != -ENAMETOOLONG)
@@ -361,7 +361,8 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8))
seq_puts(seq, ",utf8");
if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP) && sbi->s_nls_map)
- seq_printf(seq, ",iocharset=%s", sbi->s_nls_map->charset);
+ seq_printf(seq, ",iocharset=%s",
+ nls_charset_name(sbi->s_nls_map));
return 0;
}
@@ -72,6 +72,11 @@ static inline int nls_char2uni(const struct nls_table *table,
return table->char2uni(rawstring, boundlen, uni);
}
+static inline const char *nls_charset_name(const struct nls_table *table)
+{
+ return table->charset;
+}
+
static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
{
unsigned char nc = t->charset2lower[c];