Commit 16e70f64 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by Linus Torvalds

samples: use non-racy method for /proc/marker-example creation

Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 659f865e
...@@ -33,10 +33,8 @@ static struct file_operations mark_ops = { ...@@ -33,10 +33,8 @@ static struct file_operations mark_ops = {
static int example_init(void) static int example_init(void)
{ {
printk(KERN_ALERT "example init\n"); printk(KERN_ALERT "example init\n");
pentry_example = create_proc_entry("marker-example", 0444, NULL); pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
if (pentry_example) if (!pentry_example)
pentry_example->proc_fops = &mark_ops;
else
return -EPERM; return -EPERM;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment