]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - include/linux/fscrypt_notsupp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
5 * This stubs out the fscrypt functions for filesystems configured without
8 * Do not include this file directly. Use fscrypt.h instead!
10 #ifndef _LINUX_FSCRYPT_H
11 #error "Incorrect include of linux/fscrypt_notsupp.h!"
14 #ifndef _LINUX_FSCRYPT_NOTSUPP_H
15 #define _LINUX_FSCRYPT_NOTSUPP_H
17 static inline bool fscrypt_has_encryption_key(const struct inode
*inode
)
22 static inline bool fscrypt_dummy_context_enabled(struct inode
*inode
)
28 static inline void fscrypt_enqueue_decrypt_work(struct work_struct
*work
)
32 static inline struct fscrypt_ctx
*fscrypt_get_ctx(const struct inode
*inode
,
35 return ERR_PTR(-EOPNOTSUPP
);
38 static inline void fscrypt_release_ctx(struct fscrypt_ctx
*ctx
)
43 static inline struct page
*fscrypt_encrypt_page(const struct inode
*inode
,
47 u64 lblk_num
, gfp_t gfp_flags
)
49 return ERR_PTR(-EOPNOTSUPP
);
52 static inline int fscrypt_decrypt_page(const struct inode
*inode
,
54 unsigned int len
, unsigned int offs
,
60 static inline struct page
*fscrypt_control_page(struct page
*page
)
63 return ERR_PTR(-EINVAL
);
66 static inline void fscrypt_restore_control_page(struct page
*page
)
72 static inline int fscrypt_ioctl_set_policy(struct file
*filp
,
73 const void __user
*arg
)
78 static inline int fscrypt_ioctl_get_policy(struct file
*filp
, void __user
*arg
)
83 static inline int fscrypt_has_permitted_context(struct inode
*parent
,
89 static inline int fscrypt_inherit_context(struct inode
*parent
,
91 void *fs_data
, bool preload
)
97 static inline int fscrypt_get_encryption_info(struct inode
*inode
)
102 static inline void fscrypt_put_encryption_info(struct inode
*inode
)
108 static inline int fscrypt_setup_filename(struct inode
*dir
,
109 const struct qstr
*iname
,
110 int lookup
, struct fscrypt_name
*fname
)
112 if (IS_ENCRYPTED(dir
))
115 memset(fname
, 0, sizeof(struct fscrypt_name
));
116 fname
->usr_fname
= iname
;
117 fname
->disk_name
.name
= (unsigned char *)iname
->name
;
118 fname
->disk_name
.len
= iname
->len
;
122 static inline void fscrypt_free_filename(struct fscrypt_name
*fname
)
127 static inline int fscrypt_fname_alloc_buffer(const struct inode
*inode
,
128 u32 max_encrypted_len
,
129 struct fscrypt_str
*crypto_str
)
134 static inline void fscrypt_fname_free_buffer(struct fscrypt_str
*crypto_str
)
139 static inline int fscrypt_fname_disk_to_usr(struct inode
*inode
,
140 u32 hash
, u32 minor_hash
,
141 const struct fscrypt_str
*iname
,
142 struct fscrypt_str
*oname
)
147 static inline bool fscrypt_match_name(const struct fscrypt_name
*fname
,
148 const u8
*de_name
, u32 de_name_len
)
150 /* Encryption support disabled; use standard comparison */
151 if (de_name_len
!= fname
->disk_name
.len
)
153 return !memcmp(de_name
, fname
->disk_name
.name
, fname
->disk_name
.len
);
157 static inline void fscrypt_decrypt_bio(struct bio
*bio
)
161 static inline void fscrypt_enqueue_decrypt_bio(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
)
179 static inline int fscrypt_file_open(struct inode
*inode
, struct file
*filp
)
181 if (IS_ENCRYPTED(inode
))
186 static inline int __fscrypt_prepare_link(struct inode
*inode
,
192 static inline int __fscrypt_prepare_rename(struct inode
*old_dir
,
193 struct dentry
*old_dentry
,
194 struct inode
*new_dir
,
195 struct dentry
*new_dentry
,
201 static inline int __fscrypt_prepare_lookup(struct inode
*dir
,
202 struct dentry
*dentry
)
207 static inline int __fscrypt_prepare_symlink(struct inode
*dir
,
209 unsigned int max_len
,
210 struct fscrypt_str
*disk_link
)
215 static inline int __fscrypt_encrypt_symlink(struct inode
*inode
,
218 struct fscrypt_str
*disk_link
)
223 static inline const char *fscrypt_get_symlink(struct inode
*inode
,
225 unsigned int max_size
,
226 struct delayed_call
*done
)
228 return ERR_PTR(-EOPNOTSUPP
);
231 #endif /* _LINUX_FSCRYPT_NOTSUPP_H */