From: Greg KH <greg@kroah.com>
To: Tomas Carnecky <tom@dbservice.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Is it possible to access sysfs from within the kernel?
Date: Tue, 21 Dec 2004 10:52:36 -0800 [thread overview]
Message-ID: <20041221185236.GA8656@kroah.com> (raw)
In-Reply-To: <41C48B3F.8010709@dbservice.com>
On Sat, Dec 18, 2004 at 08:55:43PM +0100, Tomas Carnecky wrote:
> 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).
Why not? Do you have numbers showing that this is inefficient? Have
you looked at using libsysfs to make it easier for your program to
access sysfs?
> 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.
No, please just use the filesystem.
> Besides the simple query/result things, you could register for recieving
> events (now hotplug),
And netlink.
> with the difference that the current hotplug
> (AFAIK) can inform (execute) only one application (/sbin/hotplug).
Not true. Please read the /sbin/hotplug script to find out how your
program can get those notifications.
> Or even make it possible to recieve events only from certain
> classes/devices/subsystems etc.
It does that already today. Again, please read the documentation that
is already included in the program.
thanks,
greg k-h
prev parent reply other threads:[~2004-12-21 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-18 19:55 Is it possible to access sysfs from within the kernel? Tomas Carnecky
2004-12-21 18:52 ` Greg KH [this message]
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=20041221185236.GA8656@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tom@dbservice.com \
/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