18 #ifndef _COBALT_KERNEL_REGISTRY_H
19 #define _COBALT_KERNEL_REGISTRY_H
21 #include <cobalt/kernel/list.h>
22 #include <cobalt/kernel/synch.h>
23 #include <cobalt/kernel/vfile.h>
36 #ifdef CONFIG_XENO_OPT_VFILE
37 struct xnpnode *pnode;
43 struct xnvfile_regular vfreg;
44 struct xnvfile_link link;
46 struct xnvfile *vfilp;
48 struct hlist_node hlink;
49 struct list_head link;
52 int xnregistry_init(
void);
54 void xnregistry_cleanup(
void);
56 #ifdef CONFIG_XENO_OPT_VFILE
58 #define XNOBJECT_EXPORT_SCHEDULED ((struct xnvfile *)1L)
59 #define XNOBJECT_EXPORT_INPROGRESS ((struct xnvfile *)2L)
60 #define XNOBJECT_EXPORT_ABORTED ((struct xnvfile *)3L)
66 struct xnvfile_directory vdir;
69 #define DEFINE_XNPTREE(__var, __name) \
70 struct xnptree __var = { \
73 .vdir = xnvfile_nodir, \
77 int (*export)(
struct xnobject *object,
struct xnpnode *pnode);
78 void (*unexport)(
struct xnobject *object,
struct xnpnode *pnode);
79 void (*touch)(
struct xnobject *object);
85 struct xnpnode_ops *ops;
88 struct xnvfile_directory vdir;
91 struct xnpnode_snapshot {
93 struct xnvfile_snapshot_template vfile;
96 struct xnpnode_regular {
98 struct xnvfile_regular_template vfile;
101 struct xnpnode_link {
103 char *(*target)(
void *obj);
108 #define DEFINE_XNPTREE(__var, __name);
116 struct xnpnode_snapshot {
120 struct xnpnode_regular {
124 struct xnpnode_link {
132 extern struct xnobject *registry_obj_slots;
134 static inline struct xnobject *xnregistry_validate(xnhandle_t handle)
136 struct xnobject *object;
142 handle = xnhandle_get_index(handle);
143 if (likely(handle && handle < CONFIG_XENO_OPT_REGISTRY_NRSLOTS)) {
144 object = ®istry_obj_slots[handle];
145 return object->objaddr ? object : NULL;
151 static inline const char *xnregistry_key(xnhandle_t handle)
153 struct xnobject *
object = xnregistry_validate(handle);
154 return object ?
object->key : NULL;
160 struct xnpnode *pnode);
163 xnregistry_enter_anon(
void *objaddr, xnhandle_t *phandle)
171 xnhandle_t *phandle);
177 unsigned long *cstamp_r)
179 struct xnobject *
object = xnregistry_validate(handle);
185 *cstamp_r =
object->cstamp;
187 return object->objaddr;
192 unsigned xnregistry_hash_size(
void);
194 extern struct xnpnode_ops xnregistry_vfsnap_ops;
196 extern struct xnpnode_ops xnregistry_vlink_ops;
int xnregistry_bind(const char *key, xnticks_t timeout, int timeout_mode, xnhandle_t *phandle)
Bind to a real-time object.
Definition: registry.c:749
int xnregistry_enter(const char *key, void *objaddr, xnhandle_t *phandle, struct xnpnode *pnode)
Register a real-time object.
Definition: registry.c:631
int xnregistry_remove(xnhandle_t handle)
Forcibly unregister a real-time object.
Definition: registry.c:819
int xnregistry_unlink(const char *key)
Turn a named object into an anonymous object.
Definition: registry.c:883
static void * xnregistry_lookup(xnhandle_t handle, unsigned long *cstamp_r)
Find a real-time object into the registry.
Definition: registry.h:176
Snapshot revision tag .
Definition: vfile.h:482
Snapshot vfile descriptor .
Definition: vfile.h:506