lkml.org 
[lkml]   [2003]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH][2.6.0-test3] i386 cpuid.c devfs support 2/2
Date
the same question about default permissions as for msr.c; the same problem 
with module unload.

-andrey--- linux-2.6.0-test3-smp/arch/i386/kernel/cpuid.c.devfs 2003-05-05 03:52:48.000000000 +0400
+++ linux-2.6.0-test3-smp/arch/i386/kernel/cpuid.c 2003-08-09 22:30:39.000000000 +0400
@@ -39,6 +39,8 @@
#include <linux/smp_lock.h>
#include <linux/fs.h>

+#include <linux/devfs_fs_kernel.h>
+
#include <asm/processor.h>
#include <asm/msr.h>
#include <asm/uaccess.h>
@@ -156,17 +158,27 @@ static struct file_operations cpuid_fops

int __init cpuid_init(void)
{
+ int i;
+
if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) {
printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
CPUID_MAJOR);
return -EBUSY;
}

+ for (i = 0; i < NR_CPUS; i++)
+ devfs_mk_cdev(MKDEV(CPUID_MAJOR, i), S_IFCHR | S_IRUGO, "cpu/%d/cpuid", i);
+
return 0;
}

void __exit cpuid_exit(void)
{
+ int i;
+
+ for (i = 0; i < NR_CPUS; i++)
+ devfs_remove("cpu/%d/cpuid", i);
+
unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
}
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.078 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site