aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-01-19 16:00:58 -0500
committerTheodore Ts'o <tytso@mit.edu>2015-01-19 16:00:58 -0500
commit3edc18d84540b94c0eba9226d01a8cbe4c162b55 (patch)
tree461b974117ab734b240f9ac13237624f72cfdda0
parentb6924225c292593189e90604c395f87cbd4130ba (diff)
ext4: reserve codepoints used by the ext4 encryption feature
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index a75fba67bb1f..b7f393df2e4c 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -364,7 +364,8 @@ struct flex_groups {
364#define EXT4_DIRTY_FL 0x00000100 364#define EXT4_DIRTY_FL 0x00000100
365#define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ 365#define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
366#define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */ 366#define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
367#define EXT4_ECOMPR_FL 0x00000800 /* Compression error */ 367 /* nb: was previously EXT2_ECOMPR_FL */
368#define EXT4_ENCRYPT_FL 0x00000800 /* encrypted file */
368/* End compression flags --- maybe not all used */ 369/* End compression flags --- maybe not all used */
369#define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */ 370#define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
370#define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */ 371#define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
@@ -421,7 +422,7 @@ enum {
421 EXT4_INODE_DIRTY = 8, 422 EXT4_INODE_DIRTY = 8,
422 EXT4_INODE_COMPRBLK = 9, /* One or more compressed clusters */ 423 EXT4_INODE_COMPRBLK = 9, /* One or more compressed clusters */
423 EXT4_INODE_NOCOMPR = 10, /* Don't compress */ 424 EXT4_INODE_NOCOMPR = 10, /* Don't compress */
424 EXT4_INODE_ECOMPR = 11, /* Compression error */ 425 EXT4_INODE_ENCRYPT = 11, /* Compression error */
425/* End compression flags --- maybe not all used */ 426/* End compression flags --- maybe not all used */
426 EXT4_INODE_INDEX = 12, /* hash-indexed directory */ 427 EXT4_INODE_INDEX = 12, /* hash-indexed directory */
427 EXT4_INODE_IMAGIC = 13, /* AFS directory */ 428 EXT4_INODE_IMAGIC = 13, /* AFS directory */
@@ -466,7 +467,7 @@ static inline void ext4_check_flag_values(void)
466 CHECK_FLAG_VALUE(DIRTY); 467 CHECK_FLAG_VALUE(DIRTY);
467 CHECK_FLAG_VALUE(COMPRBLK); 468 CHECK_FLAG_VALUE(COMPRBLK);
468 CHECK_FLAG_VALUE(NOCOMPR); 469 CHECK_FLAG_VALUE(NOCOMPR);
469 CHECK_FLAG_VALUE(ECOMPR); 470 CHECK_FLAG_VALUE(ENCRYPT);
470 CHECK_FLAG_VALUE(INDEX); 471 CHECK_FLAG_VALUE(INDEX);
471 CHECK_FLAG_VALUE(IMAGIC); 472 CHECK_FLAG_VALUE(IMAGIC);
472 CHECK_FLAG_VALUE(JOURNAL_DATA); 473 CHECK_FLAG_VALUE(JOURNAL_DATA);
@@ -1043,6 +1044,12 @@ extern void ext4_set_bits(void *bm, int cur, int len);
1043/* Metadata checksum algorithm codes */ 1044/* Metadata checksum algorithm codes */
1044#define EXT4_CRC32C_CHKSUM 1 1045#define EXT4_CRC32C_CHKSUM 1
1045 1046
1047/* Encryption algorithms */
1048#define EXT4_ENCRYPTION_MODE_INVALID 0
1049#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1
1050#define EXT4_ENCRYPTION_MODE_AES_256_GCM 2
1051#define EXT4_ENCRYPTION_MODE_AES_256_CBC 3
1052
1046/* 1053/*
1047 * Structure of the super block 1054 * Structure of the super block
1048 */ 1055 */
@@ -1156,7 +1163,8 @@ struct ext4_super_block {
1156 __le32 s_grp_quota_inum; /* inode for tracking group quota */ 1163 __le32 s_grp_quota_inum; /* inode for tracking group quota */
1157 __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */ 1164 __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */
1158 __le32 s_backup_bgs[2]; /* groups with sparse_super2 SBs */ 1165 __le32 s_backup_bgs[2]; /* groups with sparse_super2 SBs */
1159 __le32 s_reserved[106]; /* Padding to the end of the block */ 1166 __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
1167 __le32 s_reserved[105]; /* Padding to the end of the block */
1160 __le32 s_checksum; /* crc32c(superblock) */ 1168 __le32 s_checksum; /* crc32c(superblock) */
1161}; 1169};
1162 1170
@@ -1537,6 +1545,7 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
1537#define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */ 1545#define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
1538#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ 1546#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
1539#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */ 1547#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
1548#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000
1540 1549
1541#define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR 1550#define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
1542#define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ 1551#define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \