Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / include / linux / fscrypt_notsupp.h
blob44b50c04bae9a3ad31cb319635c683dfa1899c6b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * fscrypt_notsupp.h
5 * This stubs out the fscrypt functions for filesystems configured without
6 * encryption support.
8 * Do not include this file directly. Use fscrypt.h instead!
9 */
10 #ifndef _LINUX_FSCRYPT_H
11 #error "Incorrect include of linux/fscrypt_notsupp.h!"
12 #endif
14 #ifndef _LINUX_FSCRYPT_NOTSUPP_H
15 #define _LINUX_FSCRYPT_NOTSUPP_H
17 static inline bool fscrypt_has_encryption_key(const struct inode *inode)
19 return false;
22 static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
24 return false;
27 /* crypto.c */
28 static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,
29 gfp_t gfp_flags)
31 return ERR_PTR(-EOPNOTSUPP);
34 static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
36 return;
39 static inline struct page *fscrypt_encrypt_page(const struct inode *inode,
40 struct page *page,
41 unsigned int len,
42 unsigned int offs,
43 u64 lblk_num, gfp_t gfp_flags)
45 return ERR_PTR(-EOPNOTSUPP);
48 static inline int fscrypt_decrypt_page(const struct inode *inode,
49 struct page *page,
50 unsigned int len, unsigned int offs,
51 u64 lblk_num)
53 return -EOPNOTSUPP;
56 static inline struct page *fscrypt_control_page(struct page *page)
58 WARN_ON_ONCE(1);
59 return ERR_PTR(-EINVAL);
62 static inline void fscrypt_restore_control_page(struct page *page)
64 return;
67 static inline void fscrypt_set_d_op(struct dentry *dentry)
69 return;
72 static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry)
74 return;
77 /* policy.c */
78 static inline int fscrypt_ioctl_set_policy(struct file *filp,
79 const void __user *arg)
81 return -EOPNOTSUPP;
84 static inline int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg)
86 return -EOPNOTSUPP;
89 static inline int fscrypt_has_permitted_context(struct inode *parent,
90 struct inode *child)
92 return 0;
95 static inline int fscrypt_inherit_context(struct inode *parent,
96 struct inode *child,
97 void *fs_data, bool preload)
99 return -EOPNOTSUPP;
102 /* keyinfo.c */
103 static inline int fscrypt_get_encryption_info(struct inode *inode)
105 return -EOPNOTSUPP;
108 static inline void fscrypt_put_encryption_info(struct inode *inode)
110 return;
113 /* fname.c */
114 static inline int fscrypt_setup_filename(struct inode *dir,
115 const struct qstr *iname,
116 int lookup, struct fscrypt_name *fname)
118 if (IS_ENCRYPTED(dir))
119 return -EOPNOTSUPP;
121 memset(fname, 0, sizeof(struct fscrypt_name));
122 fname->usr_fname = iname;
123 fname->disk_name.name = (unsigned char *)iname->name;
124 fname->disk_name.len = iname->len;
125 return 0;
128 static inline void fscrypt_free_filename(struct fscrypt_name *fname)
130 return;
133 static inline int fscrypt_fname_alloc_buffer(const struct inode *inode,
134 u32 max_encrypted_len,
135 struct fscrypt_str *crypto_str)
137 return -EOPNOTSUPP;
140 static inline void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
142 return;
145 static inline int fscrypt_fname_disk_to_usr(struct inode *inode,
146 u32 hash, u32 minor_hash,
147 const struct fscrypt_str *iname,
148 struct fscrypt_str *oname)
150 return -EOPNOTSUPP;
153 static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
154 const u8 *de_name, u32 de_name_len)
156 /* Encryption support disabled; use standard comparison */
157 if (de_name_len != fname->disk_name.len)
158 return false;
159 return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
162 /* bio.c */
163 static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
164 struct bio *bio)
166 return;
169 static inline void fscrypt_pullback_bio_page(struct page **page, bool restore)
171 return;
174 static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
175 sector_t pblk, unsigned int len)
177 return -EOPNOTSUPP;
180 /* hooks.c */
182 static inline int fscrypt_file_open(struct inode *inode, struct file *filp)
184 if (IS_ENCRYPTED(inode))
185 return -EOPNOTSUPP;
186 return 0;
189 static inline int __fscrypt_prepare_link(struct inode *inode,
190 struct inode *dir)
192 return -EOPNOTSUPP;
195 static inline int __fscrypt_prepare_rename(struct inode *old_dir,
196 struct dentry *old_dentry,
197 struct inode *new_dir,
198 struct dentry *new_dentry,
199 unsigned int flags)
201 return -EOPNOTSUPP;
204 static inline int __fscrypt_prepare_lookup(struct inode *dir,
205 struct dentry *dentry)
207 return -EOPNOTSUPP;
210 static inline int __fscrypt_prepare_symlink(struct inode *dir,
211 unsigned int len,
212 unsigned int max_len,
213 struct fscrypt_str *disk_link)
215 return -EOPNOTSUPP;
218 static inline int __fscrypt_encrypt_symlink(struct inode *inode,
219 const char *target,
220 unsigned int len,
221 struct fscrypt_str *disk_link)
223 return -EOPNOTSUPP;
226 static inline const char *fscrypt_get_symlink(struct inode *inode,
227 const void *caddr,
228 unsigned int max_size,
229 struct delayed_call *done)
231 return ERR_PTR(-EOPNOTSUPP);
234 #endif /* _LINUX_FSCRYPT_NOTSUPP_H */