OSDN Git Service

mm/vmalloc.c: fix align value calculation error
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / linux / pft.h
1 /* Copyright (c) 2016, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #ifndef PFT_H_
14 #define PFT_H_
15
16 #include <linux/types.h>
17 #include <linux/fs.h>
18 #include <linux/bio.h>
19
20 #ifdef CONFIG_PFT
21
22 /* dm-req-crypt API */
23 int pft_get_key_index(struct bio *bio, u32 *key_index,
24                       bool *is_encrypted, bool *is_inplace);
25
26 /* block layer API */
27 bool pft_allow_merge_bio(struct bio *bio1, struct bio *bio2);
28
29 /* --- security hooks , called from selinux --- */
30 int pft_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
31
32 int pft_inode_post_create(struct inode *dir, struct dentry *dentry,
33                           umode_t mode);
34
35 int pft_file_open(struct file *filp, const struct cred *cred);
36
37 int pft_file_permission(struct file *file, int mask);
38
39 int pft_file_close(struct file *filp);
40
41 int pft_inode_unlink(struct inode *dir, struct dentry *dentry);
42
43 int pft_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
44                     dev_t dev);
45
46 int pft_inode_rename(struct inode *inode, struct dentry *dentry,
47                      struct inode *new_inode, struct dentry *new_dentry);
48
49 int pft_inode_set_xattr(struct dentry *dentry, const char *name,
50                         const void *value, size_t size, int flags);
51
52
53 #else
54 static inline int pft_get_key_index(struct bio *bio, u32 *key_index,
55                                     bool *is_encrypted, bool *is_inplace)
56 { return -ENODEV; }
57
58 static inline bool pft_allow_merge_bio(const struct bio *bio1,
59         const struct bio *bio2)
60 { return true; }
61
62 static inline int pft_file_permission(struct file *file, int mask)
63 { return 0; }
64
65 static inline int pft_inode_create(
66         struct inode *dir, struct dentry *dentry, umode_t mode)
67 { return 0; }
68
69 static inline int pft_inode_post_create(
70         struct inode *dir, struct dentry *dentry, umode_t mode)
71 { return 0; }
72
73 static inline int pft_file_open(struct file *filp, const struct cred *cred)
74 { return 0; }
75
76 static inline int pft_file_close(struct file *filp)
77 { return 0; }
78
79 static inline int pft_inode_unlink(struct inode *dir, struct dentry *dentry)
80 { return 0; }
81
82 static inline int pft_inode_mknod(struct inode *dir, struct dentry *dentry,
83                                   umode_t mode, dev_t dev)
84 { return 0; }
85
86 static inline int pft_inode_rename(struct inode *inode, struct dentry *dentry,
87                      struct inode *new_inode, struct dentry *new_dentry)
88 { return 0; }
89
90 static inline int pft_inode_set_xattr(struct dentry *dentry, const char *name,
91                                       const void *value, size_t size,
92                                       int flags)
93 { return 0; }
94
95 #endif /* CONFIG_PFT */
96
97 #endif /* PFT_H */