mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: rmk@arm.linux.org.uk, Patrick Mochel <mochel@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: cpu controls in driverfs?
Date: Fri, 30 Aug 2002 16:53:16 +1000	[thread overview]
Message-ID: <20020830015512.A44D22C092@lists.samba.org> (raw)

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.

                 reply	other threads:[~2002-08-30  6:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20020830015512.A44D22C092@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=rmk@arm.linux.org.uk \
    /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®