Re: [f2fs-dev] [PATCH 3/7] fscrypt: Remove filesystem specific build config option

2018-11-27 Thread Chandan Rajendra
On Tuesday, November 27, 2018 5:44:24 AM IST Eric Biggers wrote:
> Hi Chandan,
> 
> On Mon, Nov 19, 2018 at 10:53:20AM +0530, Chandan Rajendra wrote:
> > 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.
> > 
> > Signed-off-by: Chandan Rajendra 
> 
> Can you grep for EXT4_ENCRYPTION?  There are still some references left, one 
> in
> Documentation/filesystems/fscrypt.rst and some in defconfig files.
>
> Also in include/linux/fs.h, there are tests of
> 
> #if IS_ENABLED(CONFIG_FS_ENCRYPTION)
> 
> which after this change should be
> 
> #ifdef CONFIG_FS_ENCRYPTION
> 
> like is done elsewhere.

Sorry, I had restricted my search to *.[ch] files and that too within
linux/fs/ directory. I will fix the other occurrences as well.

> 
> > ---
> >  fs/crypto/Kconfig   |   2 +-
> >  fs/ext4/Kconfig |  15 --
> >  fs/ext4/dir.c   |   2 -
> >  fs/ext4/ext4.h  |   7 +-
> >  fs/ext4/inode.c |   8 +-
> >  fs/ext4/ioctl.c |   4 +-
> >  fs/ext4/namei.c |  10 +-
> >  fs/ext4/page-io.c   |   6 +-
> >  fs/ext4/readpage.c  |   2 +-
> >  fs/ext4/super.c |   6 +-
> >  fs/ext4/sysfs.c |   4 +-
> >  fs/f2fs/Kconfig |  11 -
> >  fs/f2fs/f2fs.h  |   7 +-
> >  fs/f2fs/super.c |   8 +-
> >  fs/f2fs/sysfs.c |   4 +-
> >  include/linux/fscrypt.h | 416 +++-
> >  include/linux/fscrypt_notsupp.h | 231 --
> >  include/linux/fscrypt_supp.h| 204 
> >  18 files changed, 441 insertions(+), 506 deletions(-)
> >  delete mode 100644 include/linux/fscrypt_notsupp.h
> >  delete mode 100644 include/linux/fscrypt_supp.h
> > 
> > diff --git a/fs/crypto/Kconfig b/fs/crypto/Kconfig
> > index 02b7d91c9231..6e9ae566a8fc 100644
> > --- a/fs/crypto/Kconfig
> > +++ b/fs/crypto/Kconfig
> > @@ -1,5 +1,5 @@
> >  config FS_ENCRYPTION
> > -   tristate "FS Encryption (Per-file encryption)"
> > +   bool "FS Encryption (Per-file encryption)"
> > select CRYPTO
> > select CRYPTO_AES
> > select CRYPTO_CBC
> > diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
> > index 5a76125ac0f8..e1002bbf35bf 100644
> > --- a/fs/ext4/Kconfig
> > +++ b/fs/ext4/Kconfig
> > @@ -96,21 +96,6 @@ config EXT4_FS_SECURITY
> >   If you are not using a security module that requires using
> >   extended attributes for file security labels, say N.
> >  
> > -config EXT4_ENCRYPTION
> > -   bool "Ext4 Encryption"
> > -   depends on EXT4_FS
> > -   select FS_ENCRYPTION
> > -   help
> > - Enable encryption of ext4 files and directories.  This
> > - feature is similar to ecryptfs, but it is more memory
> > - efficient since it avoids caching the encrypted and
> > - decrypted pages in the page cache.
> > -
> > -config EXT4_FS_ENCRYPTION
> > -   bool
> > -   default y
> > -   depends on EXT4_ENCRYPTION
> > -
> >  config EXT4_FS_VERITY
> > bool "Ext4 Verity"
> > depends on EXT4_FS
> > diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
> > index fb7a64ea5679..0ccd51f72048 100644
> > --- a/fs/ext4/dir.c
> > +++ b/fs/ext4/dir.c
> > @@ -283,9 +283,7 @@ static int ext4_readdir(struct file *file, struct 
> > dir_context *ctx)
> >  done:
> > err = 0;
> >  errout:
> > -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> > fscrypt_fname_free_buffer();
> > -#endif
> > brelse(bh);
> > return err;
> >  }
> > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> > index 2ae6ab88f218..db21df885186 100644
> > --- a/fs/ext4/ext4.h
> > +++ b/fs/ext4/ext4.h
> > @@ -40,7 +40,6 @@
> >  #include 
> >  #endif
> >  
> > -#define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION)
> >  #include 
> >  
> >  #define __FS_HAS_VERITY IS_ENABLED(CONFIG_EXT4_FS_VERITY)
> > @@ -1341,7 +1340,7 @@ struct ext4_super_block {
> >  #define EXT4_MF_FS_ABORTED 0x0002  /* Fatal error detected */
> >  #define EXT4_MF_TEST_DUMMY_ENCRYPTION  0x0004
> >  
> > -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> > +#ifdef CONFIG_FS_ENCRYPTION
> >  #define DUMMY_ENCRYPTION_ENABLED(sbi) (unlikely((sbi)->s_mount_flags & \
> > EXT4_MF_TEST_DUMMY_ENCRYPTION))
> >  #else
> > @@ -2069,7 +2068,7 @@ struct ext4_filename {
> > const struct qstr *usr_fname;
> > struct fscrypt_str disk_name;
> > struct dx_hash_info hinfo;
> > -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> > +#ifdef CONFIG_FS_ENCRYPTION
> > struct fscrypt_str crypto_buf;
> >  #endif
> >  };
> > @@ -2306,7 +2305,7 @@ static inline bool ext4_verity_inode(struct inode 
> > *inode)
> >  #endif
> >  }
> >  
> > -#ifdef 

