lkml.org 
[lkml]   [2002]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectcpu controls in driverfs?
Date
Hi guys,

I current put the cpu online controls in /proc, they really
should be in driverfs somewhere. There doesn't seem to be any cpus in
driverfs at the moment: Pat, where should they go?

My current code looks like:

+static void __init create_entries(struct proc_dir_entry *parent,
+ unsigned int cpu)
+{
+ struct proc_dir_entry *e;
+
+ e = create_proc_entry("online", 0644, parent);
+ e->data = (void *)cpu;
+ e->read_proc = &read_online;
+ e->write_proc = &write_online;
+}
+
+static int __init create_per_cpu_entries(void)
+{
+ unsigned int i;
+ struct proc_dir_entry *cpudir, *dir;
+
+ cpudir = proc_mkdir("sys/cpu", NULL);
+ for (i = 0; i < NR_CPUS; i++) {
+ char cpuname[20];
+
+ if (cpu_possible(i)) {
+ sprintf(cpuname, "%i", i);
+ dir = proc_mkdir(cpuname, cpudir);
+
+ create_entries(dir, i);
+ }
+ }
+ return 0;
+}
+
+__initcall(create_per_cpu_entries);

Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:22    [W:0.018 / U:9.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site