Re: kobject events questions

From: Timo TerÃs
Date: Fri Oct 01 2004 - 04:58:10 EST


Robert Love wrote:
On Wed, 2004-09-29 at 16:37 +0300, Timo TerÃs wrote:
1) Send the events so that they are always associated with the network devices class_device kobject. I guess this would be quite clean way to do it, but it'd require adding a new signal type and would limit the iptables target to be associated always with a interface.

2) Create a device class that has virtual timer devices that trigger events (ie. /sys/class/utimer). Each timer could have some attributes (like expired, expire_time, etc.) and would emit "change" signals whenever timer expires.

Well, #1 is the intention and spirit of the kevent system.

And adding a new signal type is fine.

So the only downside is that the table to interface association thing.
I have no idea how big an issue that is for you.

I'm just a bit dubious about adding new signals since they are hardcoded in the kernel. It's a time consuming process to add new signals (either for development build or for official kernels). This is one of the reasons I liked more about the original kevent patch. Wouldn't simple #defines have been enough for signal names?

You could of course create a new kobject, ala #2, but that does not seem
optimal if the object is otherwise worthless. I don't think that you
should create a new class. Better to put something under /sys/net
related to what you are doing.

I thought quite a bit about to where add my kobjects. I couldn't find a /sys/net on my current system (am I missing some config option?). If you mean /sys/class/net aren't all kobject in there supposed to be of same type (namely class_device associated with net_device). Of course I could add them under some interface, but then again my iptables rules would have to be interface specific and this is the thing I'm trying to avoid in this approach. Adding to /sys would be an overkill as it'd require implementing a subsystem. And I couldn't find any other suitable place so ended up making a new class.

I actually made some test code to add a new class and it's relatively simple. But I guess it isn't really useful if I'd be the only user. Maybe it could have some features that'd make it more generic?

Of course, I could use the "connector" patch that Greg pointed, but I'd still like more the kevent approach. Namely, it'd make my userland app much simpler.

Cheers,
Timo

Attachment: signature.asc
Description: OpenPGP digital signature