]>
Commit | Line | Data |
---|---|---|
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. | |
7 | */ | |
8 | ||
9 | #ifndef _LINUX_FSCRYPT_NOTSUPP_H | |
10 | #define _LINUX_FSCRYPT_NOTSUPP_H | |
11 | ||
12 | #include <linux/fscrypt_common.h> | |
13 | ||
14 | /* crypto.c */ | |
15 | static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode, | |
16 | gfp_t gfp_flags) | |
17 | { | |
18 | return ERR_PTR(-EOPNOTSUPP); | |
19 | } | |
20 | ||
21 | static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx) | |
22 | { | |
23 | return; | |
24 | } | |
25 | ||
26 | static inline struct page *fscrypt_encrypt_page(const struct inode *inode, | |
27 | struct page *page, | |
28 | unsigned int len, | |
29 | unsigned int offs, | |
30 | u64 lblk_num, gfp_t gfp_flags) | |
31 | { | |
32 | return ERR_PTR(-EOPNOTSUPP); | |
33 | } | |
34 | ||
35 | static inline int fscrypt_decrypt_page(const struct inode *inode, | |
36 | struct page *page, | |
37 | unsigned int len, unsigned int offs, | |
38 | u64 lblk_num) | |
39 | { | |
40 | return -EOPNOTSUPP; | |
41 | } | |
42 | ||
43 | ||
44 | static inline void fscrypt_restore_control_page(struct page *page) | |
45 | { | |
46 | return; | |
47 | } | |
48 | ||
49 | static inline void fscrypt_set_d_op(struct dentry *dentry) | |
50 | { | |
51 | return; | |
52 | } | |
53 | ||
54 | static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry) | |
55 | { | |
56 | return; | |
57 | } | |
58 | ||
59 | /* policy.c */ | |
60 | static inline int fscrypt_ioctl_set_policy(struct file *filp, | |
61 | const void __user *arg) | |
62 | { | |
63 | return -EOPNOTSUPP; | |
64 | } | |
65 | ||
66 | static inline int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg) | |
67 | { | |
68 | return -EOPNOTSUPP; | |
69 | } | |
70 | ||
71 | static inline int fscrypt_has_permitted_context(struct inode *parent, | |
72 | struct inode *child) | |
73 | { | |
74 | return 0; | |
75 | } | |
76 | ||
77 | static inline int fscrypt_inherit_context(struct inode *parent, | |
78 | struct inode *child, | |
79 | void *fs_data, bool preload) | |
80 | { | |
81 | return -EOPNOTSUPP; | |
82 | } | |
83 | ||
84 | /* keyinfo.c */ | |
85 | static inline int fscrypt_get_encryption_info(struct inode *inode) | |
86 | { | |
87 | return -EOPNOTSUPP; | |
88 | } | |
89 | ||
90 | static inline void fscrypt_put_encryption_info(struct inode *inode, | |
91 | struct fscrypt_info *ci) | |
92 | { | |
93 | return; | |
94 | } | |
95 | ||
96 | /* fname.c */ | |
97 | static inline int fscrypt_setup_filename(struct inode *dir, | |
98 | const struct qstr *iname, | |
99 | int lookup, struct fscrypt_name *fname) | |
100 | { | |
101 | if (dir->i_sb->s_cop->is_encrypted(dir)) | |
102 | return -EOPNOTSUPP; | |
103 | ||
104 | memset(fname, 0, sizeof(struct fscrypt_name)); | |
105 | fname->usr_fname = iname; | |
106 | fname->disk_name.name = (unsigned char *)iname->name; | |
107 | fname->disk_name.len = iname->len; | |
108 | return 0; | |
109 | } | |
110 | ||
111 | static inline void fscrypt_free_filename(struct fscrypt_name *fname) | |
112 | { | |
113 | return; | |
114 | } | |
115 | ||
116 | static inline u32 fscrypt_fname_encrypted_size(const struct inode *inode, | |
117 | u32 ilen) | |
118 | { | |
119 | /* never happens */ | |
120 | WARN_ON(1); | |
121 | return 0; | |
122 | } | |
123 | ||
124 | static inline int fscrypt_fname_alloc_buffer(const struct inode *inode, | |
125 | u32 ilen, | |
126 | struct fscrypt_str *crypto_str) | |
127 | { | |
128 | return -EOPNOTSUPP; | |
129 | } | |
130 | ||
131 | static inline void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str) | |
132 | { | |
133 | return; | |
134 | } | |
135 | ||
136 | static inline int fscrypt_fname_disk_to_usr(struct inode *inode, | |
137 | u32 hash, u32 minor_hash, | |
138 | const struct fscrypt_str *iname, | |
139 | struct fscrypt_str *oname) | |
140 | { | |
141 | return -EOPNOTSUPP; | |
142 | } | |
143 | ||
144 | static inline int fscrypt_fname_usr_to_disk(struct inode *inode, | |
145 | const struct qstr *iname, | |
146 | struct fscrypt_str *oname) | |
147 | { | |
148 | return -EOPNOTSUPP; | |
149 | } | |
150 | ||
17159420 EB |
151 | static inline bool fscrypt_match_name(const struct fscrypt_name *fname, |
152 | const u8 *de_name, u32 de_name_len) | |
153 | { | |
154 | /* Encryption support disabled; use standard comparison */ | |
155 | if (de_name_len != fname->disk_name.len) | |
156 | return false; | |
157 | return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len); | |
158 | } | |
159 | ||
46f47e48 EB |
160 | /* bio.c */ |
161 | static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx, | |
162 | struct bio *bio) | |
163 | { | |
164 | return; | |
165 | } | |
166 | ||
167 | static inline void fscrypt_pullback_bio_page(struct page **page, bool restore) | |
168 | { | |
169 | return; | |
170 | } | |
171 | ||
172 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, | |
173 | sector_t pblk, unsigned int len) | |
174 | { | |
175 | return -EOPNOTSUPP; | |
176 | } | |
177 | ||
178 | #endif /* _LINUX_FSCRYPT_NOTSUPP_H */ |