Module: xenomai-rpm Branch: queue/vfile Commit: 8b5e844660b4a7f573c61b7d0000d7ac5ae04af7 URL: http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=8b5e844660b4a7f573c61b7d0000d7ac5ae04af7
Author: Philippe Gerum <[email protected]> Date: Thu Apr 29 19:57:36 2010 +0200 nucleus/registry: convert to vfile --- include/nucleus/registry.h | 166 +++++++++++-------- ksrc/nucleus/registry.c | 379 ++++++++++++++++++++++++-------------------- 2 files changed, 302 insertions(+), 243 deletions(-) diff --git a/include/nucleus/registry.h b/include/nucleus/registry.h index 6bd5ec9..f39521f 100644 --- a/include/nucleus/registry.h +++ b/include/nucleus/registry.h @@ -31,37 +31,31 @@ #if defined(__KERNEL__) || defined(__XENO_SIM__) #include <nucleus/synch.h> +#include <nucleus/vfile.h> struct xnpnode; +struct xnvfile; typedef struct xnobject { - - xnholder_t link; - -#define link2xnobj(ln) container_of(ln, xnobject_t, link) - - void *objaddr; - - const char *key; /* !< Hash key. */ - - xnsynch_t safesynch; /* !< Safe synchronization object. */ - - u_long safelock; /* !< Safe lock count. */ - - u_long cstamp; /* !< Creation stamp. */ - - struct xnobject *hnext; /* !< Next in h-table */ - + void *objaddr; + const char *key; /* !< Hash key. */ + struct xnsynch safesynch; /* !< Safe synchronization object. */ + u_long safelock; /* !< Safe lock count. */ + u_long cstamp; /* !< Creation stamp. */ #ifdef CONFIG_PROC_FS - - struct xnpnode *pnode; /* !< /proc information class. */ - - struct proc_dir_entry *proc; /* !< /proc entry. */ - + struct xnpnode *pnode; /* !< v-file information class. */ + union { + struct xnvfile file; /* !< virtual file. */ + struct xnvfile_link link; /* !< virtual link. */ + } vfile_u; + struct xnvfile_entry *vfilp; #endif /* CONFIG_PROC_FS */ - + struct xnobject *hnext; /* !< Next in h-table */ + struct xnholder link; } xnobject_t; +#define link2xnobj(ln) container_of(ln, struct xnobject, link) + #ifdef __cplusplus extern "C" { #endif @@ -72,41 +66,65 @@ void xnregistry_cleanup(void); #ifdef CONFIG_PROC_FS -#include <linux/proc_fs.h> - -#define XNOBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1) -#define XNOBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2) - -typedef ssize_t link_proc_t(char *buf, - int count, - void *data); -typedef struct xnptree { - - struct proc_dir_entry *dir; - const char *name; - int entries; - -} xnptree_t; +#define XNOBJECT_PNODE_RESERVED1 ((struct xnvfile_entry *)1) +#define XNOBJECT_PNODE_RESERVED2 ((struct xnvfile_entry *)2) + +struct xnptree { + const char *dirname; + /* hidden */ + int entries; + struct xnvfile_directory vdir; +}; + +#define DEFINE_XNPTREE(__var, __name) \ + struct xnptree __var = { \ + .dirname = __name, \ + .entries = 0, \ + .vdir = xnvfile_nodir, \ + } -typedef struct xnpnode { +struct xnpnode_ops { + int (*export)(struct xnobject *object, struct xnpnode *pnode); + void (*unexport)(struct xnobject *object, struct xnpnode *pnode); + void (*touch)(struct xnobject *object); +}; + +struct xnpnode { + const char *dirname; + struct xnptree *root; + struct xnpnode_ops *ops; + /* hidden */ + int entries; + struct xnvfile_directory vdir; +}; + +struct xnpnode_file { + struct xnpnode node; + struct xnvfile_template vfile; +}; + +struct xnpnode_link { + struct xnpnode node; + char *(*target)(void *obj); +}; - struct proc_dir_entry *dir; - const char *type; - int entries; - read_proc_t *read_proc; - write_proc_t *write_proc; - link_proc_t *link_proc; - xnptree_t *root; +#else /* !CONFIG_PROC_FS */ -} xnpnode_t; +#define DEFINE_XNPTREE(__var, __name); -#else /* !CONFIG_PROC_FS */ +/* Placeholders. */ -typedef struct xnpnode { /* Placeholder. */ +struct xnpnode { + const char *dirname; +}; - const char *type; +struct xnpnode_file { + struct xnpnode node; +}; -} xnpnode_t; +struct xnpnode_link { + struct xnpnode node; +}; #endif /* !CONFIG_PROC_FS */ @@ -114,26 +132,7 @@ extern struct xnobject *registry_obj_slots; /* Public interface. */ -int xnregistry_enter(const char *key, - void *objaddr, - xnhandle_t *phandle, - xnpnode_t *pnode); - -int xnregistry_bind(const char *key, - xnticks_t timeout, - int timeout_mode, - xnhandle_t *phandle); - -int xnregistry_remove(xnhandle_t handle); - -int xnregistry_remove_safe(xnhandle_t handle, - xnticks_t timeout); - -void *xnregistry_get(xnhandle_t handle); - -void *xnregistry_fetch(xnhandle_t handle); - -u_long xnregistry_put(xnhandle_t handle); +extern struct xnobject *registry_obj_slots; static inline struct xnobject *xnregistry_validate(xnhandle_t handle) { @@ -157,10 +156,35 @@ static inline void *xnregistry_lookup(xnhandle_t handle) return object ? object->objaddr : NULL; } +int xnregistry_enter(const char *key, + void *objaddr, + xnhandle_t *phandle, + struct xnpnode *pnode); + +int xnregistry_bind(const char *key, + xnticks_t timeout, + int timeout_mode, + xnhandle_t *phandle); + +int xnregistry_remove(xnhandle_t handle); + +int xnregistry_remove_safe(xnhandle_t handle, + xnticks_t timeout); + +void *xnregistry_get(xnhandle_t handle); + +void *xnregistry_fetch(xnhandle_t handle); + +u_long xnregistry_put(xnhandle_t handle); + #ifdef __cplusplus } #endif +extern struct xnpnode_ops xnregistry_vfile_ops; + +extern struct xnpnode_ops xnregistry_vlink_ops; + #endif /* __KERNEL__ || __XENO_SIM__ */ #endif /* !_XENO_NUCLEUS_REGISTRY_H */ diff --git a/ksrc/nucleus/registry.c b/ksrc/nucleus/registry.c index 4df31ba..08806c8 100644 --- a/ksrc/nucleus/registry.c +++ b/ksrc/nucleus/registry.c @@ -48,17 +48,17 @@ struct xnobject *registry_obj_slots; -static xnqueue_t registry_obj_freeq; /* Free objects. */ +static struct xnqueue registry_obj_freeq; /* Free objects. */ -static xnqueue_t registry_obj_busyq; /* Active and exported objects. */ +static struct xnqueue registry_obj_busyq; /* Active and exported objects. */ static u_long registry_obj_stamp; -static xnobject_t **registry_hash_table; +static struct xnobject **registry_hash_table; static int registry_hash_entries; -static xnsynch_t registry_hash_synch; +static struct xnsynch registry_hash_synch; #ifdef CONFIG_PROC_FS @@ -80,7 +80,7 @@ static DECLARE_WORK_NODATA(registry_proc_work, ®istry_proc_callback); static int registry_proc_apc; -static struct proc_dir_entry *registry_proc_root; +static struct xnvfile_directory registry_vfroot; static int registry_usage_read_proc(char *page, char **start, off_t off, @@ -122,27 +122,26 @@ int xnregistry_init(void) ((n) < sizeof(primes) / sizeof(int) ? \ (n) : sizeof(primes) / sizeof(int) - 1) - int n; + int n, ret; registry_obj_slots = - xnarch_alloc_host_mem(CONFIG_XENO_OPT_REGISTRY_NRSLOTS * sizeof(xnobject_t)); + xnarch_alloc_host_mem(CONFIG_XENO_OPT_REGISTRY_NRSLOTS * sizeof(struct xnobject)); if (registry_obj_slots == NULL) return -ENOMEM; #ifdef CONFIG_PROC_FS - registry_proc_root = create_proc_entry("registry", - S_IFDIR, rthal_proc_root); - if (!registry_proc_root) - return -ENOMEM; + ret = xnvfile_init_dir("registry", ®istry_vfroot, NULL); + if (ret) + return ret; rthal_add_proc_leaf("usage", registry_usage_read_proc, - NULL, NULL, registry_proc_root); + NULL, NULL, registry_vfroot.entry.pde); registry_proc_apc = rthal_apc_alloc("registry_export", ®istry_proc_schedule, NULL); if (registry_proc_apc < 0) { - remove_proc_entry("usage", registry_proc_root); + remove_proc_entry("usage", registry_vfroot.entry.pde); remove_proc_entry("registry", rthal_proc_root); return registry_proc_apc; } @@ -164,14 +163,13 @@ int xnregistry_init(void) registry_hash_entries = primes[obj_hash_max(CONFIG_XENO_OPT_REGISTRY_NRSLOTS / 100)]; - registry_hash_table = - (xnobject_t **) xnarch_alloc_host_mem(sizeof(xnobject_t *) * - registry_hash_entries); + registry_hash_table = xnarch_alloc_host_mem(sizeof(struct xnobject *) * + registry_hash_entries); if (!registry_hash_table) { #ifdef CONFIG_PROC_FS - remove_proc_entry("usage", registry_proc_root); - remove_proc_entry("registry", rthal_proc_root); + remove_proc_entry("usage", registry_vfroot.entry.pde); + xnvfile_destroy_dir(®istry_vfroot); rthal_apc_free(registry_proc_apc); #endif /* CONFIG_PROC_FS */ return -ENOMEM; @@ -188,48 +186,44 @@ int xnregistry_init(void) void xnregistry_cleanup(void) { #ifdef CONFIG_PROC_FS - xnobject_t *ecurr, *enext; + struct xnobject *ecurr, *enext; + struct xnpnode *pnode; int n; for (n = 0; n < registry_hash_entries; n++) for (ecurr = registry_hash_table[n]; ecurr; ecurr = enext) { enext = ecurr->hnext; + pnode = ecurr->pnode; - if (ecurr->pnode == NULL) + if (pnode == NULL) continue; - remove_proc_entry(ecurr->key, ecurr->pnode->dir); + pnode->ops->unexport(ecurr, pnode); - if (--ecurr->pnode->entries > 0) + if (--pnode->entries > 0) continue; - remove_proc_entry(ecurr->pnode->type, - ecurr->pnode->root->dir); - - ecurr->pnode->dir = NULL; + xnvfile_destroy_dir(&pnode->vdir); - if (--ecurr->pnode->root->entries <= 0) { - remove_proc_entry(ecurr->pnode->root->name, - registry_proc_root); - ecurr->pnode->root->dir = NULL; - } + if (--pnode->root->entries == 0) + xnvfile_destroy_dir(&pnode->root->vdir); } #endif /* CONFIG_PROC_FS */ xnarch_free_host_mem(registry_hash_table, - sizeof(xnobject_t *) * registry_hash_entries); + sizeof(struct xnobject *) * registry_hash_entries); xnsynch_destroy(®istry_hash_synch); #ifdef CONFIG_PROC_FS rthal_apc_free(registry_proc_apc); flush_scheduled_work(); - remove_proc_entry("usage", registry_proc_root); - remove_proc_entry("registry", rthal_proc_root); + remove_proc_entry("usage", registry_vfroot.entry.pde); + xnvfile_destroy_dir(®istry_vfroot); #endif /* CONFIG_PROC_FS */ xnarch_free_host_mem(registry_obj_slots, - CONFIG_XENO_OPT_REGISTRY_NRSLOTS * sizeof(xnobject_t)); + CONFIG_XENO_OPT_REGISTRY_NRSLOTS * sizeof(struct xnobject)); } #ifdef CONFIG_PROC_FS @@ -245,35 +239,14 @@ void xnregistry_cleanup(void) * like are hopefully properly handled due to a careful * synchronization of operations across domains. */ -static struct proc_dir_entry *add_proc_link(const char *name, - link_proc_t *link_proc, - void *data, - struct proc_dir_entry *parent) -{ - struct proc_dir_entry *entry; - char target[128]; - - if (link_proc(target, sizeof(target), data) <= 0) - return NULL; - - entry = proc_symlink(name, parent, target); - - if (!entry) - return NULL; - - wrap_proc_dir_entry_owner(entry); - - return entry; -} - static DECLARE_WORK_FUNC(registry_proc_callback) { - struct proc_dir_entry *rdir, *dir, *entry; - const char *root, *type; - xnholder_t *holder; - xnobject_t *object; - xnpnode_t *pnode; - int entries; + struct xnvfile_directory *rdir, *dir; + int entries, rentries, ret; + const char *rname, *type; + struct xnholder *holder; + struct xnobject *object; + struct xnpnode *pnode; spl_t s; xnlock_get_irqsave(&nklock, s); @@ -281,65 +254,49 @@ static DECLARE_WORK_FUNC(registry_proc_callback) while ((holder = getq(®istry_obj_procq)) != NULL) { object = link2xnobj(holder); pnode = object->pnode; - type = pnode->type; - dir = pnode->dir; - rdir = pnode->root->dir; - root = pnode->root->name; + type = pnode->dirname; + dir = &pnode->vdir; + rdir = &pnode->root->vdir; + rname = pnode->root->dirname; - if (object->proc != XNOBJECT_PROC_RESERVED1) + if (object->vfilp != XNOBJECT_PNODE_RESERVED1) goto unexport; registry_exported_objects++; - ++pnode->entries; - object->proc = XNOBJECT_PROC_RESERVED2; + entries = ++pnode->entries; + rentries = pnode->root->entries; + object->vfilp = XNOBJECT_PNODE_RESERVED2; appendq(®istry_obj_busyq, holder); xnlock_put_irqrestore(&nklock, s); - if (!rdir) { + if (rentries == 0) { /* Create the root directory on the fly as needed. */ - rdir = - create_proc_entry(root, S_IFDIR, - registry_proc_root); - - if (!rdir) { - object->proc = NULL; + ret = xnvfile_init_dir(rname, rdir, ®istry_vfroot); + if (ret) goto fail; - } - - pnode->root->dir = rdir; } - if (!dir) { + if (entries == 1) { /* Create the class directory on the fly as needed. */ - dir = create_proc_entry(type, S_IFDIR, rdir); - - if (!dir) { - object->proc = NULL; + ret = xnvfile_init_dir(type, dir, rdir); + if (ret) { + if (rentries == 0) + xnvfile_destroy_dir(rdir); goto fail; } - - pnode->dir = dir; ++pnode->root->entries; } - if (pnode->link_proc) - /* Entry is a symlink to somewhere else. */ - object->proc = add_proc_link(object->key, - pnode->link_proc, - object->objaddr, dir); - else - /* Entry allows to get/set object properties. */ - object->proc = rthal_add_proc_leaf(object->key, - pnode->read_proc, - pnode->write_proc, - object->objaddr, dir); - fail: + ret = pnode->ops->export(object, pnode); + fail: xnlock_get_irqsave(&nklock, s); - if (!object->proc) { - /* On error, pretend that the object has never been - exported. */ + if (ret) { + /* + * On error, pretend that the object was never + * exported. + */ object->pnode = NULL; --pnode->entries; } @@ -348,34 +305,29 @@ static DECLARE_WORK_FUNC(registry_proc_callback) unexport: registry_exported_objects--; - entries = --pnode->entries; - entry = object->proc; - object->proc = NULL; + object->vfilp = NULL; object->pnode = NULL; - - if (entries <= 0) { - pnode->dir = NULL; - - if (--pnode->root->entries <= 0) - pnode->root->dir = NULL; - } + entries = --pnode->entries; + if (entries == 0) + --pnode->root->entries; if (object->objaddr) appendq(®istry_obj_busyq, holder); else - /* Trap the case where we are unexporting an already - unregistered object. */ + /* + * Trap the case where we are unexporting an + * already unregistered object. + */ appendq(®istry_obj_freeq, holder); xnlock_put_irqrestore(&nklock, s); - remove_proc_entry(entry->name, dir); + pnode->ops->unexport(object, pnode); - if (entries <= 0) { - remove_proc_entry(type, rdir); - - if (pnode->root->entries <= 0) - remove_proc_entry(root, registry_proc_root); + if (entries == 0) { + xnvfile_destroy_dir(dir); + if (pnode->root->entries == 0) + xnvfile_destroy_dir(rdir); } xnlock_get_irqsave(&nklock, s); @@ -398,29 +350,114 @@ static void registry_proc_schedule(void *cookie) #endif /* CONFIG_PREEMPT_RT */ } -static inline void registry_proc_export(xnobject_t *object, xnpnode_t *pnode) +static int registry_export_vfile(struct xnobject *object, + struct xnpnode *pnode) { - object->proc = XNOBJECT_PROC_RESERVED1; + struct xnpnode_file *file_desc; + int ret; + + file_desc = container_of(pnode, struct xnpnode_file, node); + object->vfile_u.file.datasz = file_desc->vfile.datasz; + object->vfile_u.file.privsz = file_desc->vfile.privsz; + object->vfile_u.file.ops = file_desc->vfile.ops; + + ret = xnvfile_init(object->key, &object->vfile_u.file, + &pnode->vdir); + if (ret) + return ret; + + object->vfilp = &object->vfile_u.file.entry; + object->vfilp->private = object->objaddr; + + return 0; +} + +static void registry_unexport_vfile(struct xnobject *object, + struct xnpnode *pnode) +{ + xnvfile_destroy(&object->vfile_u.file); +} + +static void registry_touch_vfile(struct xnobject *object) +{ + xnvfile_touch(&object->vfile_u.file); +} + +static int registry_export_vlink(struct xnobject *object, + struct xnpnode *pnode) +{ + struct xnpnode_link *link_desc; + char *link_target; + int ret; + + link_desc = container_of(pnode, struct xnpnode_link, node); + link_target = link_desc->target(object->objaddr); + if (link_target == NULL) + return -ENOMEM; + + ret = xnvfile_init_link(object->key, link_target, + &object->vfile_u.link, &pnode->vdir); + kfree(link_target); + if (ret) + return ret; + + object->vfilp = &object->vfile_u.link.entry; + object->vfilp->private = object->objaddr; + + return 0; +} + +static void registry_unexport_vlink(struct xnobject *object, + struct xnpnode *pnode) +{ + xnvfile_destroy_link(&object->vfile_u.link); +} + +struct xnpnode_ops xnregistry_vfile_ops = { + .export = registry_export_vfile, + .unexport = registry_unexport_vfile, + .touch = registry_touch_vfile, +}; + +struct xnpnode_ops xnregistry_vlink_ops = { + .export = registry_export_vlink, + .unexport = registry_unexport_vlink, +}; + +static inline void registry_export_pnode(struct xnobject *object, + struct xnpnode *pnode) +{ + object->vfilp = XNOBJECT_PNODE_RESERVED1; object->pnode = pnode; removeq(®istry_obj_busyq, &object->link); appendq(®istry_obj_procq, &object->link); rthal_apc_schedule(registry_proc_apc); } -static inline void registry_proc_unexport(xnobject_t *object) +static inline void registry_unexport_pnode(struct xnobject *object) { - if (object->proc != XNOBJECT_PROC_RESERVED1) { + if (object->vfilp != XNOBJECT_PNODE_RESERVED1) { + /* + * In case we preempted a v-file read op, bump the + * object's revtag to make sure the data collection is + * aborted next, if we end up deleting the object + * being read. + */ + if (object->pnode->ops->touch) + object->pnode->ops->touch(object); removeq(®istry_obj_busyq, &object->link); appendq(®istry_obj_procq, &object->link); rthal_apc_schedule(registry_proc_apc); } else { - /* Unexporting before the lower stage has had a chance to - export. Move back the object to the busyq just like if no - export had been requested. */ + /* + * Unexporting before the lower stage has had a chance + * to export. Move back the object to the busyq just + * like if no export had been requested. + */ removeq(®istry_obj_procq, &object->link); appendq(®istry_obj_busyq, &object->link); object->pnode = NULL; - object->proc = NULL; + object->vfilp = NULL; } } @@ -428,7 +465,7 @@ static inline void registry_proc_unexport(xnobject_t *object) static unsigned registry_hash_crunch(const char *key) { - unsigned h = 0, g; + unsigned int h = 0, g; #define HQON 24 /* Higher byte position */ #define HBYTE 0xf0000000 /* Higher nibble on */ @@ -442,9 +479,9 @@ static unsigned registry_hash_crunch(const char *key) return h % registry_hash_entries; } -static inline int registry_hash_enter(const char *key, xnobject_t *object) +static inline int registry_hash_enter(const char *key, struct xnobject *object) { - xnobject_t *ecurr; + struct xnobject *ecurr; unsigned s; object->key = key; @@ -461,10 +498,10 @@ static inline int registry_hash_enter(const char *key, xnobject_t *object) return 0; } -static inline int registry_hash_remove(xnobject_t *object) +static inline int registry_hash_remove(struct xnobject *object) { unsigned s = registry_hash_crunch(object->key); - xnobject_t *ecurr, *eprev; + struct xnobject *ecurr, *eprev; for (ecurr = registry_hash_table[s], eprev = NULL; ecurr != NULL; eprev = ecurr, ecurr = ecurr->hnext) { @@ -481,9 +518,9 @@ static inline int registry_hash_remove(xnobject_t *object) return -ESRCH; } -static xnobject_t *registry_hash_find(const char *key) +static struct xnobject *registry_hash_find(const char *key) { - xnobject_t *ecurr; + struct xnobject *ecurr; for (ecurr = registry_hash_table[registry_hash_crunch(key)]; ecurr != NULL; ecurr = ecurr->hnext) { @@ -521,7 +558,7 @@ static inline unsigned registry_wakeup_sleepers(const char *key) } /** - * @fn int xnregistry_enter(const char *key,void *objaddr,xnhandle_t *phandle,xnpnode_t *pnode) + * @fn int xnregistry_enter(const char *key,void *objaddr,xnhandle_t *phandle,struct xnpnode *pnode) * @brief Register a real-time object. * * This service allocates a new registry slot for an associated @@ -569,28 +606,26 @@ static inline unsigned registry_wakeup_sleepers(const char *key) * Rescheduling: possible. */ -int xnregistry_enter(const char *key, - void *objaddr, xnhandle_t *phandle, xnpnode_t *pnode) +int xnregistry_enter(const char *key, void *objaddr, + xnhandle_t *phandle, struct xnpnode *pnode) { - xnholder_t *holder; - xnobject_t *object; + struct xnholder *holder; + struct xnobject *object; spl_t s; - int err; + int ret; - if (!key || !objaddr || strchr(key, '/')) + if (key == NULL || objaddr == NULL || strchr(key, '/')) return -EINVAL; xnlock_get_irqsave(&nklock, s); holder = getq(®istry_obj_freeq); - - if (!holder) { - err = -ENOMEM; + if (holder == NULL) { + ret = -ENOMEM; goto unlock_and_exit; } object = link2xnobj(holder); - xnsynch_init(&object->safesynch, XNSYNCH_FIFO, NULL); object->objaddr = objaddr; object->cstamp = ++registry_obj_stamp; @@ -598,51 +633,51 @@ int xnregistry_enter(const char *key, #ifdef CONFIG_PROC_FS object->pnode = NULL; #endif - - if (!*key) { + if (*key == '\0') { object->key = NULL; *phandle = object - registry_obj_slots; - err = 0; + ret = 0; goto unlock_and_exit; } - err = registry_hash_enter(key, object); - - if (err) { + ret = registry_hash_enter(key, object); + if (ret) { appendq(®istry_obj_freeq, holder); goto unlock_and_exit; } appendq(®istry_obj_busyq, holder); - /* <!> Make sure the handle is written back before the - rescheduling takes place. */ + /* + * <!> Make sure the handle is written back before the + * rescheduling takes place. + */ *phandle = object - registry_obj_slots; #ifdef CONFIG_PROC_FS if (pnode) - registry_proc_export(object, pnode); + registry_export_pnode(object, pnode); #endif /* CONFIG_PROC_FS */ if (registry_wakeup_sleepers(key)) xnpod_schedule(); - unlock_and_exit: +unlock_and_exit: xnlock_put_irqrestore(&nklock, s); #if XENO_DEBUG(REGISTRY) - if (err) + if (ret) xnlogerr("FAILED to register object %s (%s), status %d\n", key, - pnode ? pnode->type : "unknown type", - err); + pnode ? pnode->dirname : "unknown type", + ret); else if (pnode) xnloginfo("registered exported object %s (%s)\n", - key, pnode->type); + key, pnode->dirname); #endif - return err; + return ret; } EXPORT_SYMBOL_GPL(xnregistry_enter); @@ -714,7 +749,7 @@ EXPORT_SYMBOL_GPL(xnregistry_enter); int xnregistry_bind(const char *key, xnticks_t timeout, int timeout_mode, xnhandle_t *phandle) { - xnobject_t *object; + struct xnobject *object; xnthread_t *thread; xntbase_t *tbase; int err = 0; @@ -767,11 +802,11 @@ int xnregistry_bind(const char *key, xnticks_t timeout, int timeout_mode, #if XENO_DEBUG(REGISTRY) && 0 /* XXX: GCC emits bad code. */ if (err) xnlogerr("FAILED to bind to object %s (%s), status %d\n", - key, object->pnode ? object->pnode->type : "unknown type", + key, object->pnode ? object->pnode->dirname : "unknown type", err); else if (object->pnode) xnloginfo("bound to exported object %s (%s)\n", - key, object->pnode->type); + key, object->pnode->dirname); #endif xnlock_put_irqrestore(&nklock, s); @@ -807,7 +842,7 @@ EXPORT_SYMBOL_GPL(xnregistry_bind); int xnregistry_remove(xnhandle_t handle) { - xnobject_t *object; + struct xnobject *object; int err = 0; spl_t s; @@ -826,7 +861,7 @@ int xnregistry_remove(xnhandle_t handle) if (object->pnode) xnloginfo("unregistered exported object %s (%s)\n", object->key, - object->pnode->type); + object->pnode->dirname); #endif object->objaddr = NULL; @@ -837,7 +872,7 @@ int xnregistry_remove(xnhandle_t handle) #ifdef CONFIG_PROC_FS if (object->pnode) { - registry_proc_unexport(object); + registry_unexport_pnode(object); /* Leave the update of the object queues to the work callback if it has been kicked. */ @@ -914,7 +949,7 @@ EXPORT_SYMBOL_GPL(xnregistry_remove); int xnregistry_remove_safe(xnhandle_t handle, xnticks_t timeout) { - xnobject_t *object; + struct xnobject *object; u_long cstamp; int err = 0; spl_t s; @@ -1023,7 +1058,7 @@ EXPORT_SYMBOL_GPL(xnregistry_remove_safe); void *xnregistry_get(xnhandle_t handle) { - xnobject_t *object; + struct xnobject *object; void *objaddr; spl_t s; @@ -1036,7 +1071,7 @@ void *xnregistry_get(xnhandle_t handle) xnlock_get_irqsave(&nklock, s); object = xnregistry_validate(handle); - if (likely(object)) { + if (likely(object != NULL)) { ++object->safelock; objaddr = object->objaddr; } else @@ -1082,7 +1117,7 @@ EXPORT_SYMBOL_GPL(xnregistry_get); u_long xnregistry_put(xnhandle_t handle) { - xnobject_t *object; + struct xnobject *object; u_long newlock; spl_t s; @@ -1145,8 +1180,8 @@ EXPORT_SYMBOL_GPL(xnregistry_put); void *xnregistry_fetch(xnhandle_t handle) { - if (handle == XNOBJECT_SELF) - return xnpod_primary_p()? xnpod_current_thread() : NULL; + if (handle == XNOBJECT_SELF) + return xnpod_primary_p()? xnpod_current_thread() : NULL; return xnregistry_lookup(handle); } _______________________________________________ Xenomai-git mailing list [email protected] https://mail.gna.org/listinfo/xenomai-git
