From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Using Sysfs uevents.
Date: Wed, 15 Feb 2012 09:06:19 -0800 [thread overview]
Message-ID: <20120215170619.GA25531@kroah.com> (raw)
In-Reply-To: <8C986BA0C8FEF645A1951086A1FE00AE41EDEA1F0C@NDA-HCLT-EVS04.HCLT.CORP.HCL.IN>
On Wed, Feb 15, 2012 at 06:17:28PM +0530, Pranay Kumar Srivastava wrote:
> Hi,
>
> I was playing with sysfs and I'm able to create kset and kobjects
> within them as well.
Nice, but why? Almost no one ever should be touching "raw" sysfs
kobjects and ksets.
> I need to know how do I use the uevents of these kobjects that I
> create. For example while reading the code I found that certain events
> like ADD, DEL a couple more were there are apparently fired. Now
> currently I'm not handling these events, the ops field is null, so
> they don't bother me hence they are not mandatory?
They are created by the kobject core automatically for you.
> If I were to actually do something with these events what it should
> be? Since my module runs fine and the uevents are supposed to be for
> userland applications (Hotplug) but the point is again how will a
> userspace application get to know about it? Does the application needs
> to create netlink sockets for it? If it does then why bother with the
> uevents of kobject?
No, udev grabs all of these events and allows other programs to
subscribe to it and get that information. You don't have to write your
own program to do this, the infrastructure is all there already.
But I wouldn't really worry about it to much, you shouldn't be messing
with kobjects directly anyway, why not use 'struct device' instead?
thanks,
greg k-h
prev parent reply other threads:[~2012-02-15 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 12:47 Using Sysfs uevents Pranay Kumar Srivastava
2012-02-15 17:06 ` 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=20120215170619.GA25531@kroah.com \
--to=greg@kroah.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).