Messages in this thread |  | | From | Rusty Russell <> | Subject | cpu controls in driverfs? | Date | Fri, 30 Aug 2002 16:53:16 +1000 |
| |
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/
|  |