evm: add evm_inode_init_security to initialize new files
[pandora-kernel.git] / include / linux / evm.h
1 /*
2  * evm.h
3  *
4  * Copyright (c) 2009 IBM Corporation
5  * Author: Mimi Zohar <zohar@us.ibm.com>
6  */
7
8 #ifndef _LINUX_EVM_H
9 #define _LINUX_EVM_H
10
11 #include <linux/integrity.h>
12 #include <linux/xattr.h>
13
14 #ifdef CONFIG_EVM
15 extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
16                                              const char *xattr_name,
17                                              void *xattr_value,
18                                              size_t xattr_value_len);
19 extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
20 extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
21                               const void *value, size_t size);
22 extern void evm_inode_post_setxattr(struct dentry *dentry,
23                                     const char *xattr_name,
24                                     const void *xattr_value,
25                                     size_t xattr_value_len);
26 extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
27 extern void evm_inode_post_removexattr(struct dentry *dentry,
28                                        const char *xattr_name);
29 extern int evm_inode_init_security(struct inode *inode,
30                                    const struct xattr *xattr_array,
31                                    struct xattr *evm);
32 #else
33 #ifdef CONFIG_INTEGRITY
34 static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
35                                                     const char *xattr_name,
36                                                     void *xattr_value,
37                                                     size_t xattr_value_len)
38 {
39         return INTEGRITY_UNKNOWN;
40 }
41 #endif
42
43 static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
44 {
45         return;
46 }
47
48 static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
49                                      const void *value, size_t size)
50 {
51         return 0;
52 }
53
54 static inline void evm_inode_post_setxattr(struct dentry *dentry,
55                                            const char *xattr_name,
56                                            const void *xattr_value,
57                                            size_t xattr_value_len)
58 {
59         return;
60 }
61
62 static inline int evm_inode_removexattr(struct dentry *dentry,
63                                         const char *xattr_name)
64 {
65         return 0;
66 }
67
68 static inline void evm_inode_post_removexattr(struct dentry *dentry,
69                                               const char *xattr_name)
70 {
71         return;
72 }
73
74 static inline int evm_inode_init_security(struct inode *inode,
75                                           const struct xattr *xattr_array,
76                                           struct xattr *evm)
77 {
78         return -EOPNOTSUPP;
79 }
80
81 #endif /* CONFIG_EVM_H */
82 #endif /* LINUX_EVM_H */