1 #ifndef PSE51_REGISTRY_H
2 #define PSE51_REGISTRY_H
5 #include <nucleus/queue.h>
6 #include <nucleus/synch.h>
7 #include <posix/posix.h>
9 #define PSE51_MAXNAME 64
13 typedef struct pse51_node {
19 struct pse51_node *next;
20 struct pse51_node **prev;
21 char name[PSE51_MAXNAME];
24 int pse51_reg_pkg_init(
unsigned objects_count,
unsigned maxfds);
26 void pse51_reg_pkg_cleanup(
void);
31 int pse51_node_get(pse51_node_t **nodep,
37 int pse51_node_add(pse51_node_t *node,
const char *name,
unsigned magic);
41 int pse51_node_put(pse51_node_t *node);
45 int pse51_node_remove(pse51_node_t **nodep,
const char *name,
unsigned magic);
47 #define PSE51_NODE_REMOVED 1
49 #define pse51_node_ref_p(node) ((node)->refcount)
51 #define pse51_node_removed_p(node) \
52 ((node)->flags & PSE51_NODE_REMOVED && !pse51_node_ref_p(node))
55 typedef struct pse51_desc {
61 int pse51_desc_create(pse51_desc_t **descp, pse51_node_t *node,
long flags);
63 int pse51_desc_get(pse51_desc_t **descp,
int fd,
unsigned magic);
65 int pse51_desc_destroy(pse51_desc_t *desc);
67 #define pse51_desc_setflags(desc, fl) ((desc)->flags = (fl))
69 #define pse51_desc_getflags(desc) ((desc)->flags)
71 #define pse51_desc_node(desc) ((desc)->node)
73 #define pse51_desc_fd(desc) ((desc)->fd)
75 #define PSE51_PERMS_MASK (O_RDONLY | O_WRONLY | O_RDWR)
80 #ifdef CONFIG_XENO_OPT_PERVASIVE
83 DECLARE_EXTERN_XNLOCK(pse51_assoc_lock);
85 typedef xnqueue_t pse51_assocq_t;
91 #define link2assoc(laddr) \
92 ((pse51_assoc_t *)((unsigned long)(laddr) - offsetof(pse51_assoc_t, link)))
100 #define assoc2ufd(laddr) \
101 ((pse51_ufd_t *)((unsigned long) (laddr) - offsetof(pse51_ufd_t, assoc)))
104 #define pse51_assocq_init(q) (initq(q))
106 #define pse51_assoc_key(assoc) ((assoc)->key)
108 void pse51_assocq_destroy(pse51_assocq_t *q,
void (*destroy)(pse51_assoc_t *));
110 int pse51_assoc_insert(pse51_assocq_t *q,
111 pse51_assoc_t *assoc,
114 pse51_assoc_t *pse51_assoc_lookup(pse51_assocq_t *q,
117 pse51_assoc_t *pse51_assoc_remove(pse51_assocq_t *q,