diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index 588c61c274f5..ea28dd500d2b 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -11,6 +11,7 @@ #ifndef _FSCRYPT_PRIVATE_H #define _FSCRYPT_PRIVATE_H +#define FSCRYPT_NEED_OPS #include #include #include diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 75f97bf2e507..3ce93d7484cf 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -40,6 +40,7 @@ #include #endif +#define FSCRYPT_NEED_OPS #include #include diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1cf0dde4799c..0ac02697ed1c 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -24,6 +24,7 @@ #include #include +#define FSCRYPT_NEED_OPS #include #include diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index bff682309fbe..5d20ba451463 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -31,6 +31,7 @@ #include #include +#define FSCRYPT_NEED_OPS #include #include "ubifs-media.h" diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index 0e28e81aee8a..f226673dd447 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -53,6 +53,7 @@ struct fscrypt_name { */ #define FS_CFLG_OWN_PAGES (1U << 1) +#ifdef FSCRYPT_NEED_OPS /* * crypto operations for filesystems */ @@ -74,6 +75,7 @@ struct fscrypt_operations { void (*get_devices)(struct super_block *sb, struct request_queue **devs); }; +#endif static inline bool fscrypt_has_encryption_key(const struct inode *inode) { @@ -97,6 +99,7 @@ static inline bool fscrypt_needs_contents_encryption(const struct inode *inode) return IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode); } +#ifdef FSCRYPT_NEED_OPS static inline const union fscrypt_context * fscrypt_get_dummy_context(struct super_block *sb) { @@ -104,6 +107,7 @@ fscrypt_get_dummy_context(struct super_block *sb) return NULL; return sb->s_cop->get_dummy_context(sb); } +#endif /* * When d_splice_alias() moves a directory's encrypted alias to its decrypted @@ -801,6 +805,7 @@ static inline int fscrypt_prepare_setattr(struct dentry *dentry, * -ENOKEY if the encryption key is missing, or another -errno code if a problem * occurred while setting up the encryption key. */ +#ifdef FSCRYPT_NEED_OPS static inline int fscrypt_prepare_symlink(struct inode *dir, const char *target, unsigned int len, @@ -816,6 +821,7 @@ static inline int fscrypt_prepare_symlink(struct inode *dir, return -ENAMETOOLONG; return 0; } +#endif /** * fscrypt_encrypt_symlink() - encrypt the symlink target if needed