[PATCH] powerpc: Add/remove/update properties in /proc/device-tree
authorDave C Boutcher <sleddog@us.ibm.com>
Thu, 12 Jan 2006 22:07:17 +0000 (16:07 -0600)
committerPaul Mackerras <paulus@samba.org>
Fri, 13 Jan 2006 10:02:13 +0000 (21:02 +1100)
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@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
fs/proc/proc_devtree.c
include/linux/proc_fs.h

index fb117b74809eca5169b8805a1c83437cd5033105..9bdd077d6f55a020f06e43d93a5f7540b214b523 100644 (file)
@@ -81,6 +81,30 @@ void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop
        __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.
  */
index 74488e49166d88c40018c91f247e5873ad842510..aa6322d4519828c4598cbab4c07116a2a615c385 100644 (file)
@@ -146,6 +146,11 @@ struct property;
 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 *,