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>
This commit is contained in:
Родитель
9e1ff307c7
Коммит
aa8bf298a9
|
@ -2023,24 +2023,17 @@ static const struct ext4_sb_encodings {
|
||||||
{EXT4_ENC_UTF8_12_1, "utf8", "12.1.0"},
|
{EXT4_ENC_UTF8_12_1, "utf8", "12.1.0"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ext4_sb_read_encoding(const struct ext4_super_block *es,
|
static const struct ext4_sb_encodings *
|
||||||
const struct ext4_sb_encodings **encoding,
|
ext4_sb_read_encoding(const struct ext4_super_block *es)
|
||||||
__u16 *flags)
|
|
||||||
{
|
{
|
||||||
__u16 magic = le16_to_cpu(es->s_encoding);
|
__u16 magic = le16_to_cpu(es->s_encoding);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(ext4_sb_encoding_map); i++)
|
for (i = 0; i < ARRAY_SIZE(ext4_sb_encoding_map); i++)
|
||||||
if (magic == ext4_sb_encoding_map[i].magic)
|
if (magic == ext4_sb_encoding_map[i].magic)
|
||||||
break;
|
return &ext4_sb_encoding_map[i];
|
||||||
|
|
||||||
if (i >= ARRAY_SIZE(ext4_sb_encoding_map))
|
return NULL;
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
*encoding = &ext4_sb_encoding_map[i];
|
|
||||||
*flags = le16_to_cpu(es->s_encoding_flags);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
|
||||||
const struct ext4_sb_encodings *encoding_info;
|
const struct ext4_sb_encodings *encoding_info;
|
||||||
struct unicode_map *encoding;
|
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_info = ext4_sb_read_encoding(es);
|
||||||
&encoding_flags)) {
|
if (!encoding_info) {
|
||||||
ext4_msg(sb, KERN_ERR,
|
ext4_msg(sb, KERN_ERR,
|
||||||
"Encoding requested by superblock is unknown");
|
"Encoding requested by superblock is unknown");
|
||||||
goto failed_mount;
|
goto failed_mount;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче