]> err.no Git - linux-2.6/commitdiff
samples: use non-racy method for /proc/marker-example creation
authorDenis V. Lunev <den@openvz.org>
Tue, 29 Apr 2008 08:02:16 +0000 (01:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Apr 2008 15:06:21 +0000 (08:06 -0700)
Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.

Signed-off-by: Denis 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
samples/markers/marker-example.c

index 05e438f8b4e2d8511e69a4961cf8e35b0dbbeebd..e90dc5d04392dcc0f10d6d480dd6a866cc54df0e 100644 (file)
@@ -33,10 +33,8 @@ static struct file_operations mark_ops = {
 static int example_init(void)
 {
        printk(KERN_ALERT "example init\n");
-       pentry_example = create_proc_entry("marker-example", 0444, NULL);
-       if (pentry_example)
-               pentry_example->proc_fops = &mark_ops;
-       else
+       pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
+       if (!pentry_example)
                return -EPERM;
        return 0;
 }