Module: xenomai-gch
Branch: for-forge
Commit: aabb439449def5fe914f49d601a04871b7e3c2ee
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=aabb439449def5fe914f49d601a04871b7e3c2ee

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Dec 20 00:27:44 2013 +0100

registry: export hash size function

---

 include/cobalt/kernel/registry.h |    2 ++
 kernel/cobalt/registry.c         |   10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/cobalt/kernel/registry.h b/include/cobalt/kernel/registry.h
index 7bbb99d..fea07ca 100644
--- a/include/cobalt/kernel/registry.h
+++ b/include/cobalt/kernel/registry.h
@@ -192,6 +192,8 @@ unsigned long xnregistry_put(xnhandle_t handle);
 
 int xnregistry_unlink(const char *key);
 
+unsigned xnregistry_hash_size(void);
+
 extern struct xnpnode_ops xnregistry_vfsnap_ops;
 
 extern struct xnpnode_ops xnregistry_vlink_ops;
diff --git a/kernel/cobalt/registry.c b/kernel/cobalt/registry.c
index 794a27e..7d5fe72 100644
--- a/kernel/cobalt/registry.c
+++ b/kernel/cobalt/registry.c
@@ -93,7 +93,7 @@ static struct xnvfile_regular usage_vfile = {
 
 #endif /* CONFIG_XENO_OPT_VFILE */
 
-int xnregistry_init(void)
+unsigned xnregistry_hash_size(void)
 {
        static const int primes[] = {
                101, 211, 307, 401, 503, 601,
@@ -104,6 +104,11 @@ int xnregistry_init(void)
 ((n) < sizeof(primes) / sizeof(int) ? \
  (n) : sizeof(primes) / sizeof(int) - 1)
 
+       return primes[obj_hash_max(CONFIG_XENO_OPT_REGISTRY_NRSLOTS / 100)];
+}
+
+int xnregistry_init(void)
+{
        int n, ret __maybe_unused;
 
        registry_obj_slots = kmalloc(CONFIG_XENO_OPT_REGISTRY_NRSLOTS *
@@ -143,8 +148,7 @@ int xnregistry_init(void)
        list_get_entry(&free_object_list, struct xnobject, link);
        nr_active_objects = 1;
 
-       nr_object_entries =
-           primes[obj_hash_max(CONFIG_XENO_OPT_REGISTRY_NRSLOTS / 100)];
+       nr_object_entries = xnregistry_hash_size();
        object_index = kmalloc(sizeof(*object_index) *
                                      nr_object_entries, GFP_KERNEL);
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to