1 ext4: reserve codepoints used by the ext4 encryption feature
3 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 fs/ext4/ext4.h | 17 +++++++++++++----
6 1 file changed, 13 insertions(+), 4 deletions(-)
8 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
9 index a75fba6..b7f393d 100644
12 @@ -364,7 +364,8 @@ struct flex_groups {
13 #define EXT4_DIRTY_FL 0x00000100
14 #define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
15 #define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
16 -#define EXT4_ECOMPR_FL 0x00000800 /* Compression error */
17 + /* nb: was previously EXT2_ECOMPR_FL */
18 +#define EXT4_ENCRYPT_FL 0x00000800 /* encrypted file */
19 /* End compression flags --- maybe not all used */
20 #define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
21 #define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
22 @@ -421,7 +422,7 @@ enum {
24 EXT4_INODE_COMPRBLK = 9, /* One or more compressed clusters */
25 EXT4_INODE_NOCOMPR = 10, /* Don't compress */
26 - EXT4_INODE_ECOMPR = 11, /* Compression error */
27 + EXT4_INODE_ENCRYPT = 11, /* Compression error */
28 /* End compression flags --- maybe not all used */
29 EXT4_INODE_INDEX = 12, /* hash-indexed directory */
30 EXT4_INODE_IMAGIC = 13, /* AFS directory */
31 @@ -466,7 +467,7 @@ static inline void ext4_check_flag_values(void)
32 CHECK_FLAG_VALUE(DIRTY);
33 CHECK_FLAG_VALUE(COMPRBLK);
34 CHECK_FLAG_VALUE(NOCOMPR);
35 - CHECK_FLAG_VALUE(ECOMPR);
36 + CHECK_FLAG_VALUE(ENCRYPT);
37 CHECK_FLAG_VALUE(INDEX);
38 CHECK_FLAG_VALUE(IMAGIC);
39 CHECK_FLAG_VALUE(JOURNAL_DATA);
40 @@ -1043,6 +1044,12 @@ extern void ext4_set_bits(void *bm, int cur, int len);
41 /* Metadata checksum algorithm codes */
42 #define EXT4_CRC32C_CHKSUM 1
44 +/* Encryption algorithms */
45 +#define EXT4_ENCRYPTION_MODE_INVALID 0
46 +#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1
47 +#define EXT4_ENCRYPTION_MODE_AES_256_GCM 2
48 +#define EXT4_ENCRYPTION_MODE_AES_256_CBC 3
51 * Structure of the super block
53 @@ -1156,7 +1163,8 @@ struct ext4_super_block {
54 __le32 s_grp_quota_inum; /* inode for tracking group quota */
55 __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */
56 __le32 s_backup_bgs[2]; /* groups with sparse_super2 SBs */
57 - __le32 s_reserved[106]; /* Padding to the end of the block */
58 + __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
59 + __le32 s_reserved[105]; /* Padding to the end of the block */
60 __le32 s_checksum; /* crc32c(superblock) */
63 @@ -1537,6 +1545,7 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
64 #define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
65 #define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
66 #define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
67 +#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000
69 #define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
70 #define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \