mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* cpu controls in driverfs?
@ 2002-08-30  6:53 Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2002-08-30  6:53 UTC (permalink / raw)
  To: rmk, Patrick Mochel; +Cc: linux-kernel

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-30  6:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-30  6:53 cpu controls in driverfs? Rusty Russell

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®