diff options
author | Christoph Hellwig <hch@lst.de> | 2021-09-15 08:59:56 +0200 |
---|---|---|
committer | Gabriel Krisman Bertazi <krisman@collabora.com> | 2021-10-11 17:01:24 -0300 |
commit | aa8bf298a96acaaaa3af07d09cf7ffeb9798e48a (patch) | |
tree | fdbb4e02aec675382bf8846fcce99a390e39fb52 /fs/ext4/super.c | |
parent | 9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff) | |
download | linux-stable-aa8bf298a96acaaaa3af07d09cf7ffeb9798e48a.tar.gz linux-stable-aa8bf298a96acaaaa3af07d09cf7ffeb9798e48a.tar.bz2 linux-stable-aa8bf298a96acaaaa3af07d09cf7ffeb9798e48a.zip |
ext4: simplify ext4_sb_read_encoding
Return the encoding table as the return value instead of as an argument,
and don't bother with the encoding flags as the caller can handle that
trivially.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 88d5d274a868..26c0e6fc5bce 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2023,24 +2023,17 @@ static const struct ext4_sb_encodings { {EXT4_ENC_UTF8_12_1, "utf8", "12.1.0"}, }; -static int ext4_sb_read_encoding(const struct ext4_super_block *es, - const struct ext4_sb_encodings **encoding, - __u16 *flags) +static const struct ext4_sb_encodings * +ext4_sb_read_encoding(const struct ext4_super_block *es) { __u16 magic = le16_to_cpu(es->s_encoding); int i; for (i = 0; i < ARRAY_SIZE(ext4_sb_encoding_map); i++) if (magic == ext4_sb_encoding_map[i].magic) - break; - - if (i >= ARRAY_SIZE(ext4_sb_encoding_map)) - return -EINVAL; + return &ext4_sb_encoding_map[i]; - *encoding = &ext4_sb_encoding_map[i]; - *flags = le16_to_cpu(es->s_encoding_flags); - - return 0; + return NULL; } #endif @@ -4161,10 +4154,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (ext4_has_feature_casefold(sb) && !sb->s_encoding) { const struct ext4_sb_encodings *encoding_info; struct unicode_map *encoding; - __u16 encoding_flags; + __u16 encoding_flags = le16_to_cpu(es->s_encoding_flags); - if (ext4_sb_read_encoding(es, &encoding_info, - &encoding_flags)) { + encoding_info = ext4_sb_read_encoding(es); + if (!encoding_info) { ext4_msg(sb, KERN_ERR, "Encoding requested by superblock is unknown"); goto failed_mount; |