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