Re: [f2fs-dev] [PATCH 3/7] fscrypt: Remove filesystem specific build config option

2018-11-26 Thread Eric Biggers
Hi Chandan,

On Mon, Nov 19, 2018 at 10:53:20AM +0530, Chandan Rajendra wrote:
> 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.
> 
> Signed-off-by: Chandan Rajendra 

Can you grep for EXT4_ENCRYPTION?  There are still some references left, one in
Documentation/filesystems/fscrypt.rst and some in defconfig files.

Also in include/linux/fs.h, there are tests of

#if IS_ENABLED(CONFIG_FS_ENCRYPTION)

which after this change should be

#ifdef CONFIG_FS_ENCRYPTION

like is done elsewhere.

Thanks,

- Eric

> ---
>  fs/crypto/Kconfig   |   2 +-
>  fs/ext4/Kconfig |  15 --
>  fs/ext4/dir.c   |   2 -
>  fs/ext4/ext4.h  |   7 +-
>  fs/ext4/inode.c |   8 +-
>  fs/ext4/ioctl.c |   4 +-
>  fs/ext4/namei.c |  10 +-
>  fs/ext4/page-io.c   |   6 +-
>  fs/ext4/readpage.c  |   2 +-
>  fs/ext4/super.c |   6 +-
>  fs/ext4/sysfs.c |   4 +-
>  fs/f2fs/Kconfig |  11 -
>  fs/f2fs/f2fs.h  |   7 +-
>  fs/f2fs/super.c |   8 +-
>  fs/f2fs/sysfs.c |   4 +-
>  include/linux/fscrypt.h | 416 +++-
>  include/linux/fscrypt_notsupp.h | 231 --
>  include/linux/fscrypt_supp.h| 204 
>  18 files changed, 441 insertions(+), 506 deletions(-)
>  delete mode 100644 include/linux/fscrypt_notsupp.h
>  delete mode 100644 include/linux/fscrypt_supp.h
> 
> diff --git a/fs/crypto/Kconfig b/fs/crypto/Kconfig
> index 02b7d91c9231..6e9ae566a8fc 100644
> --- a/fs/crypto/Kconfig
> +++ b/fs/crypto/Kconfig
> @@ -1,5 +1,5 @@
>  config FS_ENCRYPTION
> - tristate "FS Encryption (Per-file encryption)"
> + bool "FS Encryption (Per-file encryption)"
>   select CRYPTO
>   select CRYPTO_AES
>   select CRYPTO_CBC
> diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
> index 5a76125ac0f8..e1002bbf35bf 100644
> --- a/fs/ext4/Kconfig
> +++ b/fs/ext4/Kconfig
> @@ -96,21 +96,6 @@ config EXT4_FS_SECURITY
> If you are not using a security module that requires using
> extended attributes for file security labels, say N.
>  
> -config EXT4_ENCRYPTION
> - bool "Ext4 Encryption"
> - depends on EXT4_FS
> - select FS_ENCRYPTION
> - help
> -   Enable encryption of ext4 files and directories.  This
> -   feature is similar to ecryptfs, but it is more memory
> -   efficient since it avoids caching the encrypted and
> -   decrypted pages in the page cache.
> -
> -config EXT4_FS_ENCRYPTION
> - bool
> - default y
> - depends on EXT4_ENCRYPTION
> -
>  config EXT4_FS_VERITY
>   bool "Ext4 Verity"
>   depends on EXT4_FS
> diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
> index fb7a64ea5679..0ccd51f72048 100644
> --- a/fs/ext4/dir.c
> +++ b/fs/ext4/dir.c
> @@ -283,9 +283,7 @@ static int ext4_readdir(struct file *file, struct 
> dir_context *ctx)
>  done:
>   err = 0;
>  errout:
> -#ifdef CONFIG_EXT4_FS_ENCRYPTION
>   fscrypt_fname_free_buffer();
> -#endif
>   brelse(bh);
>   return err;
>  }
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 2ae6ab88f218..db21df885186 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -40,7 +40,6 @@
>  #include 
>  #endif
>  
> -#define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION)
>  #include 
>  
>  #define __FS_HAS_VERITY IS_ENABLED(CONFIG_EXT4_FS_VERITY)
> @@ -1341,7 +1340,7 @@ struct ext4_super_block {
>  #define EXT4_MF_FS_ABORTED   0x0002  /* Fatal error detected */
>  #define EXT4_MF_TEST_DUMMY_ENCRYPTION0x0004
>  
> -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> +#ifdef CONFIG_FS_ENCRYPTION
>  #define DUMMY_ENCRYPTION_ENABLED(sbi) (unlikely((sbi)->s_mount_flags & \
>   EXT4_MF_TEST_DUMMY_ENCRYPTION))
>  #else
> @@ -2069,7 +2068,7 @@ struct ext4_filename {
>   const struct qstr *usr_fname;
>   struct fscrypt_str disk_name;
>   struct dx_hash_info hinfo;
> -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> +#ifdef CONFIG_FS_ENCRYPTION
>   struct fscrypt_str crypto_buf;
>  #endif
>  };
> @@ -2306,7 +2305,7 @@ static inline bool ext4_verity_inode(struct inode 
> *inode)
>  #endif
>  }
>  
> -#ifdef CONFIG_EXT4_FS_ENCRYPTION
> +#ifdef CONFIG_FS_ENCRYPTION
>  static inline int ext4_fname_setup_filename(struct inode *dir,
>   const struct qstr *iname,
>   int lookup, struct ext4_filename *fname)
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 72572f32..ae6794649817 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1150,7 +1150,7 @@ int