Subject: [PATCH] Add ability to register class interfaces for network class

From: Timo Teräs <[email-masked]>
Date: Tue, 26 Oct 2004 21:35:26 +0300

Add functions to register class interfaces for network class.
Similar to the ones found in scsi subsystem.

Originally posted on linux-net and related discussion can be found
from http://marc.theaimsgroup.com/?l=linux-net&m=109758592121767&w=2.

Signed-off-by: Timo Teräs <[email-masked]>

--- linux-2.6.9-rc4.orig/net/core/net-sysfs.c	2004-10-12 13:23:35.106496312 +0300
+++ linux-2.6.9-rc4/net/core/net-sysfs.c	2004-10-12 13:24:29.177276304 +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);
--- linux-2.6.9-rc4.orig/include/linux/netdevice.h	2004-10-12 13:23:31.186092304 +0300
+++ linux-2.6.9-rc4/include/linux/netdevice.h	2004-10-12 13:24:29.179276000 +0300
@@ -951,6 +951,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 */