[PATCH][1/4] Add unregister_node() to drivers/base/node.c

From: Keiichiro Tokunaga <tokunaga.keiich_at_jp.fujitsu.com>
Date: 2004-09-24 02:31:23
Name: numa_hp_base.patch
Status: Tested on 2.6.9-rc2
Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Description:
Create unregister_node() that removes corresponding sysfs directory
and files from /sys/devices/system/node/ at hot-removal time.

Thanks,
Keiichiro Tokunaga
---

 linux-2.6.9-rc2-fix-kei/drivers/base/node.c  |   16 +++++++++++++++-
 linux-2.6.9-rc2-fix-kei/include/linux/node.h |    1 +
 linux-2.6.9-rc2-fix-kei/mm/page_alloc.c      |    2 ++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff -puN drivers/base/node.c~numa_hp_base drivers/base/node.c
--- linux-2.6.9-rc2-fix/drivers/base/node.c~numa_hp_base	2004-09-24 00:14:55.659950914 +0900
+++ linux-2.6.9-rc2-fix-kei/drivers/base/node.c	2004-09-24 00:14:55.668740028 +0900
@@ -117,7 +117,7 @@ static SYSDEV_ATTR(numastat, S_IRUGO, no
  *
  * Initialize and register the node device.
  */
-int __init register_node(struct node *node, int num, struct node *parent)
+int register_node(struct node *node, int num, struct node *parent)
 {
 	int error;
 
@@ -132,6 +132,16 @@ int __init register_node(struct node *no
 	}
 	return error;
 }
+void  unregister_node(struct node *node, struct node *parent)
+{
+	if (node == NULL) {
+		printk("unregister_node: node is null.");
+		return;
+	}
+	sysdev_remove_file(&node->sysdev, &attr_cpumap);
+	sysdev_remove_file(&node->sysdev, &attr_meminfo);
+	sysdev_unregister(&node->sysdev);
+}
 
 
 int __init register_node_type(void)
@@ -139,3 +149,7 @@ int __init register_node_type(void)
 	return sysdev_class_register(&node_class);
 }
 postcore_initcall(register_node_type);
+
+
+EXPORT_SYMBOL(register_node);
+EXPORT_SYMBOL(unregister_node);
diff -puN include/linux/node.h~numa_hp_base include/linux/node.h
--- linux-2.6.9-rc2-fix/include/linux/node.h~numa_hp_base	2004-09-24 00:14:55.664833755 +0900
+++ linux-2.6.9-rc2-fix-kei/include/linux/node.h	2004-09-24 00:14:55.669716596 +0900
@@ -27,6 +27,7 @@ struct node {
 };
 
 extern int register_node(struct node *, int, struct node *);
+extern void  unregister_node(struct node *node, struct node *parent);
 
 #define to_node(sys_device) container_of(sys_device, struct node, sysdev)
 
diff -puN mm/page_alloc.c~numa_hp_base mm/page_alloc.c
--- linux-2.6.9-rc2-fix/mm/page_alloc.c~numa_hp_base	2004-09-24 00:14:55.666786892 +0900
+++ linux-2.6.9-rc2-fix-kei/mm/page_alloc.c	2004-09-24 00:14:55.670693164 +0900
@@ -14,6 +14,7 @@
  *          (lots of bits borrowed from Ingo Molnar & Andrew Morton)
  */
 
+#include <linux/module.h>
 #include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/mm.h>
@@ -44,6 +45,7 @@ int sysctl_lower_zone_protection = 0;
 
 EXPORT_SYMBOL(totalram_pages);
 EXPORT_SYMBOL(nr_swap_pages);
+EXPORT_SYMBOL(node_online_map);
 
 /*
  * Used by page_zone() to look up the address of the struct zone whose

_
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Sep 23 12:38:10 2004

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:31 EST