[PATCH] IMFS: Improved support for generic nodes

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jan 16 12:17:04 UTC 2014


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 file 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 file system node handlers.  With the
context pointer (for sockets, this is the socket structure) in
rtems_filesystem_location_info_t::node_access_2 the same file node
handlers can be used in both cases.
---
 cpukit/libfs/src/imfs/imfs_eval.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c
index 9e2ebae..5307390 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 ) {
-- 
1.7.7




More information about the devel mailing list