mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-kernel@vger.kernel.org
Subject: [PATCH][2.6.0-test3] i386 msr.c devfs support 1/2
Date: Sun, 10 Aug 2003 12:51:03 +0400	[thread overview]
Message-ID: <200308101251.03605.arvidjaar@mail.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

Please let me know if default permissions (644) are not appropriate. Tested on 
2-way SMP kernel single CPU system; it correctly rejects access to 
no-existing CPU.

/dev/cpu/N is not removed on module unload. It is impossible to cleanly 
unregister directories shared by independent drivers given current devfs 
implementation (no actual refcounting)

-andrey

[-- Attachment #2: 2.6.0-test3-msr_devfs.patch --]
[-- Type: text/x-diff, Size: 943 bytes --]

--- linux-2.6.0-test3-smp/arch/i386/kernel/msr.c.devfs	2003-06-26 21:39:26.000000000 +0400
+++ linux-2.6.0-test3-smp/arch/i386/kernel/msr.c	2003-08-09 22:29:56.000000000 +0400
@@ -37,6 +37,8 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 
+#include <linux/devfs_fs_kernel.h>
+
 #include <asm/processor.h>
 #include <asm/msr.h>
 #include <asm/uaccess.h>
@@ -263,17 +265,28 @@ static struct file_operations msr_fops =
 
 int __init msr_init(void)
 {
+  int i;
+
   if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
     printk(KERN_ERR "msr: unable to get major %d for msr\n",
 	   MSR_MAJOR);
     return -EBUSY;
   }
+
+  for (i = 0; i < NR_CPUS; i++)
+    devfs_mk_cdev(MKDEV(MSR_MAJOR, i), S_IFCHR | S_IRUGO | S_IWUSR,
+		  "cpu/%d/msr", i);
   
   return 0;
 }
 
 void __exit msr_exit(void)
 {
+  int i;
+
+  for (i = 0; i < NR_CPUS; i++)
+    devfs_remove("cpu/%d/msr", i);
+  
   unregister_chrdev(MSR_MAJOR, "cpu/msr");
 }
 

             reply	other threads:[~2003-08-10  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-10  8:51 Andrey Borzenkov [this message]
2003-08-10 13:58 ` Dave Jones
2003-08-10 14:16   ` Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200308101251.03605.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®