PCI: pnv_php: Add missing of_node_put()
[linux-2.6-block.git] / include / linux / fscrypt_notsupp.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
46f47e48
EB
2/*
3 * fscrypt_notsupp.h
4 *
5 * This stubs out the fscrypt functions for filesystems configured without
6 * encryption support.
734f0d24
DC
7 *
8 * Do not include this file directly. Use fscrypt.h instead!
46f47e48 9 */
734f0d24
DC
10#ifndef _LINUX_FSCRYPT_H
11#error "Incorrect include of linux/fscrypt_notsupp.h!"
12#endif
46f47e48
EB
13
14#ifndef _LINUX_FSCRYPT_NOTSUPP_H
15#define _LINUX_FSCRYPT_NOTSUPP_H
16
3d463f28
EB
17static inline bool fscrypt_has_encryption_key(const struct inode *inode)
18{
19 return false;
20}
21
1493651b
EB
22static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
23{
24 return false;
25}
26
46f47e48
EB
27/* crypto.c */
28static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,
29 gfp_t gfp_flags)
30{
31 return ERR_PTR(-EOPNOTSUPP);
32}
33
34static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
35{
36 return;
37}
38
39static 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)
44{
45 return ERR_PTR(-EOPNOTSUPP);
46}
47
48static inline int fscrypt_decrypt_page(const struct inode *inode,
49 struct page *page,
50 unsigned int len, unsigned int offs,
51 u64 lblk_num)
52{
53 return -EOPNOTSUPP;
54}
55
4fd4b15c
EB
56static inline struct page *fscrypt_control_page(struct page *page)
57{
58 WARN_ON_ONCE(1);
59 return ERR_PTR(-EINVAL);
60}
46f47e48
EB
61
62static inline void fscrypt_restore_control_page(struct page *page)
63{
64 return;
65}
66
67static inline void fscrypt_set_d_op(struct dentry *dentry)
68{
69 return;
70}
71
72static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry)
73{
74 return;
75}
76
77/* policy.c */
78static inline int fscrypt_ioctl_set_policy(struct file *filp,
79 const void __user *arg)
80{
81 return -EOPNOTSUPP;
82}
83
84static inline int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg)
85{
86 return -EOPNOTSUPP;
87}
88
89static inline int fscrypt_has_permitted_context(struct inode *parent,
90 struct inode *child)
91{
92 return 0;
93}
94
95static inline int fscrypt_inherit_context(struct inode *parent,
96 struct inode *child,
97 void *fs_data, bool preload)
98{
99 return -EOPNOTSUPP;
100}
101
102/* keyinfo.c */
103static inline int fscrypt_get_encryption_info(struct inode *inode)
104{
105 return -EOPNOTSUPP;
106}
107
3d204e24 108static inline void fscrypt_put_encryption_info(struct inode *inode)
46f47e48
EB
109{
110 return;
111}
112
113 /* fname.c */
114static inline int fscrypt_setup_filename(struct inode *dir,
115 const struct qstr *iname,
116 int lookup, struct fscrypt_name *fname)
117{
e0428a26 118 if (IS_ENCRYPTED(dir))
46f47e48
EB
119 return -EOPNOTSUPP;
120
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;
126}
127
128static inline void fscrypt_free_filename(struct fscrypt_name *fname)
129{
130 return;
131}
132
46f47e48 133static inline int fscrypt_fname_alloc_buffer(const struct inode *inode,
2cbadadc 134 u32 max_encrypted_len,
46f47e48
EB
135 struct fscrypt_str *crypto_str)
136{
137 return -EOPNOTSUPP;
138}
139
140static inline void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
141{
142 return;
143}
144
145static 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)
149{
150 return -EOPNOTSUPP;
151}
152
17159420
EB
153static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
154 const u8 *de_name, u32 de_name_len)
155{
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);
160}
161
46f47e48
EB
162/* bio.c */
163static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
164 struct bio *bio)
165{
166 return;
167}
168
169static inline void fscrypt_pullback_bio_page(struct page **page, bool restore)
170{
171 return;
172}
173
174static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
175 sector_t pblk, unsigned int len)
176{
177 return -EOPNOTSUPP;
178}
179
efcc7ae2
EB
180/* hooks.c */
181
182static inline int fscrypt_file_open(struct inode *inode, struct file *filp)
183{
184 if (IS_ENCRYPTED(inode))
185 return -EOPNOTSUPP;
186 return 0;
187}
188
0ea87a96
EB
189static inline int __fscrypt_prepare_link(struct inode *inode,
190 struct inode *dir)
191{
192 return -EOPNOTSUPP;
193}
194
94b26f36
EB
195static 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)
200{
201 return -EOPNOTSUPP;
202}
203
32c3cf02
EB
204static inline int __fscrypt_prepare_lookup(struct inode *dir,
205 struct dentry *dentry)
206{
207 return -EOPNOTSUPP;
208}
209
76e81d6d
EB
210static inline int __fscrypt_prepare_symlink(struct inode *dir,
211 unsigned int len,
212 unsigned int max_len,
213 struct fscrypt_str *disk_link)
214{
215 return -EOPNOTSUPP;
216}
217
218static inline int __fscrypt_encrypt_symlink(struct inode *inode,
219 const char *target,
220 unsigned int len,
221 struct fscrypt_str *disk_link)
222{
223 return -EOPNOTSUPP;
224}
225
3b0d8837
EB
226static inline const char *fscrypt_get_symlink(struct inode *inode,
227 const void *caddr,
228 unsigned int max_size,
229 struct delayed_call *done)
230{
231 return ERR_PTR(-EOPNOTSUPP);
232}
233
46f47e48 234#endif /* _LINUX_FSCRYPT_NOTSUPP_H */