00001
00024 #ifndef _XENO_NUCLEUS_REGISTRY_H
00025 #define _XENO_NUCLEUS_REGISTRY_H
00026
00027 #include <nucleus/types.h>
00028
00029 #define XNOBJECT_SELF XN_NO_HANDLE
00030
00031 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00032
00033 #include <nucleus/synch.h>
00034
00035 struct xnpnode;
00036
00037 typedef struct xnobject {
00038
00039 xnholder_t link;
00040
00041 #define link2xnobj(ln) container_of(ln, xnobject_t, link)
00042
00043 void *objaddr;
00044
00045 const char *key;
00046
00047 xnsynch_t safesynch;
00048
00049 u_long safelock;
00050
00051 u_long cstamp;
00052
00053 struct xnobject *hnext;
00054
00055 #ifdef CONFIG_PROC_FS
00056
00057 struct xnpnode *pnode;
00058
00059 struct proc_dir_entry *proc;
00060
00061 #endif
00062
00063 } xnobject_t;
00064
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068
00069 int xnregistry_init(void);
00070
00071 void xnregistry_cleanup(void);
00072
00073 #ifdef CONFIG_PROC_FS
00074
00075 #include <linux/proc_fs.h>
00076
00077 #define XNOBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1)
00078 #define XNOBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2)
00079
00080 typedef ssize_t link_proc_t(char *buf,
00081 int count,
00082 void *data);
00083 typedef struct xnptree {
00084
00085 struct proc_dir_entry *dir;
00086 const char *name;
00087 int entries;
00088
00089 } xnptree_t;
00090
00091 typedef struct xnpnode {
00092
00093 struct proc_dir_entry *dir;
00094 const char *type;
00095 int entries;
00096 read_proc_t *read_proc;
00097 write_proc_t *write_proc;
00098 link_proc_t *link_proc;
00099 xnptree_t *root;
00100
00101 } xnpnode_t;
00102
00103 #else
00104
00105 typedef struct xnpnode {
00106
00107 const char *type;
00108
00109 } xnpnode_t;
00110
00111 #endif
00112
00113
00114
00115 int xnregistry_enter(const char *key,
00116 void *objaddr,
00117 xnhandle_t *phandle,
00118 xnpnode_t *pnode);
00119
00120 int xnregistry_bind(const char *key,
00121 xnticks_t timeout,
00122 int timeout_mode,
00123 xnhandle_t *phandle);
00124
00125 int xnregistry_remove(xnhandle_t handle);
00126
00127 int xnregistry_remove_safe(xnhandle_t handle,
00128 xnticks_t timeout);
00129
00130 void *xnregistry_get(xnhandle_t handle);
00131
00132 void *xnregistry_fetch(xnhandle_t handle);
00133
00134 u_long xnregistry_put(xnhandle_t handle);
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #endif
00141
00142 #endif