Skip to content

Commit

Permalink
Reserve the codepoints for the new INCOMPAT feature ENCRYPT
Browse files Browse the repository at this point in the history
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
tytso committed Jan 26, 2015
1 parent 32ed2b0 commit 22f22ab
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions debugfs/set_fields.c
Expand Up @@ -165,6 +165,8 @@ static struct field_set_info super_fields[] = {
{ "last_error_block", &set_sb.s_last_error_block, NULL, 8, parse_uint },
{ "last_error_func", &set_sb.s_last_error_func, NULL, 32, parse_string },
{ "last_error_line", &set_sb.s_last_error_ino, NULL, 4, parse_uint },
{ "encrypt_algos", &set_sb.s_encrypt_algos, NULL, 1, parse_uint,
FLAG_ARRAY, 4 },
{ 0, 0, 0, 0 }
};

Expand Down
2 changes: 2 additions & 0 deletions lib/e2p/feature.c
Expand Up @@ -97,6 +97,8 @@ static struct feature feature_list[] = {
"large_dir"},
{ E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_INLINE_DATA,
"inline_data"},
{ E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_ENCRYPT,
"encrypt"},
{ 0, 0, 0 },
};

Expand Down
2 changes: 1 addition & 1 deletion lib/e2p/pf.c
Expand Up @@ -41,8 +41,8 @@ static struct flags_name flags_array[] = {
{ EXT2_COMPRBLK_FL, "B", "Compressed_File" },
{ EXT2_DIRTY_FL, "Z", "Compressed_Dirty_File" },
{ EXT2_NOCOMPR_FL, "X", "Compression_Raw_Access" },
{ EXT2_ECOMPR_FL, "E", "Compression_Error" },
#endif
{ EXT4_ENCRYPT_FL, "E", "Encrypted" },
{ EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
{ EXT2_INDEX_FL, "I", "Indexed_directory" },
{ EXT2_NOTAIL_FL, "t", "No_Tailmerging" },
Expand Down
13 changes: 11 additions & 2 deletions lib/ext2fs/ext2_fs.h
Expand Up @@ -307,7 +307,8 @@ struct ext2_dx_tail {
#define EXT2_DIRTY_FL 0x00000100
#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
/* nb: was previously EXT2_ECOMPR_FL */
#define EXT4_ENCRYPT_FL 0x00000800 /* encrypted inode */
/* End compression flags --- maybe not all used */
#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
Expand Down Expand Up @@ -564,6 +565,12 @@ struct ext2_inode_large {
/* Metadata checksum algorithms */
#define EXT2_CRC32C_CHKSUM 1

/* Encryption algorithms */
#define EXT4_ENCRYPTION_MODE_INVALID 0
#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1
#define EXT4_ENCRYPTION_MODE_AES_256_GCM 2
#define EXT4_ENCRYPTION_MODE_AES_256_CBC 3

/*
* Structure of the super block
*/
Expand Down Expand Up @@ -675,7 +682,8 @@ struct ext2_super_block {
__u32 s_grp_quota_inum; /* inode number of group quota file */
__u32 s_overhead_blocks; /* overhead blocks/clusters in fs */
__u32 s_backup_bgs[2]; /* If sparse_super2 enabled */
__u32 s_reserved[106]; /* Padding to the end of the block */
__u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
__u32 s_reserved[105]; /* Padding to the end of the block */
__u32 s_checksum; /* crc32c(superblock) */
};

Expand Down Expand Up @@ -761,6 +769,7 @@ struct ext2_super_block {
/* 0x2000 was EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM but this was never used */
#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 EXT2_FEATURE_COMPAT_SUPP 0
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
Expand Down
2 changes: 1 addition & 1 deletion lib/ext2fs/ext2fs.h
Expand Up @@ -614,7 +614,7 @@ typedef struct ext2_icount *ext2_icount_t;
* These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
* to ext2fs_openfs()
*/
#define EXT2_LIB_SOFTSUPP_INCOMPAT (EXT4_FEATURE_INCOMPAT_INLINE_DATA)
#define EXT2_LIB_SOFTSUPP_INCOMPAT (EXT4_FEATURE_INCOMPAT_ENCRYPT)
#define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_REPLICA)


Expand Down
3 changes: 2 additions & 1 deletion lib/ext2fs/tst_super_size.c
Expand Up @@ -136,7 +136,8 @@ int main(int argc, char **argv)
check_field(s_grp_quota_inum, 4);
check_field(s_overhead_blocks, 4);
check_field(s_backup_bgs, 8);
check_field(s_reserved, 106 * 4);
check_field(s_encrypt_algos, 4);
check_field(s_reserved, 105 * 4);
check_field(s_checksum, 4);
do_field("Superblock end", 0, 0, cur_offset, 1024);
#endif
Expand Down
4 changes: 2 additions & 2 deletions misc/chattr.1.in
Expand Up @@ -107,8 +107,8 @@ The 'e' attribute indicates that the file is using extents for mapping
the blocks on disk. It may not be removed using
.BR chattr (1).
.PP
The 'E' attribute is used by the experimental compression patches to
indicate that a compressed file has a compression error. It may not be
The 'E' attribute is used by the experimental encryption patches to
indicate that the file has been encrypted. It may not be
set or reset using
.BR chattr (1),
although it can be displayed by
Expand Down

0 comments on commit 22f22ab

Please sign in to comment.