ima.h 1.9 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
extern int ima_fw_from_file(struct file *file, char *buf, size_t size);
23 24

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

30
static inline int ima_file_check(struct file *file, int mask)
M
Mimi Zohar 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43
{
	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 已提交
44

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

50 51 52 53 54
static inline int ima_fw_from_file(struct file *file, char *buf, size_t size)
{
	return 0;
}

55
#endif /* CONFIG_IMA */
M
Mimi Zohar 已提交
56 57 58

#ifdef CONFIG_IMA_APPRAISE
extern void ima_inode_post_setattr(struct dentry *dentry);
59 60 61
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 已提交
62 63 64 65 66
#else
static inline void ima_inode_post_setattr(struct dentry *dentry)
{
	return;
}
67 68 69 70 71 72 73 74 75 76 77 78 79 80

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;
}
81
#endif /* CONFIG_IMA_APPRAISE */
M
Mimi Zohar 已提交
82
#endif /* _LINUX_IMA_H */