4 * This stubs out the fscrypt functions for filesystems configured without
8 #ifndef _LINUX_FSCRYPT_NOTSUPP_H
9 #define _LINUX_FSCRYPT_NOTSUPP_H
11 #include <linux/fscrypt_common.h>
14 static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,
17 return ERR_PTR(-EOPNOTSUPP);
20 static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
25 static inline struct page *fscrypt_encrypt_page(const struct inode *inode,
29 u64 lblk_num, gfp_t gfp_flags)
31 return ERR_PTR(-EOPNOTSUPP);
34 static inline int fscrypt_decrypt_page(const struct inode *inode,
36 unsigned int len, unsigned int offs,
43 static inline void fscrypt_restore_control_page(struct page *page)
48 static inline void fscrypt_set_d_op(struct dentry *dentry)
53 static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry)
59 static inline int fscrypt_ioctl_set_policy(struct file *filp,
60 const void __user *arg)
65 static inline int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg)
70 static inline int fscrypt_has_permitted_context(struct inode *parent,
76 static inline int fscrypt_inherit_context(struct inode *parent,
78 void *fs_data, bool preload)
84 static inline int fscrypt_get_encryption_info(struct inode *inode)
89 static inline void fscrypt_put_encryption_info(struct inode *inode,
90 struct fscrypt_info *ci)
96 static inline int fscrypt_setup_filename(struct inode *dir,
97 const struct qstr *iname,
98 int lookup, struct fscrypt_name *fname)
100 if (dir->i_sb->s_cop->is_encrypted(dir))
103 memset(fname, 0, sizeof(struct fscrypt_name));
104 fname->usr_fname = iname;
105 fname->disk_name.name = (unsigned char *)iname->name;
106 fname->disk_name.len = iname->len;
110 static inline void fscrypt_free_filename(struct fscrypt_name *fname)
115 static inline u32 fscrypt_fname_encrypted_size(const struct inode *inode,
123 static inline int fscrypt_fname_alloc_buffer(const struct inode *inode,
125 struct fscrypt_str *crypto_str)
130 static inline void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
135 static inline int fscrypt_fname_disk_to_usr(struct inode *inode,
136 u32 hash, u32 minor_hash,
137 const struct fscrypt_str *iname,
138 struct fscrypt_str *oname)
143 static inline int fscrypt_fname_usr_to_disk(struct inode *inode,
144 const struct qstr *iname,
145 struct fscrypt_str *oname)
150 static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
151 const u8 *de_name, u32 de_name_len)
153 /* Encryption support disabled; use standard comparison */
154 if (de_name_len != fname->disk_name.len)
156 return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
160 static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
166 static inline void fscrypt_pullback_bio_page(struct page **page, bool restore)
171 static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
172 sector_t pblk, unsigned int len)
177 #endif /* _LINUX_FSCRYPT_NOTSUPP_H */