netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.4-rc2] sysfs simple class support for netlink
@ 2004-03-04 23:02 Leann Ogasawara
  2004-03-04 23:57 ` James Morris
  2004-03-11  1:33 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Leann Ogasawara @ 2004-03-04 23:02 UTC (permalink / raw)
  To: netdev; +Cc: Hanna Linder, Greg KH

Hi All,

Patch adds sysfs simple class support for netlink character device
(Major 36).  Feedback appreciated.  Thanks,

Leann

===== net/netlink/netlink_dev.c 1.19 vs edited =====
--- 1.19/net/netlink/netlink_dev.c	Tue Aug 26 09:25:41 2003
+++ edited/net/netlink/netlink_dev.c	Thu Mar  4 12:42:44 2004
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/smp_lock.h>
+#include <linux/device.h>
 
 #include <asm/bitops.h>
 #include <asm/system.h>
@@ -34,6 +35,7 @@
 
 static long open_map;
 static struct socket *netlink_user[MAX_LINKS];
+static struct class_simple *netlink_class;
 
 /*
  *	Device operations
@@ -229,17 +231,26 @@
 		return -EIO;
 	}
 
+	netlink_class = class_simple_create(THIS_MODULE, "netlink");
+	if (IS_ERR(netlink_class)) {
+		printk (KERN_ERR "Error creating netlink class.\n");
+		unregister_chrdev(NETLINK_MAJOR, "netlink");
+		return PTR_ERR(netlink_class);
+	}
+
 	devfs_mk_dir("netlink");
 
 	/*  Someone tell me the official names for the uppercase ones  */
 	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, entries[i].minor),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/%s", entries[i].name);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, entries[i].minor), NULL, "%s", entries[i].name);
 	}
 
 	for (i = 0; i < 16; i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, i + 16),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/tap%d", i);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, i + 16), NULL, "tap%d", i);
 	}
 
 	return 0;
@@ -249,11 +260,16 @@
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(entries); i++)
+	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_remove("netlink/%s", entries[i].name);
-	for (i = 0; i < 16; i++)
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, entries[i].minor));
+	}
+	for (i = 0; i < 16; i++) {
 		devfs_remove("netlink/tap%d", i);
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, i + 16));
+	}
 	devfs_remove("netlink");
+	class_simple_destroy(netlink_class);
 	unregister_chrdev(NETLINK_MAJOR, "netlink");
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.4-rc2] sysfs simple class support for netlink
  2004-03-04 23:02 [PATCH 2.6.4-rc2] sysfs simple class support for netlink Leann Ogasawara
@ 2004-03-04 23:57 ` James Morris
  2004-03-11  1:33 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: James Morris @ 2004-03-04 23:57 UTC (permalink / raw)
  To: Leann Ogasawara; +Cc: netdev, Hanna Linder, Greg KH, David S. Miller, kuznet

On Thu, 4 Mar 2004, Leann Ogasawara wrote:

> Hi All,
> 
> Patch adds sysfs simple class support for netlink character device
> (Major 36).  Feedback appreciated.  Thanks,

Looks fine to me.


- James
-- 
James Morris
<jmorris@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.4-rc2] sysfs simple class support for netlink
  2004-03-04 23:02 [PATCH 2.6.4-rc2] sysfs simple class support for netlink Leann Ogasawara
  2004-03-04 23:57 ` James Morris
@ 2004-03-11  1:33 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-03-11  1:33 UTC (permalink / raw)
  To: Leann Ogasawara; +Cc: netdev, Hanna Linder

On Thu, Mar 04, 2004 at 03:02:36PM -0800, Leann Ogasawara wrote:
> Hi All,
> 
> Patch adds sysfs simple class support for netlink character device
> (Major 36).  Feedback appreciated.  Thanks,

Applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-11  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 23:02 [PATCH 2.6.4-rc2] sysfs simple class support for netlink Leann Ogasawara
2004-03-04 23:57 ` James Morris
2004-03-11  1:33 ` 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).