Re: kobject events questions

From: Timo Teräs
Date: Wed Oct 06 2004 - 05:46:00 EST


ext Greg KH wrote:
That's the point. It should "be difficult" in that you need to present
a valid reason to the whole kernel community as to why a new event needs
to be added. But if you make a point that others agree with, then there
should be no problem in adding it.

Ok. Now that I can implement my iptables plugin I need either:

1) A new event: something like "went idle". Which would be sent from the class_device kobject of related network interface.

or

2) I could use the class interface system to add an kobject (instead of writing a new class) for each network devices class_device. But to accomplish this I have to be able to register interfaces with net_class defined net-sysfs.c. See applied patch. It's provides similar functions as scsi layer (see scsi_register_interface).

Which one would be better choice? At least the option #2 is general purpose and some others might find it useful too. To whom/where I should send it?

- Timo

Index: linux/net/core/net-sysfs.c
===================================================================
--- linux.orig/net/core/net-sysfs.c 2004-09-27 18:27:16.000000000 +0300
+++ linux/net/core/net-sysfs.c 2004-10-06 13:22:07.347392792 +0300
@@ -448,3 +448,11 @@
{
return class_register(&net_class);
}
+
+int netdev_register_interface(struct class_interface *intf)
+{
+ intf->class = &net_class;
+ return class_interface_register(intf);
+}
+
+EXPORT_SYMBOL_GPL(netdev_register_interface);
Index: linux/include/linux/netdevice.h
===================================================================
--- linux.orig/include/linux/netdevice.h 2004-09-27 18:27:54.000000000 +0300
+++ linux/include/linux/netdevice.h 2004-10-06 13:29:51.031902032 +0300
@@ -953,6 +953,12 @@
extern char *net_sysctl_strdup(const char *s);
#endif

+#ifdef CONFIG_SYSFS
+extern int netdev_register_interface(struct class_interface *intf);
+#define netdev_unregister_interface(intf) \
+ class_interface_unregister(intf)
+#endif
+
#endif /* __KERNEL__ */

#endif /* _LINUX_DEV_H */

Attachment: signature.asc
Description: OpenPGP digital signature