Skip to contentSkip to conversation

Avoid add_proc_leaf duplicates

PATCH New Jan Kiszka 1 participant 1 message Aug 19, 2008 Generic include/asm header files

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/2 Avoid add_proc_leaf duplicates

For unknown (historical?) reasons, there are 3 identical implementations of add_proc_leaf services in Xenomai right now. This patch switches them all to the rthal provided version.

---
 include/asm-generic/hal.h |   10 +++----
 ksrc/arch/generic/hal.c   |   18 +++++++-------
 ksrc/arch/generic/nmi.c   |    6 ++--
 ksrc/arch/x86/nmi_32.c    |    6 ++--
 ksrc/nucleus/module.c     |   58 +++++++++++++++-------------------------------
 ksrc/nucleus/registry.c   |   31 +++---------------------
 6 files changed, 44 insertions(+), 85 deletions(-)
include/asm-generic/hal.h +5 -5
Index: b/include/asm-generic/hal.h
===================================================================
@@ -459,11 +459,11 @@ void rthal_timer_release(int cpu);
 
 extern struct proc_dir_entry *rthal_proc_root;
 
-struct proc_dir_entry *__rthal_add_proc_leaf(const char *name,
-					     read_proc_t rdproc,
-					     write_proc_t wrproc,
-					     void *data,
-					     struct proc_dir_entry *parent);
+struct proc_dir_entry *rthal_add_proc_leaf(const char *name,
+					   read_proc_t rdproc,
+					   write_proc_t wrproc,
+					   void *data,
+					   struct proc_dir_entry *parent);
 #endif /* CONFIG_PROC_FS */
 
 #ifdef CONFIG_IPIPE_TRACE
ksrc/arch/generic/hal.c +9 -9
Index: b/ksrc/arch/generic/hal.c
===================================================================
@@ -723,11 +723,11 @@ static int apc_read_proc(char *page,
     return len;
 }
 
-struct proc_dir_entry *__rthal_add_proc_leaf(const char *name,
-                                             read_proc_t rdproc,
-                                             write_proc_t wrproc,
-                                             void *data,
-                                             struct proc_dir_entry *parent)
+struct proc_dir_entry *rthal_add_proc_leaf(const char *name,
+                                           read_proc_t rdproc,
+                                           write_proc_t wrproc,
+                                           void *data,
+                                           struct proc_dir_entry *parent)
 {
     int mode = wrproc ? 0644 : 0444;
     struct proc_dir_entry *entry;
@@ -756,12 +756,12 @@ static int rthal_proc_register(void)
 
     rthal_proc_root->owner = THIS_MODULE;
 
-    __rthal_add_proc_leaf("hal", &hal_read_proc, NULL, NULL, rthal_proc_root);
+    rthal_add_proc_leaf("hal", &hal_read_proc, NULL, NULL, rthal_proc_root);
 
-    __rthal_add_proc_leaf("faults",
-                          &faults_read_proc, NULL, NULL, rthal_proc_root);
+    rthal_add_proc_leaf("faults",
+                        &faults_read_proc, NULL, NULL, rthal_proc_root);
 
-    __rthal_add_proc_leaf("apc", &apc_read_proc, NULL, NULL, rthal_proc_root);
+    rthal_add_proc_leaf("apc", &apc_read_proc, NULL, NULL, rthal_proc_root);
 
     rthal_nmi_proc_register();
 
ksrc/arch/generic/nmi.c +3 -3
Index: b/ksrc/arch/generic/nmi.c
===================================================================
@@ -108,9 +108,9 @@ static int maxlat_write_proc(struct file
 
 void rthal_nmi_proc_register(void)
 {
-    __rthal_add_proc_leaf("nmi_maxlat",
-                          &maxlat_read_proc,
-                          &maxlat_write_proc, NULL, rthal_proc_root);
+    rthal_add_proc_leaf("nmi_maxlat",
+                        &maxlat_read_proc,
+                        &maxlat_write_proc, NULL, rthal_proc_root);
 }
 
 void rthal_nmi_proc_unregister(void)
ksrc/arch/x86/nmi_32.c +3 -3
Index: b/ksrc/arch/x86/nmi_32.c
===================================================================
@@ -232,9 +232,9 @@ int rthal_nmi_request(void (*emergency)
 	nmi_watchdog_tick = &rthal_nmi_watchdog_tick;
 
 #ifdef CONFIG_PROC_FS
-	__rthal_add_proc_leaf("nmi_early_shots",
-			      &earlyshots_read_proc,
-			      NULL, NULL, rthal_proc_root);
+	rthal_add_proc_leaf("nmi_early_shots",
+			    &earlyshots_read_proc,
+			    NULL, NULL, rthal_proc_root);
 #endif /* CONFIG_PROC_FS */
 
 	return 0;
ksrc/nucleus/module.c +20 -38

84 lines not on this page · raw message

ksrc/nucleus/registry.c +4 -27
Index: b/ksrc/nucleus/registry.c
===================================================================
@@ -228,29 +228,6 @@ static inline xnobject_t *registry_valid
    like are hopefully properly handled due to a careful
    synchronization of operations across domains. */
 
-static struct proc_dir_entry *add_proc_leaf(const char *name,
-					    read_proc_t rdproc,
-					    write_proc_t wrproc,
-					    void *data,
-					    struct proc_dir_entry *parent)
-{
-	int mode = wrproc ? 0644 : 0444;
-	struct proc_dir_entry *entry;
-
-	entry = create_proc_entry(name, mode, parent);
-
-	if (!entry)
-		return NULL;
-
-	entry->nlink = 1;
-	entry->data = data;
-	entry->read_proc = rdproc;
-	entry->write_proc = wrproc;
-	entry->owner = THIS_MODULE;
-
-	return entry;
-}
-
 static struct proc_dir_entry *add_proc_link(const char *name,
 					    link_proc_t *link_proc,
 					    void *data,
@@ -335,10 +312,10 @@ static DECLARE_WORK_FUNC(registry_proc_c
 						     object->objaddr, dir);
 		else
 			/* Entry allows to get/set object properties. */
-			object->proc = add_proc_leaf(object->key,
-						     pnode->read_proc,
-						     pnode->write_proc,
-						     object->objaddr, dir);
+			object->proc = rthal_add_proc_leaf(object->key,
+							   pnode->read_proc,
+							   pnode->write_proc,
+							   object->objaddr, dir);
 	      fail:
 		xnlock_get_irqsave(&nklock, s);