[PATCH] apparmor: Change to use DEFINE_SHOW_ATTRIBUTE macro

From: Yangtao Li
Date: Tue Nov 06 2018 - 09:32:37 EST


Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
---
security/apparmor/apparmorfs.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index e09fe4d7307c..0e80ea4a3f6b 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -977,7 +977,7 @@ static const struct file_operations aa_sfs_access = {
.llseek = generic_file_llseek,
};

-static int aa_sfs_seq_show(struct seq_file *seq, void *v)
+static int aa_sfs_seq_file_show(struct seq_file *seq, void *v)
{
struct aa_sfs_entry *fs_file = seq->private;

@@ -1002,18 +1002,7 @@ static int aa_sfs_seq_show(struct seq_file *seq, void *v)
return 0;
}

-static int aa_sfs_seq_open(struct inode *inode, struct file *file)
-{
- return single_open(file, aa_sfs_seq_show, inode->i_private);
-}
-
-const struct file_operations aa_sfs_seq_file_ops = {
- .owner = THIS_MODULE,
- .open = aa_sfs_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(aa_sfs_seq_file);

/*
* profile based file operations
--
2.17.0