[PATCH 2/5] powerpc: proc_device_tree remove and update functions

Dave C Boutcher sleddog at us.ibm.com
Wed Jan 11 21:01:28 EST 2006


Add support to the proc_device_tree file for removing
and updating properties.  Remove just removes the 
proc file, update changes the data pointer within
the proc file.  The remainder of the device-tree
changes occur elsewhere.

Signed-off-by: Dave Boutcher <sleddog at us.ibm.com>

 fs/proc/proc_devtree.c  |   24 ++++++++++++++++++++++++
 include/linux/proc_fs.h |    5 +++++
 2 files changed, 29 insertions(+)

diff -uNr -X exclude-files linux-2.6.15-patched/fs/proc/proc_devtree.c linux-2.6.15-patched2/fs/proc/proc_devtree.c
--- linux-2.6.15-patched/fs/proc/proc_devtree.c	2006-01-11 01:52:08.000000000 -0600
+++ linux-2.6.15-patched2/fs/proc/proc_devtree.c	2006-01-11 02:49:58.000000000 -0600
@@ -81,6 +81,30 @@
 	__proc_device_tree_add_prop(pde, prop);
 }
 
+void proc_device_tree_remove_prop(struct proc_dir_entry *pde, 
+				  struct property *prop)
+{
+	remove_proc_entry(prop->name, pde);
+}
+
+void proc_device_tree_update_prop(struct proc_dir_entry *pde, 
+				  struct property *newprop,
+				  struct property *oldprop)
+{
+	struct proc_dir_entry *ent;
+
+	for (ent = pde->subdir; ent != NULL; ent = ent->next)
+		if (ent->data == oldprop)
+			break;
+	if (ent == NULL) {
+		printk(KERN_WARNING "device-tree: property \"%s\" "
+		       " does not exist\n", oldprop->name);
+	} else {
+		ent->data = newprop;
+		ent->size = newprop->length;
+	}
+}
+
 /*
  * Process a node, adding entries for its children and its properties.
  */
diff -uNr -X exclude-files linux-2.6.15-patched/include/linux/proc_fs.h linux-2.6.15-patched2/include/linux/proc_fs.h
--- linux-2.6.15-patched/include/linux/proc_fs.h	2006-01-11 01:52:09.000000000 -0600
+++ linux-2.6.15-patched2/include/linux/proc_fs.h	2006-01-11 02:49:58.000000000 -0600
@@ -146,6 +146,11 @@
 extern void proc_device_tree_init(void);
 extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
 extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
+extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, 
+					 struct property *prop);
+extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, 
+					 struct property *newprop,
+					 struct property *oldprop);
 #endif /* CONFIG_PROC_DEVICETREE */
 
 extern struct proc_dir_entry *proc_symlink(const char *,

-- 
Dave Boutcher



More information about the Linuxppc64-dev mailing list