From 5b34e7ada4c9645cbfaf855d9b9300fa3075bff5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 16 Jan 2014 13:05:13 +0100 Subject: [PATCH] IMFS: Improved support for generic nodes The rtems_filesystem_location_info_t::node_access_2 was unused by the IMFS. Use it to hold the context of generic nodes. This makes it possible to use node handlers for objects with and without a corresponding file system node. For example network sockets created with socket() have only a file descriptor, but no corresponding file system node. The UNIX(4) domain sockets can be bound to file system nodes. In both cases the rtems_filesystem_location_info_t must provide a pointer to the socket structure used by the socket node handlers. With the context pointer (for sockets, this is the socket structure) in rtems_filesystem_location_info_t::node_access_2 the same node handlers can be used in both cases. --- cpukit/libfs/src/imfs/imfs.h | 4 +--- cpukit/libfs/src/imfs/imfs_eval.c | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h index f4025ebc5a..cdf4cf9d3e 100644 --- a/cpukit/libfs/src/imfs/imfs.h +++ b/cpukit/libfs/src/imfs/imfs.h @@ -980,9 +980,7 @@ static inline void *IMFS_generic_get_context_by_location( const rtems_filesystem_location_info_t *loc ) { - const IMFS_jnode_t *node = (const IMFS_jnode_t *) loc->node_access; - - return IMFS_generic_get_context_by_node( node ); + return loc->node_access_2; } static inline void *IMFS_generic_get_context_by_iop( diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c index 9e2ebae653..530739069a 100644 --- a/cpukit/libfs/src/imfs/imfs_eval.c +++ b/cpukit/libfs/src/imfs/imfs_eval.c @@ -134,6 +134,8 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token( --dir->reference_count; ++entry->reference_count; currentloc->node_access = entry; + currentloc->node_access_2 = + IMFS_generic_get_context_by_node( entry ); IMFS_Set_handlers( currentloc ); if ( !terminal ) {