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;