Whamcloud - gitweb
Reserve feature bit and SB field bit for filename encoding
authorGabriel Krisman Bertazi <krisman@collabora.co.uk>
Mon, 19 Nov 2018 04:12:48 +0000 (23:12 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 19 Nov 2018 04:14:54 +0000 (23:14 -0500)
The s_encoding field in the superblock stores a magic number indicating
the encoding format and version used globally by file and directory
names in the filesystem.

The s_encoding_flags defines policies for using the charset encoding,
like how to handle invalid sequences and what kind of normalization to
use.

A feature flag is also allocated to indicate whether this filesystem has
encoding awareness enabled.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/e2p/feature.c
lib/ext2fs/ext2_fs.h
lib/ext2fs/ext2fs.h

index e3b0dab..294a56a 100644 (file)
@@ -109,6 +109,8 @@ static struct feature feature_list[] = {
                        "inline_data"},
        {       E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_ENCRYPT,
                        "encrypt"},
+       {       E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_FNAME_ENCODING,
+                       "encoding"},
        {       0, 0, 0 },
 };
 
index ab25954..f1c405b 100644 (file)
@@ -755,7 +755,9 @@ struct ext2_super_block {
        __u8    s_first_error_time_hi;
        __u8    s_last_error_time_hi;
        __u8    s_pad[2];
-       __le32  s_reserved[96];         /* Padding to the end of the block */
+/*27c*/ __le16 s_encoding;             /* Filename charset encoding */
+       __le16  s_encoding_flags;       /* Filename charset encoding flags */
+       __le32  s_reserved[95];         /* Padding to the end of the block */
 /*3fc*/        __u32   s_checksum;             /* crc32c(superblock) */
 };
 
@@ -846,6 +848,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_INCOMPAT_LARGEDIR         0x4000 /* >2GB or 3-lvl htree */
 #define EXT4_FEATURE_INCOMPAT_INLINE_DATA      0x8000 /* data in inode */
 #define EXT4_FEATURE_INCOMPAT_ENCRYPT          0x10000
+#define EXT4_FEATURE_INCOMPAT_FNAME_ENCODING   0x20000
 
 #define EXT4_FEATURE_COMPAT_FUNCS(name, ver, flagname) \
 static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \
@@ -939,6 +942,7 @@ EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed,              4, CSUM_SEED)
 EXT4_FEATURE_INCOMPAT_FUNCS(largedir,          4, LARGEDIR)
 EXT4_FEATURE_INCOMPAT_FUNCS(inline_data,       4, INLINE_DATA)
 EXT4_FEATURE_INCOMPAT_FUNCS(encrypt,           4, ENCRYPT)
+EXT4_FEATURE_INCOMPAT_FUNCS(fname_encoding,    4, FNAME_ENCODING)
 
 #define EXT2_FEATURE_COMPAT_SUPP       0
 #define EXT2_FEATURE_INCOMPAT_SUPP    (EXT2_FEATURE_INCOMPAT_FILETYPE| \
index a5fc90a..5b87d39 100644 (file)
@@ -616,6 +616,7 @@ typedef struct ext2_icount *ext2_icount_t;
                                         EXT4_FEATURE_INCOMPAT_64BIT|\
                                         EXT4_FEATURE_INCOMPAT_INLINE_DATA|\
                                         EXT4_FEATURE_INCOMPAT_ENCRYPT|\
+                                        EXT4_FEATURE_INCOMPAT_FNAME_ENCODING|\
                                         EXT4_FEATURE_INCOMPAT_CSUM_SEED|\
                                         EXT4_FEATURE_INCOMPAT_LARGEDIR)