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;
52int xnregistry_init(
void);
54void 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;
91struct xnpnode_snapshot {
93 struct xnvfile_snapshot_template vfile;
96struct xnpnode_regular {
98 struct xnvfile_regular_template vfile;
103 char *(*target)(
void *obj);
108#define DEFINE_XNPTREE(__var, __name);
116struct xnpnode_snapshot {
120struct xnpnode_regular {
132extern struct xnobject *registry_obj_slots;
134static 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;
151static 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);
163xnregistry_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;
192unsigned xnregistry_hash_size(
void);
194extern struct xnpnode_ops xnregistry_vfsnap_ops;
196extern struct xnpnode_ops xnregistry_vlink_ops;
198extern struct xnpnode_ops xnregistry_vfreg_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:753
int xnregistry_enter(const char *key, void *objaddr, xnhandle_t *phandle, struct xnpnode *pnode)
Register a real-time object.
Definition registry.c:634
int xnregistry_remove(xnhandle_t handle)
Forcibly unregister a real-time object.
Definition registry.c:823
int xnregistry_unlink(const char *key)
Turn a named object into an anonymous object.
Definition registry.c:889
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:483
Snapshot vfile descriptor .
Definition vfile.h:507