* Using Sysfs uevents.
@ 2012-02-15 12:47 Pranay Kumar Srivastava
2012-02-15 17:06 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Pranay Kumar Srivastava @ 2012-02-15 12:47 UTC (permalink / raw)
To: kernelnewbies
Hi,
I was playing with sysfs and I'm able to create kset and kobjects within them as well. 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?
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?
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Using Sysfs uevents.
2012-02-15 12:47 Using Sysfs uevents Pranay Kumar Srivastava
@ 2012-02-15 17:06 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-02-15 17:06 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-15 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 12:47 Using Sysfs uevents Pranay Kumar Srivastava
2012-02-15 17:06 ` Greg KH
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).