[rtems commit] IMFS: Improved support for generic nodes
Sebastian Huber
sebh at rtems.org
Tue Jan 21 12:16:20 UTC 2014
Module: rtems
Branch: master
Commit: 5b34e7ada4c9645cbfaf855d9b9300fa3075bff5
Changeset: http://git.rtems.org/rtems/commit/?id=5b34e7ada4c9645cbfaf855d9b9300fa3075bff5
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jan 16 13:05:13 2014 +0100
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 f4025eb..cdf4cf9 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 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 ) {
More information about the vc
mailing list