Skip to content

Commit 643fa96

Browse files
Chandan Rajendratytso
authored andcommitted
fscrypt: remove filesystem specific build config option
In order to have a common code base for fscrypt "post read" processing for all filesystems which support encryption, this commit removes filesystem specific build config option (e.g. CONFIG_EXT4_FS_ENCRYPTION) and replaces it with a build option (i.e. CONFIG_FS_ENCRYPTION) whose value affects all the filesystems making use of fscrypt. Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Eric Biggers <ebiggers@google.com>
1 parent 62230e0 commit 643fa96

31 files changed

Lines changed: 460 additions & 535 deletions

‎Documentation/filesystems/fscrypt.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ FS_IOC_SET_ENCRYPTION_POLICY can fail with the following errors:
343343
- ``ENOTEMPTY``: the file is unencrypted and is a nonempty directory
344344
- ``ENOTTY``: this type of filesystem does not implement encryption
345345
- ``EOPNOTSUPP``: the kernel was not configured with encryption
346-
support for this filesystem, or the filesystem superblock has not
346+
support for filesystems, or the filesystem superblock has not
347347
had encryption enabled on it. (For example, to use encryption on an
348-
ext4 filesystem, CONFIG_EXT4_ENCRYPTION must be enabled in the
348+
ext4 filesystem, CONFIG_FS_ENCRYPTION must be enabled in the
349349
kernel config, and the superblock must have had the "encrypt"
350350
feature flag enabled using ``tune2fs -O encrypt`` or ``mkfs.ext4 -O
351351
encrypt``.)

‎arch/mips/configs/generic_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ CONFIG_HID_MONTEREY=y
5959
CONFIG_EXT4_FS=y
6060
CONFIG_EXT4_FS_POSIX_ACL=y
6161
CONFIG_EXT4_FS_SECURITY=y
62-
CONFIG_EXT4_ENCRYPTION=y
62+
CONFIG_FS_ENCRYPTION=y
6363
CONFIG_FANOTIFY=y
6464
CONFIG_FUSE_FS=y
6565
CONFIG_CUSE=y

‎arch/nds32/configs/defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ CONFIG_GENERIC_PHY=y
7474
CONFIG_EXT4_FS=y
7575
CONFIG_EXT4_FS_POSIX_ACL=y
7676
CONFIG_EXT4_FS_SECURITY=y
77-
CONFIG_EXT4_ENCRYPTION=y
77+
CONFIG_FS_ENCRYPTION=y
7878
CONFIG_FUSE_FS=y
7979
CONFIG_MSDOS_FS=y
8080
CONFIG_VFAT_FS=y

‎arch/s390/configs/debug_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ CONFIG_S390_AP_IOMMU=y
500500
CONFIG_EXT4_FS=y
501501
CONFIG_EXT4_FS_POSIX_ACL=y
502502
CONFIG_EXT4_FS_SECURITY=y
503-
CONFIG_EXT4_ENCRYPTION=y
504503
CONFIG_JBD2_DEBUG=y
505504
CONFIG_JFS_FS=m
506505
CONFIG_JFS_POSIX_ACL=y
@@ -520,6 +519,7 @@ CONFIG_BTRFS_DEBUG=y
520519
CONFIG_NILFS2_FS=m
521520
CONFIG_FS_DAX=y
522521
CONFIG_EXPORTFS_BLOCK_OPS=y
522+
CONFIG_FS_ENCRYPTION=y
523523
CONFIG_FANOTIFY=y
524524
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
525525
CONFIG_QUOTA_NETLINK_INTERFACE=y

‎arch/s390/configs/performance_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ CONFIG_S390_AP_IOMMU=y
497497
CONFIG_EXT4_FS=y
498498
CONFIG_EXT4_FS_POSIX_ACL=y
499499
CONFIG_EXT4_FS_SECURITY=y
500-
CONFIG_EXT4_ENCRYPTION=y
501500
CONFIG_JBD2_DEBUG=y
502501
CONFIG_JFS_FS=m
503502
CONFIG_JFS_POSIX_ACL=y
@@ -515,6 +514,7 @@ CONFIG_BTRFS_FS_POSIX_ACL=y
515514
CONFIG_NILFS2_FS=m
516515
CONFIG_FS_DAX=y
517516
CONFIG_EXPORTFS_BLOCK_OPS=y
517+
CONFIG_FS_ENCRYPTION=y
518518
CONFIG_FANOTIFY=y
519519
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
520520
CONFIG_QUOTA_NETLINK_INTERFACE=y

