Skip to content

Commit

Permalink
Merge tag 'udf_for_v4.18-rc1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/jack/linux-fs

Pull udf updates from Jan Kara:
 "UDF support for UTF-16 characters in file names"

* tag 'udf_for_v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Add support for decoding UTF-16 characters
  udf: Add support for encoding UTF-16 characters
  udf: Push sb argument to udf_name_[to|from]_CS0()
  udf: Convert ident strings to proper charset
  udf: Use UTF-32 <-> UTF-8 conversion functions from NLS
  udf: Always require NLS support
  • Loading branch information
torvalds committed Jun 7, 2018
2 parents 091a0f2 + 8a0cdef commit d987f62
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 150 deletions.
6 changes: 1 addition & 5 deletions fs/udf/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config UDF_FS
tristate "UDF file system support"
select CRC_ITU_T
select NLS
help
This is a file system used on some CD-ROMs and DVDs. Since the
file system is supported by multiple operating systems and is more
Expand All @@ -13,8 +14,3 @@ config UDF_FS
module will be called udf.

If unsure, say N.

config UDF_NLS
bool
default y
depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y)
12 changes: 2 additions & 10 deletions fs/udf/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,6 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
case Opt_utf8:
uopt->flags |= (1 << UDF_FLAG_UTF8);
break;
#ifdef CONFIG_UDF_NLS
case Opt_iocharset:
if (!remount) {
if (uopt->nls_map)
Expand All @@ -581,7 +580,6 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
uopt->flags |= (1 << UDF_FLAG_NLS_MAP);
}
break;
#endif
case Opt_uforget:
uopt->flags |= (1 << UDF_FLAG_UID_FORGET);
break;
Expand Down Expand Up @@ -892,14 +890,14 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
#endif
}

ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
ret = udf_dstrCS0toChar(sb, outstr, 31, pvoldesc->volIdent, 32);
if (ret < 0)
goto out_bh;

strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);

ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
ret = udf_dstrCS0toChar(sb, outstr, 127, pvoldesc->volSetIdent, 128);
if (ret < 0)
goto out_bh;

Expand Down Expand Up @@ -2117,15 +2115,13 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
udf_err(sb, "utf8 cannot be combined with iocharset\n");
goto parse_options_failure;
}
#ifdef CONFIG_UDF_NLS
if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) {
uopt.nls_map = load_nls_default();
if (!uopt.nls_map)
uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP);
else
udf_debug("Using default NLS map\n");
}
#endif
if (!(uopt.flags & (1 << UDF_FLAG_NLS_MAP)))
uopt.flags |= (1 << UDF_FLAG_UTF8);

Expand Down Expand Up @@ -2279,10 +2275,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
error_out:
iput(sbi->s_vat_inode);
parse_options_failure:
#ifdef CONFIG_UDF_NLS
if (uopt.nls_map)
unload_nls(uopt.nls_map);
#endif
if (lvid_open)
udf_close_lvid(sb);
brelse(sbi->s_lvid_bh);
Expand Down Expand Up @@ -2332,10 +2326,8 @@ static void udf_put_super(struct super_block *sb)
sbi = UDF_SB(sb);

iput(sbi->s_vat_inode);
#ifdef CONFIG_UDF_NLS
if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
unload_nls(sbi->s_nls_map);
#endif
if (!sb_rdonly(sb))
udf_close_lvid(sb);
brelse(sbi->s_lvid_bh);
Expand Down
3 changes: 2 additions & 1 deletion fs/udf/udfdecl.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ extern int udf_get_filename(struct super_block *, const uint8_t *, int,
uint8_t *, int);
extern int udf_put_filename(struct super_block *, const uint8_t *, int,
uint8_t *, int);
extern int udf_dstrCS0toUTF8(uint8_t *, int, const uint8_t *, int);
extern int udf_dstrCS0toChar(struct super_block *, uint8_t *, int,
const uint8_t *, int);

/* ialloc.c */
extern void udf_free_inode(struct inode *);
Expand Down
Loading

0 comments on commit d987f62

Please sign in to comment.