Sync ext4 encryption as of commit dffd334e4d7134
[ext4-patch-queue.git] / reserve-codepoints-used-by-the-ext4-encryption-feature
blob16da3790e19d984bd50a6ed95322d5be13c17d9a
1 ext4 crypto: reserve codepoints used by the ext4 encryption feature
3 From: Theodore Ts'o <tytso@mit.edu>
5 Change-Id: I5f01f62e75426150c32c22188ae8ad3192da95e6
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 ---
8  fs/ext4/ext4.h | 16 +++++++++++++---
9  1 file changed, 13 insertions(+), 3 deletions(-)
11 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
12 index f7f3f58..e168382 100644
13 --- a/fs/ext4/ext4.h
14 +++ b/fs/ext4/ext4.h
15 @@ -422,7 +422,7 @@ enum {
16         EXT4_INODE_DIRTY        = 8,
17         EXT4_INODE_COMPRBLK     = 9,    /* One or more compressed clusters */
18         EXT4_INODE_NOCOMPR      = 10,   /* Don't compress */
19 -       EXT4_INODE_ENCRYPT      = 11,   /* Compression error */
20 +       EXT4_INODE_ENCRYPT      = 11,   /* Encrypted file */
21  /* End compression flags --- maybe not all used */
22         EXT4_INODE_INDEX        = 12,   /* hash-indexed directory */
23         EXT4_INODE_IMAGIC       = 13,   /* AFS directory */
24 @@ -582,6 +582,13 @@ enum {
25  #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER  0x0010
26  #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER   0x0020
28 +/* Encryption algorithms */
29 +#define EXT4_ENCRYPTION_MODE_INVALID           0
30 +#define EXT4_ENCRYPTION_MODE_AES_256_XTS       1
31 +#define EXT4_ENCRYPTION_MODE_AES_256_GCM       2
32 +#define EXT4_ENCRYPTION_MODE_AES_256_CBC       3
33 +#define EXT4_ENCRYPTION_MODE_AES_256_CTS       4
35  /*
36   * ioctl commands
37   */
38 @@ -1142,7 +1149,8 @@ struct ext4_super_block {
39         __le32  s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
40         __u8    s_log_groups_per_flex;  /* FLEX_BG group size */
41         __u8    s_checksum_type;        /* metadata checksum algorithm used */
42 -       __le16  s_reserved_pad;
43 +       __u8    s_encryption_level;     /* versioning level for encryption */
44 +       __u8    s_reserved_pad;         /* Padding to next 32bits */
45         __le64  s_kbytes_written;       /* nr of lifetime kilobytes written */
46         __le32  s_snapshot_inum;        /* Inode number of active snapshot */
47         __le32  s_snapshot_id;          /* sequential ID of active snapshot */
48 @@ -1169,7 +1177,9 @@ struct ext4_super_block {
49         __le32  s_overhead_clusters;    /* overhead blocks/clusters in fs */
50         __le32  s_backup_bgs[2];        /* groups with sparse_super2 SBs */
51         __u8    s_encrypt_algos[4];     /* Encryption algorithms in use  */
52 -       __le32  s_reserved[105];        /* Padding to the end of the block */
53 +       __u8    s_encrypt_pw_salt[16];  /* Salt used for string2key algorithm */
54 +       __le32  s_lpf_ino;              /* Location of the lost+found inode */
55 +       __le32  s_reserved[100];        /* Padding to the end of the block */
56         __le32  s_checksum;             /* crc32c(superblock) */
57  };