mirror of
https://github.com/commaai/agnos-kernel-sdm845.git
synced 2026-06-13 05:45:24 +08:00
Cherry-picked from origin/upstream-f2fs-stable-linux-4.9.y: 743205fbb952 fscrypt: move to generic async completion f1eb0c0b51a5 crypto: introduce crypto wait for async op e0af083add9b fscrypt: lock mutex before checking for bounce page pool 9e48a9fd98ba fscrypt: new helper function - fscrypt_prepare_setattr() ec822ff8b5e5 fscrypt: new helper function - fscrypt_prepare_lookup() 98fe83a195e7 fscrypt: new helper function - fscrypt_prepare_rename() f52187025917 fscrypt: new helper function - fscrypt_prepare_link() d61dffbd4f3e fscrypt: new helper function - fscrypt_file_open() 5190ed0766fe fscrypt: new helper function - fscrypt_require_key() 8814204af9c1 fscrypt: remove unneeded empty fscrypt_operations structs 8745aa36e439 fscrypt: remove ->is_encrypted() d750ec720f4d fscrypt: switch from ->is_encrypted() to IS_ENCRYPTED() 685285b0b3d9 fs, fscrypt: add an S_ENCRYPTED inode flag 1617929c3bea fscrypt: clean up include file mess a0471ef4ed35 fscrypt: fix dereference of NULL user_key_payload e77e7df06084 fscrypt: make ->dummy_context() return bool Change-Id: I23f36bfd059c0c576608221e7e1135535646cc5d Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
211 lines
4.4 KiB
C
211 lines
4.4 KiB
C
/*
|
|
* fscrypt_notsupp.h
|
|
*
|
|
* This stubs out the fscrypt functions for filesystems configured without
|
|
* encryption support.
|
|
*
|
|
* Do not include this file directly. Use fscrypt.h instead!
|
|
*/
|
|
#ifndef _LINUX_FSCRYPT_H
|
|
#error "Incorrect include of linux/fscrypt_notsupp.h!"
|
|
#endif
|
|
|
|
#ifndef _LINUX_FSCRYPT_NOTSUPP_H
|
|
#define _LINUX_FSCRYPT_NOTSUPP_H
|
|
|
|
/* crypto.c */
|
|
static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,
|
|
gfp_t gfp_flags)
|
|
{
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
}
|
|
|
|
static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline struct page *fscrypt_encrypt_page(const struct inode *inode,
|
|
struct page *page,
|
|
unsigned int len,
|
|
unsigned int offs,
|
|
u64 lblk_num, gfp_t gfp_flags)
|
|
{
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
}
|
|
|
|
static inline int fscrypt_decrypt_page(const struct inode *inode,
|
|
struct page *page,
|
|
unsigned int len, unsigned int offs,
|
|
u64 lblk_num)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
|
|
static inline void fscrypt_restore_control_page(struct page *page)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline void fscrypt_set_d_op(struct dentry *dentry)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline void fscrypt_set_encrypted_dentry(struct dentry *dentry)
|
|
{
|
|
return;
|
|
}
|
|
|
|
/* policy.c */
|
|
static inline int fscrypt_ioctl_set_policy(struct file *filp,
|
|
const void __user *arg)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int fscrypt_has_permitted_context(struct inode *parent,
|
|
struct inode *child)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int fscrypt_inherit_context(struct inode *parent,
|
|
struct inode *child,
|
|
void *fs_data, bool preload)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
/* keyinfo.c */
|
|
static inline int fscrypt_get_encryption_info(struct inode *inode)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline void fscrypt_put_encryption_info(struct inode *inode,
|
|
struct fscrypt_info *ci)
|
|
{
|
|
return;
|
|
}
|
|
|
|
/* fname.c */
|
|
static inline int fscrypt_setup_filename(struct inode *dir,
|
|
const struct qstr *iname,
|
|
int lookup, struct fscrypt_name *fname)
|
|
{
|
|
if (IS_ENCRYPTED(dir))
|
|
return -EOPNOTSUPP;
|
|
|
|
memset(fname, 0, sizeof(struct fscrypt_name));
|
|
fname->usr_fname = iname;
|
|
fname->disk_name.name = (unsigned char *)iname->name;
|
|
fname->disk_name.len = iname->len;
|
|
return 0;
|
|
}
|
|
|
|
static inline void fscrypt_free_filename(struct fscrypt_name *fname)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline u32 fscrypt_fname_encrypted_size(const struct inode *inode,
|
|
u32 ilen)
|
|
{
|
|
/* never happens */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
|
|
static inline int fscrypt_fname_alloc_buffer(const struct inode *inode,
|
|
u32 ilen,
|
|
struct fscrypt_str *crypto_str)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline int fscrypt_fname_disk_to_usr(struct inode *inode,
|
|
u32 hash, u32 minor_hash,
|
|
const struct fscrypt_str *iname,
|
|
struct fscrypt_str *oname)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int fscrypt_fname_usr_to_disk(struct inode *inode,
|
|
const struct qstr *iname,
|
|
struct fscrypt_str *oname)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
|
|
const u8 *de_name, u32 de_name_len)
|
|
{
|
|
/* Encryption support disabled; use standard comparison */
|
|
if (de_name_len != fname->disk_name.len)
|
|
return false;
|
|
return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
|
|
}
|
|
|
|
/* bio.c */
|
|
static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
|
|
struct bio *bio)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline void fscrypt_pullback_bio_page(struct page **page, bool restore)
|
|
{
|
|
return;
|
|
}
|
|
|
|
static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
|
|
sector_t pblk, unsigned int len)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
/* hooks.c */
|
|
|
|
static inline int fscrypt_file_open(struct inode *inode, struct file *filp)
|
|
{
|
|
if (IS_ENCRYPTED(inode))
|
|
return -EOPNOTSUPP;
|
|
return 0;
|
|
}
|
|
|
|
static inline int __fscrypt_prepare_link(struct inode *inode,
|
|
struct inode *dir)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int __fscrypt_prepare_rename(struct inode *old_dir,
|
|
struct dentry *old_dentry,
|
|
struct inode *new_dir,
|
|
struct dentry *new_dentry,
|
|
unsigned int flags)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int __fscrypt_prepare_lookup(struct inode *dir,
|
|
struct dentry *dentry)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
#endif /* _LINUX_FSCRYPT_NOTSUPP_H */
|