Skip to content

Commit eac2cec

Browse files
Kefeng Wangtorvalds
authored andcommitted
kernel/kprobes.c: convert to use DEFINE_SEQ_ATTRIBUTE macro
Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Link: http://lkml.kernel.org/r/20200509064031.181091-4-wangkefeng.wang@huawei.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 01a9956 commit eac2cec

1 file changed

Lines changed: 6 additions & 28 deletions

File tree

‎kernel/kprobes.c‎

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,24 +2475,14 @@ static int show_kprobe_addr(struct seq_file *pi, void *v)
24752475
return 0;
24762476
}
24772477

2478-
static const struct seq_operations kprobes_seq_ops = {
2478+
static const struct seq_operations kprobes_sops = {
24792479
.start = kprobe_seq_start,
24802480
.next = kprobe_seq_next,
24812481
.stop = kprobe_seq_stop,
24822482
.show = show_kprobe_addr
24832483
};
24842484

2485-
static int kprobes_open(struct inode *inode, struct file *filp)
2486-
{
2487-
return seq_open(filp, &kprobes_seq_ops);
2488-
}
2489-
2490-
static const struct file_operations debugfs_kprobes_operations = {
2491-
.open = kprobes_open,
2492-
.read = seq_read,
2493-
.llseek = seq_lseek,
2494-
.release = seq_release,
2495-
};
2485+
DEFINE_SEQ_ATTRIBUTE(kprobes);
24962486

24972487
/* kprobes/blacklist -- shows which functions can not be probed */
24982488
static void *kprobe_blacklist_seq_start(struct seq_file *m, loff_t *pos)
@@ -2529,24 +2519,13 @@ static void kprobe_blacklist_seq_stop(struct seq_file *f, void *v)
25292519
mutex_unlock(&kprobe_mutex);
25302520
}
25312521

2532-
static const struct seq_operations kprobe_blacklist_seq_ops = {
2522+
static const struct seq_operations kprobe_blacklist_sops = {
25332523
.start = kprobe_blacklist_seq_start,
25342524
.next = kprobe_blacklist_seq_next,
25352525
.stop = kprobe_blacklist_seq_stop,
25362526
.show = kprobe_blacklist_seq_show,
25372527
};
2538-
2539-
static int kprobe_blacklist_open(struct inode *inode, struct file *filp)
2540-
{
2541-
return seq_open(filp, &kprobe_blacklist_seq_ops);
2542-
}
2543-
2544-
static const struct file_operations debugfs_kprobe_blacklist_ops = {
2545-
.open = kprobe_blacklist_open,
2546-
.read = seq_read,
2547-
.llseek = seq_lseek,
2548-
.release = seq_release,
2549-
};
2528+
DEFINE_SEQ_ATTRIBUTE(kprobe_blacklist);
25502529

25512530
static int arm_all_kprobes(void)
25522531
{
@@ -2705,13 +2684,12 @@ static int __init debugfs_kprobe_init(void)
27052684

27062685
dir = debugfs_create_dir("kprobes", NULL);
27072686

2708-
debugfs_create_file("list", 0400, dir, NULL,
2709-
&debugfs_kprobes_operations);
2687+
debugfs_create_file("list", 0400, dir, NULL, &kprobes_fops);
27102688

27112689
debugfs_create_file("enabled", 0600, dir, &value, &fops_kp);
27122690

27132691
debugfs_create_file("blacklist", 0400, dir, NULL,
2714-
&debugfs_kprobe_blacklist_ops);
2692+
&kprobe_blacklist_fops);
27152693

27162694
return 0;
27172695
}

0 commit comments

Comments
 (0)