24 #ifndef _XENO_NUCLEUS_REGISTRY_H
25 #define _XENO_NUCLEUS_REGISTRY_H
27 #include <nucleus/types.h>
29 #define XNOBJECT_SELF XN_NO_HANDLE
31 #if defined(__KERNEL__) || defined(__XENO_SIM__)
33 #include <nucleus/synch.h>
38 typedef struct xnobject {
41 struct xnsynch safesynch;
44 #ifdef CONFIG_XENO_OPT_VFILE
45 struct xnpnode *pnode;
51 struct xnvfile_regular vfreg;
52 struct xnvfile_link link;
54 struct xnvfile *vfilp;
56 struct xnobject *hnext;
60 #define link2xnobj(ln) container_of(ln, struct xnobject, link)
66 int xnregistry_init(
void);
68 void xnregistry_cleanup(
void);
70 #ifdef CONFIG_XENO_OPT_VFILE
72 #define XNOBJECT_PNODE_RESERVED1 ((struct xnvfile *)1)
73 #define XNOBJECT_PNODE_RESERVED2 ((struct xnvfile *)2)
79 struct xnvfile_directory vdir;
82 #define DEFINE_XNPTREE(__var, __name) \
83 struct xnptree __var = { \
86 .vdir = xnvfile_nodir, \
90 int (*export)(
struct xnobject *object,
struct xnpnode *pnode);
91 void (*unexport)(
struct xnobject *object,
struct xnpnode *pnode);
92 void (*touch)(
struct xnobject *object);
98 struct xnpnode_ops *ops;
101 struct xnvfile_directory vdir;
104 struct xnpnode_snapshot {
106 struct xnvfile_snapshot_template vfile;
109 struct xnpnode_regular {
111 struct xnvfile_regular_template vfile;
114 struct xnpnode_link {
116 char *(*target)(
void *obj);
121 #define DEFINE_XNPTREE(__var, __name);
129 struct xnpnode_snapshot {
133 struct xnpnode_regular {
137 struct xnpnode_link {
143 extern struct xnobject *registry_obj_slots;
147 extern struct xnobject *registry_obj_slots;
149 static inline struct xnobject *xnregistry_validate(xnhandle_t handle)
151 struct xnobject *object;
157 if (likely(handle && handle < CONFIG_XENO_OPT_REGISTRY_NRSLOTS)) {
158 object = ®istry_obj_slots[handle];
159 return object->objaddr ?
object : NULL;
165 static inline void *xnregistry_lookup(xnhandle_t handle)
167 struct xnobject *
object = xnregistry_validate(handle);
168 return object ?
object->objaddr : NULL;
174 struct xnpnode *pnode);
179 xnhandle_t *phandle);
196 extern struct xnpnode_ops xnregistry_vfsnap_ops;
198 extern struct xnpnode_ops xnregistry_vlink_ops;
This file is part of the Xenomai project.
int xnregistry_remove_safe(xnhandle_t handle, xnticks_t timeout)
Unregister an idle real-time object.
Definition: registry.c:989
Snapshot revision tag.
Definition: vfile.h:490
void * xnregistry_fetch(xnhandle_t handle)
Find a real-time object into the registry.
Definition: registry.c:1220
void * xnregistry_get(xnhandle_t handle)
Find and lock a real-time object into the registry.
Definition: registry.c:1098
u_long xnregistry_put(xnhandle_t handle)
Unlock a real-time object from the registry.
Definition: registry.c:1157
int xnregistry_enter(const char *key, void *objaddr, xnhandle_t *phandle, struct xnpnode *pnode)
Register a real-time object.
Definition: registry.c:657
int xnregistry_bind(const char *key, xnticks_t timeout, int timeout_mode, xnhandle_t *phandle)
Bind to a real-time object.
Definition: registry.c:798
int xnregistry_remove(xnhandle_t handle)
Forcibly unregister a real-time object.
Definition: registry.c:882
Snapshot vfile descriptor.
Definition: vfile.h:514