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_PNODE_RESERVED1 ((struct xnvfile *)1) 59 #define XNOBJECT_PNODE_RESERVED2 ((struct xnvfile *)2) 65 struct xnvfile_directory vdir;
68 #define DEFINE_XNPTREE(__var, __name) \ 69 struct xnptree __var = { \ 72 .vdir = xnvfile_nodir, \ 76 int (*export)(
struct xnobject *object,
struct xnpnode *pnode);
77 void (*unexport)(
struct xnobject *object,
struct xnpnode *pnode);
78 void (*touch)(
struct xnobject *object);
84 struct xnpnode_ops *ops;
87 struct xnvfile_directory vdir;
90 struct xnpnode_snapshot {
92 struct xnvfile_snapshot_template vfile;
95 struct xnpnode_regular {
97 struct xnvfile_regular_template vfile;
100 struct xnpnode_link {
102 char *(*target)(
void *obj);
107 #define DEFINE_XNPTREE(__var, __name); 115 struct xnpnode_snapshot {
119 struct xnpnode_regular {
123 struct xnpnode_link {
131 extern struct xnobject *registry_obj_slots;
133 static inline struct xnobject *xnregistry_validate(xnhandle_t handle)
135 struct xnobject *object;
141 handle = xnhandle_get_index(handle);
142 if (likely(handle && handle < CONFIG_XENO_OPT_REGISTRY_NRSLOTS)) {
143 object = ®istry_obj_slots[handle];
144 return object->objaddr ? object : NULL;
150 static inline const char *xnregistry_key(xnhandle_t handle)
152 struct xnobject *
object = xnregistry_validate(handle);
153 return object ?
object->key : NULL;
159 struct xnpnode *pnode);
162 xnregistry_enter_anon(
void *objaddr, xnhandle_t *phandle)
170 xnhandle_t *phandle);
176 unsigned long *cstamp_r)
178 struct xnobject *
object = xnregistry_validate(handle);
184 *cstamp_r =
object->cstamp;
186 return object->objaddr;
191 unsigned xnregistry_hash_size(
void);
193 extern struct xnpnode_ops xnregistry_vfsnap_ops;
195 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:748
Snapshot revision tag.
Definition: vfile.h:482
int xnregistry_enter(const char *key, void *objaddr, xnhandle_t *phandle, struct xnpnode *pnode)
Register a real-time object.
Definition: registry.c:630
int xnregistry_remove(xnhandle_t handle)
Forcibly unregister a real-time object.
Definition: registry.c:818
int xnregistry_unlink(const char *key)
Turn a named object into an anonymous object.
Definition: registry.c:869
static void * xnregistry_lookup(xnhandle_t handle, unsigned long *cstamp_r)
Find a real-time object into the registry.
Definition: registry.h:175
Snapshot vfile descriptor.
Definition: vfile.h:506