2005-01-07 14:51:02

by Ikke

[permalink] [raw]
Subject: kobject_uevent

One of the new features of 2.6.10 (well, AFAIK its new) is the
kobject_uevent function set.
Currently only some places send out events like this, so I was
thinking to add some more.

Question is: how can I test this? Is there any userland program that
catches these events and prints some information on them to the
screen?

I found out Kay Siever and RML's (maybe some others too?) work on
kernel->userspace events, but the syntax used there seems to be
somewhat different. Kay's got a listener
(http://vrfy.org/projects/kdbusd/kdbusd.c), but is this one
compatible?

Regards, Ikke


2005-01-07 15:14:21

by Ikke

[permalink] [raw]
Subject: Re: kobject_uevent

Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes
[quote]
kobject_uevent(const char *signal,
struct kobject *kobj,
struct attribute *attr)
[/quote]
whilst include/linux/kobject_uevent.h defines
[quote]
int kobject_uevent(struct kobject *kobj,
enum kobject_action action,
struct attribute *attr);
[/quote]
which is something completely different.

On Fri, 7 Jan 2005 15:50:52 +0100, Ikke <[email protected]> wrote:
> One of the new features of 2.6.10 (well, AFAIK its new) is the
> kobject_uevent function set.
> Currently only some places send out events like this, so I was
> thinking to add some more.
>
> Question is: how can I test this? Is there any userland program that
> catches these events and prints some information on them to the
> screen?
>
> I found out Kay Siever and RML's (maybe some others too?) work on
> kernel->userspace events, but the syntax used there seems to be
> somewhat different. Kay's got a listener
> (http://vrfy.org/projects/kdbusd/kdbusd.c), but is this one
> compatible?
>
> Regards, Ikke
>

2005-01-07 17:00:27

by Robert Love

[permalink] [raw]
Subject: Re: kobject_uevent

On Fri, 2005-01-07 at 16:14 +0100, Ikke wrote:

> Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes
> [quote]
> kobject_uevent(const char *signal,
> struct kobject *kobj,
> struct attribute *attr)
> [/quote]
> whilst include/linux/kobject_uevent.h defines
> [quote]
> int kobject_uevent(struct kobject *kobj,
> enum kobject_action action,
> struct attribute *attr);
> [/quote]
> which is something completely different.

The signal as a string was replaced by the kobject_action enumeration,
which is mapped to a string. It is just an attempt at providing type
safety.

Robert Love


2005-01-07 17:39:38

by Greg KH

[permalink] [raw]
Subject: Re: kobject_uevent

On Fri, Jan 07, 2005 at 04:14:07PM +0100, Ikke wrote:
> Next to this, there seems to be a mistake in the 2.6.10 changelog: it writes
> [quote]
> kobject_uevent(const char *signal,
> struct kobject *kobj,
> struct attribute *attr)
> [/quote]
> whilst include/linux/kobject_uevent.h defines
> [quote]
> int kobject_uevent(struct kobject *kobj,
> enum kobject_action action,
> struct attribute *attr);
> [/quote]
> which is something completely different.

Look further on in the changelog where I changed the api to the current
one :)

thanks,

greg k-h

2005-01-07 17:41:12

by Greg KH

[permalink] [raw]
Subject: Re: kobject_uevent

On Fri, Jan 07, 2005 at 03:50:52PM +0100, Ikke wrote:
> One of the new features of 2.6.10 (well, AFAIK its new) is the
> kobject_uevent function set.
> Currently only some places send out events like this, so I was
> thinking to add some more.
>
> Question is: how can I test this? Is there any userland program that
> catches these events and prints some information on them to the
> screen?

http://www.us.kernel.org/pub/linux/utils/kernel/hotplug/uevent_listen.c
should be a good place to start. It's what I used to verify stuff was
working properly.

Good luck,

greg k-h

2005-01-07 21:28:17

by Ikke

[permalink] [raw]
Subject: Re: kobject_uevent

I've been working a bit on the kobject_uevent stuff, and got a
prototype system working (well, almost) which takes kernel's uevents,
and sends them to the DBUS system bus so other software can (ab)use
them.
I'll add more uevents later, once I understand the system completely.
I'm a little confused by the use of KOBJ_* stuff in
include/linux/kobject_uevent.h and the string representation of them
in lib/kobject_uevent.c, which means people must edit 2 files if they
want to add new events?

More information on my little work here [1]

Regards, Ikke


[1] http://blog.eikke.com/index.php/ikke/2005/01/07/kernel_events_to_dbus

2005-01-07 23:45:29

by Greg KH

[permalink] [raw]
Subject: Re: kobject_uevent

On Fri, Jan 07, 2005 at 10:25:14PM +0100, Ikke wrote:
> I'm a little confused by the use of KOBJ_* stuff in
> include/linux/kobject_uevent.h and the string representation of them
> in lib/kobject_uevent.c, which means people must edit 2 files if they
> want to add new events?

Yes, that is exactly correct. The enumerated type is used for the
callers to kobject_uevent* and the string is sent out on the wire from
within the kevent core code.

Hope this helps,

greg k-h

2005-01-08 10:00:33

by Ikke

[permalink] [raw]
Subject: Re: kobject_uevent

Ok, events are sent to DBUS now, including the additional string
information [1]. Code (for now, it's not "done" yet!) is here [2].

I'll ask the DBUS guys whether it's usefull to get this (optionally)
directly into DBUS.

Let's hope other kernel devs will also start introducing events into
their code! :-)

Greetings, Ikke

[1] http://blog.eikke.com/index.php/ikke/2005/01/08/udev_kernel_events_part_2
[2] http://www.eikke.com/files/code/uevent_listen.c


On Fri, 7 Jan 2005 15:36:32 -0800, Greg KH <[email protected]> wrote:
> On Fri, Jan 07, 2005 at 10:25:14PM +0100, Ikke wrote:
> > I'm a little confused by the use of KOBJ_* stuff in
> > include/linux/kobject_uevent.h and the string representation of them
> > in lib/kobject_uevent.c, which means people must edit 2 files if they
> > want to add new events?
>
> Yes, that is exactly correct. The enumerated type is used for the
> callers to kobject_uevent* and the string is sent out on the wire from
> within the kevent core code.
>
> Hope this helps,
>
> greg k-h
>