]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/fscrypt_supp.h
fscrypt: avoid collisions when presenting long encrypted filenames
[mirror_ubuntu-bionic-kernel.git] / include / linux / fscrypt_supp.h
CommitLineData
46f47e48
EB
1/*
2 * fscrypt_supp.h
3 *
4 * This is included by filesystems configured with encryption support.
5 */
6
7#ifndef _LINUX_FSCRYPT_SUPP_H
8#define _LINUX_FSCRYPT_SUPP_H
9
10#include <linux/fscrypt_common.h>
11
12/* crypto.c */
13extern struct kmem_cache *fscrypt_info_cachep;
14extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t);
15extern void fscrypt_release_ctx(struct fscrypt_ctx *);
16extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *,
17 unsigned int, unsigned int,
18 u64, gfp_t);
19extern int fscrypt_decrypt_page(const struct inode *, struct page *, unsigned int,
20 unsigned int, u64);
21extern void fscrypt_restore_control_page(struct page *);
22
23extern const struct dentry_operations fscrypt_d_ops;
24
25static inline void fscrypt_set_d_op(struct dentry *dentry)
26{
27 d_set_d_op(dentry, &fscrypt_d_ops);
28}
29
30static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry)
31{
32 spin_lock(&dentry->d_lock);
33 dentry->d_flags |= DCACHE_ENCRYPTED_WITH_KEY;
34 spin_unlock(&dentry->d_lock);
35}
36
37/* policy.c */
38extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);
39extern int fscrypt_ioctl_get_policy(struct file *, void __user *);
40extern int fscrypt_has_permitted_context(struct inode *, struct inode *);
41extern int fscrypt_inherit_context(struct inode *, struct inode *,
42 void *, bool);
43/* keyinfo.c */
44extern int fscrypt_get_encryption_info(struct inode *);
45extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *);
46
47/* fname.c */
48extern int fscrypt_setup_filename(struct inode *, const struct qstr *,
49 int lookup, struct fscrypt_name *);
50extern void fscrypt_free_filename(struct fscrypt_name *);
51extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32);
52extern int fscrypt_fname_alloc_buffer(const struct inode *, u32,
53 struct fscrypt_str *);
54extern void fscrypt_fname_free_buffer(struct fscrypt_str *);
55extern int fscrypt_fname_disk_to_usr(struct inode *, u32, u32,
56 const struct fscrypt_str *, struct fscrypt_str *);
57extern int fscrypt_fname_usr_to_disk(struct inode *, const struct qstr *,
58 struct fscrypt_str *);
59
60/* bio.c */
61extern void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *, struct bio *);
62extern void fscrypt_pullback_bio_page(struct page **, bool);
63extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t,
64 unsigned int);
65
66#endif /* _LINUX_FSCRYPT_SUPP_H */