public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomas Carnecky <tom@dbservice.com>
To: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Is it possible to access sysfs from within the kernel?
Date: Sat, 18 Dec 2004 20:55:43 +0100	[thread overview]
Message-ID: <41C48B3F.8010709@dbservice.com> (raw)

Why? Lets see.
Sysfs describes the system with all its devices etc but is also an 
interface to access kernel internal data.
Sysfs data could easily be put into a hierarchical tree. (I think it 
even is, but it's not so obvious, because it's done using the fs code 
(inodes, dentries), maybe the kobjects do play a big role here, too).
To access sysfs from an application, you have to use extensively open() 
and close() for each file (attributes) and readdir for directories... or 
use libsysfs which does these things for you.
While the current design is good for users (cat /sys/.../.../attribute), 
it's not very efficient for applications (due to the many syscalls).
IMO it would be much better (for the applications) to have a device node 
in /dev which could be used to access the sysfs tree. No ioctl but using 
simple packets.
Besides the simple query/result things, you could register for recieving 
events (now hotplug), with the difference that the current hotplug 
(AFAIK) can inform (execute) only one application (/sbin/hotplug).
Or even make it possible to recieve events only from certain 
classes/devices/subsystems etc.

tom

             reply	other threads:[~2004-12-18 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-18 19:55 Tomas Carnecky [this message]
2004-12-21 18:52 ` Is it possible to access sysfs from within the kernel? Greg KH

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=41C48B3F.8010709@dbservice.com \
    --to=tom@dbservice.com \
    --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