ima.h 1.8 KB
Newer Older
M
Mimi Zohar 已提交
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * Copyright (C) 2008 IBM Corporation
 * Author: Mimi Zohar <zohar@us.ibm.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 2 of the License.
 */

#ifndef _LINUX_IMA_H
#define _LINUX_IMA_H

M
Mimi Zohar 已提交
13 14 15
#include <linux/fs.h>
struct linux_binprm;

16 17
#ifdef CONFIG_IMA
extern int ima_bprm_check(struct linux_binprm *bprm);
18
extern int ima_file_check(struct file *file, int mask);
19 20
extern void ima_file_free(struct file *file);
extern int ima_file_mmap(struct file *file, unsigned long prot);
21
extern int ima_module_check(struct file *file);
22 23

#else
M
Mimi Zohar 已提交
24 25 26 27 28
static inline int ima_bprm_check(struct linux_binprm *bprm)
{
	return 0;
}

29
static inline int ima_file_check(struct file *file, int mask)
M
Mimi Zohar 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42
{
	return 0;
}

static inline void ima_file_free(struct file *file)
{
	return;
}

static inline int ima_file_mmap(struct file *file, unsigned long prot)
{
	return 0;
}
M
Mimi Zohar 已提交
43

44 45 46 47 48
static inline int ima_module_check(struct file *file)
{
	return 0;
}

49
#endif /* CONFIG_IMA_H */
M
Mimi Zohar 已提交
50 51 52

#ifdef CONFIG_IMA_APPRAISE
extern void ima_inode_post_setattr(struct dentry *dentry);
53 54 55
extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
		       const void *xattr_value, size_t xattr_value_len);
extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
M
Mimi Zohar 已提交
56 57 58 59 60
#else
static inline void ima_inode_post_setattr(struct dentry *dentry)
{
	return;
}
61 62 63 64 65 66 67 68 69 70 71 72 73 74

static inline int ima_inode_setxattr(struct dentry *dentry,
				     const char *xattr_name,
				     const void *xattr_value,
				     size_t xattr_value_len)
{
	return 0;
}

static inline int ima_inode_removexattr(struct dentry *dentry,
					const char *xattr_name)
{
	return 0;
}
M
Mimi Zohar 已提交
75
#endif /* CONFIG_IMA_APPRAISE_H */
M
Mimi Zohar 已提交
76
#endif /* _LINUX_IMA_H */