fscrypt_supp.h 2.3 KB

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