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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Dec  9 22:04:38 2013 +0100

cobalt/registry: add unlink service

---

 include/cobalt/kernel/registry.h |    2 ++
 kernel/cobalt/registry.c         |   43 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/include/cobalt/kernel/registry.h b/include/cobalt/kernel/registry.h
index d2906db..6c25eee 100644
--- a/include/cobalt/kernel/registry.h
+++ b/include/cobalt/kernel/registry.h
@@ -184,6 +184,8 @@ void *xnregistry_fetch(xnhandle_t handle);
 
 unsigned long xnregistry_put(xnhandle_t handle);
 
+int xnregistry_unlink(const char *key);
+
 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 cebd5f0..004bc96 100644
--- a/kernel/cobalt/registry.c
+++ b/kernel/cobalt/registry.c
@@ -881,6 +881,49 @@ unlock_and_exit:
 EXPORT_SYMBOL_GPL(xnregistry_remove);
 
 /**
+ * Turn a named object into an anonymous object
+ */
+int xnregistry_unlink(const char *key)
+{
+       struct xnobject *object;
+       int ret = 0;
+       spl_t s;
+
+       xnlock_get_irqsave(&nklock, s);
+
+       object = registry_hash_find(key);
+       if (object == NULL) {
+               ret = -ESRCH;
+               goto unlock_and_exit;
+       }
+               
+       ret = registry_hash_remove(object);
+       if (ret < 0)
+               goto unlock_and_exit;
+
+#ifdef CONFIG_XENO_OPT_VFILE
+       if (object->pnode) {
+               registry_unexport_pnode(object);
+               /*
+                * Leave the update of the object queues to
+                * the work callback if it has been kicked.
+                */
+               if (object->pnode)
+                       goto unlock_and_exit;
+       }
+#endif /* CONFIG_XENO_OPT_VFILE */
+
+       list_del(&object->link);
+               
+       object->key = NULL;
+
+unlock_and_exit:
+       xnlock_put_irqrestore(&nklock, s);
+
+       return ret;
+}
+
+/**
  * @fn int xnregistry_remove_safe(xnhandle_t handle,xnticks_t timeout)
  * @brief Unregister an idle real-time object.
  *


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

Reply via email to