From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH 1/2] Avoid add_proc_leaf duplicates
Date: Tue, 19 Aug 2008 18:14:01 +0200 [thread overview]
Message-ID: <48AAF149.5090200@domain.hid> (raw)
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.
Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
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(-)
Index: b/include/asm-generic/hal.h
===================================================================
--- a/include/asm-generic/hal.h
+++ 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
Index: b/ksrc/arch/generic/hal.c
===================================================================
--- a/ksrc/arch/generic/hal.c
+++ 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();
Index: b/ksrc/arch/generic/nmi.c
===================================================================
--- a/ksrc/arch/generic/nmi.c
+++ 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)
Index: b/ksrc/arch/x86/nmi_32.c
===================================================================
--- a/ksrc/arch/x86/nmi_32.c
+++ 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;
Index: b/ksrc/nucleus/module.c
===================================================================
--- a/ksrc/nucleus/module.c
+++ b/ksrc/nucleus/module.c
@@ -987,29 +987,6 @@ static int affinity_write_proc(struct fi
return count;
}
-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_fops(const char *name,
struct file_operations *fops,
size_t size,
@@ -1046,26 +1023,31 @@ void xnpod_init_proc(void)
#endif /* CONFIG_XENO_OPT_STATS */
#if defined(CONFIG_SMP) && XENO_DEBUG(NUCLEUS)
- add_proc_leaf("lock", &lock_read_proc, NULL, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("lock", &lock_read_proc, NULL, NULL,
+ rthal_proc_root);
#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
- add_proc_leaf("latency",
- &latency_read_proc,
- &latency_write_proc, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("latency",
+ &latency_read_proc,
+ &latency_write_proc, NULL, rthal_proc_root);
- add_proc_leaf("version", &version_read_proc, NULL, NULL,
- rthal_proc_root);
+ rthal_add_proc_leaf("version", &version_read_proc, NULL, NULL,
+ rthal_proc_root);
- add_proc_leaf("timer", &timer_read_proc, NULL, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("timer", &timer_read_proc, NULL, NULL,
+ rthal_proc_root);
- add_proc_leaf("timebases", &timebase_read_proc, NULL, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("timebases", &timebase_read_proc, NULL, NULL,
+ rthal_proc_root);
- add_proc_leaf("irq", &irq_read_proc, NULL, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("irq", &irq_read_proc, NULL, NULL,
+ rthal_proc_root);
- add_proc_leaf("heap", &heap_read_proc, NULL, NULL, rthal_proc_root);
+ rthal_add_proc_leaf("heap", &heap_read_proc, NULL, NULL,
+ rthal_proc_root);
- add_proc_leaf("affinity", &affinity_read_proc, &affinity_write_proc,
- NULL, rthal_proc_root);
+ rthal_add_proc_leaf("affinity", &affinity_read_proc,
+ &affinity_write_proc, NULL, rthal_proc_root);
#ifdef CONFIG_XENO_OPT_PERVASIVE
iface_proc_root =
@@ -1129,9 +1111,9 @@ static int iface_read_proc(char *page,
void xnpod_declare_iface_proc(struct xnskin_slot *iface)
{
- add_proc_leaf(iface->props->name,
- &iface_read_proc, NULL, iface,
- iface_proc_root);
+ rthal_add_proc_leaf(iface->props->name,
+ &iface_read_proc, NULL, iface,
+ iface_proc_root);
}
void xnpod_discard_iface_proc(const char *iface_name)
Index: b/ksrc/nucleus/registry.c
===================================================================
--- a/ksrc/nucleus/registry.c
+++ 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);
reply other threads:[~2008-08-19 16:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48AAF149.5090200@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.