‎fs/crypto/Kconfig‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
config FS_ENCRYPTION
2-
tristate "FS Encryption (Per-file encryption)"
2+
bool "FS Encryption (Per-file encryption)"
33
select CRYPTO
44
select CRYPTO_AES
55
select CRYPTO_CBC
@@ -12,4 +12,5 @@ config FS_ENCRYPTION
1212
Enable encryption of files and directories. This
1313
feature is similar to ecryptfs, but it is more memory
1414
efficient since it avoids caching the encrypted and
15-
decrypted pages in the page cache.
15+
decrypted pages in the page cache. Currently Ext4,
16+
F2FS and UBIFS make use of this feature.

‎fs/crypto/fscrypt_private.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#ifndef _FSCRYPT_PRIVATE_H
1313
#define _FSCRYPT_PRIVATE_H
1414

15-
#define __FS_HAS_ENCRYPTION 1
1615
#include <linux/fscrypt.h>
1716
#include <crypto/hash.h>
1817

‎fs/ext4/Kconfig‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,6 @@ config EXT4_FS_SECURITY
9696
If you are not using a security module that requires using
9797
extended attributes for file security labels, say N.
9898

99-
config EXT4_ENCRYPTION
100-
bool "Ext4 Encryption"
101-
depends on EXT4_FS
102-
select FS_ENCRYPTION
103-
help
104-
Enable encryption of ext4 files and directories. This
105-
feature is similar to ecryptfs, but it is more memory
106-
efficient since it avoids caching the encrypted and
107-
decrypted pages in the page cache.
108-
109-
config EXT4_FS_ENCRYPTION
110-
bool
111-
default y
112-
depends on EXT4_ENCRYPTION
113-
11499
config EXT4_DEBUG
115100
bool "EXT4 debugging support"
116101
depends on EXT4_FS

‎fs/ext4/dir.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
283283
done:
284284
err = 0;
285285
errout:
286-
#ifdef CONFIG_EXT4_FS_ENCRYPTION
287286
fscrypt_fname_free_buffer(&fstr);
288-
#endif
289287
brelse(bh);
290288
return err;
291289
}

‎fs/ext4/ext4.h‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include <linux/compat.h>
4141
#endif
4242

43-
#define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION)
4443
#include <linux/fscrypt.h>
4544

4645
#include <linux/compiler.h>
@@ -1326,7 +1325,7 @@ struct ext4_super_block {
13261325
#define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
13271326
#define EXT4_MF_TEST_DUMMY_ENCRYPTION 0x0004
13281327

1329-
#ifdef CONFIG_EXT4_FS_ENCRYPTION
1328+
#ifdef CONFIG_FS_ENCRYPTION
13301329
#define DUMMY_ENCRYPTION_ENABLED(sbi) (unlikely((sbi)->s_mount_flags & \
13311330
EXT4_MF_TEST_DUMMY_ENCRYPTION))
13321331
#else
@@ -2051,7 +2050,7 @@ struct ext4_filename {
20512050
const struct qstr *usr_fname;
20522051
struct fscrypt_str disk_name;
20532052
struct dx_hash_info hinfo;
2054-
#ifdef CONFIG_EXT4_FS_ENCRYPTION
2053+
#ifdef CONFIG_FS_ENCRYPTION
20552054
struct fscrypt_str crypto_buf;
20562055
#endif
20572056
};
@@ -2279,7 +2278,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb,
22792278
struct ext4_group_desc *gdp);
22802279
ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
22812280

2282-
#ifdef CONFIG_EXT4_FS_ENCRYPTION
2281+
#ifdef CONFIG_FS_ENCRYPTION
22832282
static inline int ext4_fname_setup_filename(struct inode *dir,
22842283
const struct qstr *iname,
22852284
int lookup, struct ext4_filename *fname)

0 commit comments

Comments
 (0)