int e2p_string2encmode(char *string);
int e2p_str2encoding(const char *string);
+const char *e2p_encoding2str(int encoding);
int e2p_get_encoding_flags(int encoding);
int e2p_str2encoding_flags(int encoding, char *param, __u16 *flags);
(sizeof(array) / sizeof(array[0]))
static const struct {
- char *name;
+ const char *name;
__u16 encoding_magic;
__u16 default_flags;
} ext4_encoding_map[] = {
{
.encoding_magic = EXT4_ENC_UTF8_12_1,
+ .name = "utf8-12.1",
+ .default_flags = 0,
+ },
+ {
+ .encoding_magic = EXT4_ENC_UTF8_12_1,
.name = "utf8",
.default_flags = 0,
},
static const struct enc_flags {
__u16 flag;
- char *param;
+ const char *param;
} encoding_flags[] = {
{ EXT4_ENC_STRICT_MODE_FL, "strict" },
};
* or a negative value indicating error. */
int e2p_str2encoding(const char *string)
{
- int i;
+ unsigned int i;
for (i = 0 ; i < ARRAY_SIZE(ext4_encoding_map); i++)
if (!strcmp(string, ext4_encoding_map[i].name))
return -EINVAL;
}
+/* Return the name of an encoding or NULL */
+const char *e2p_encoding2str(int encoding)
+{
+ unsigned int i;
+ static char buf[32];
+
+ for (i = 0 ; i < ARRAY_SIZE(ext4_encoding_map); i++)
+ if (ext4_encoding_map[i].encoding_magic == encoding)
+ return ext4_encoding_map[i].name;
+ sprintf(buf, "UNKNOWN_ENCODING_%d", encoding);
+ return buf;
+}
+
int e2p_get_encoding_flags(int encoding)
{
- int i;
+ unsigned int i;
for (i = 0 ; i < ARRAY_SIZE(ext4_encoding_map); i++)
if (ext4_encoding_map[i].encoding_magic == encoding)
{
char *f = strtok(param, "-");
const struct enc_flags *fl;
- int i, neg = 0;
+ unsigned int i, neg = 0;
while (f) {
neg = 0;
if (ext2fs_has_feature_csum_seed(sb))
fprintf(f, "Checksum seed: 0x%08x\n",
sb->s_checksum_seed);
+ if (ext2fs_has_feature_fname_encoding(sb))
+ fprintf(f, "Character encoding: %s\n",
+ e2p_encoding2str(sb->s_encoding));
}
void list_super (struct ext2_super_block * s)