diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-12-31 10:56:05 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-01-27 06:54:22 +0100 |
commit | cf36b70e8dd8755e7dac6eb516169f586e78566d (patch) | |
tree | 97200818ec5dfeaa4e137a572fcbb4db746842b1 /cpukit/libfs/src/imfs/imfs_make_generic_node.c | |
parent | user/conf.t: Fix typo (diff) | |
download | rtems-cf36b70e8dd8755e7dac6eb516169f586e78566d.tar.bz2 |
IMFS: Replace node union with individual struct
This reduces the average node size.
Add and use IMFS_GENERIC_INITIALIZER().
Diffstat (limited to 'cpukit/libfs/src/imfs/imfs_make_generic_node.c')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_make_generic_node.c | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_make_generic_node.c b/cpukit/libfs/src/imfs/imfs_make_generic_node.c index c054a48faa..1daef3e215 100644 --- a/cpukit/libfs/src/imfs/imfs_make_generic_node.c +++ b/cpukit/libfs/src/imfs/imfs_make_generic_node.c @@ -29,10 +29,12 @@ IMFS_jnode_t *IMFS_node_initialize_generic( IMFS_jnode_t *node, - const IMFS_types_union *info + void *arg ) { - node->info.generic.context = info->generic.context; + IMFS_generic_t *generic = (IMFS_generic_t *) node; + + generic->context = arg; return node; } @@ -72,45 +74,36 @@ int IMFS_make_generic_node( } if ( rv == 0 ) { - if ( node_control->imfs_type == IMFS_GENERIC ) { - rtems_filesystem_eval_path_context_t ctx; - int eval_flags = RTEMS_FS_FOLLOW_LINK - | RTEMS_FS_MAKE - | RTEMS_FS_EXCLUSIVE; - const rtems_filesystem_location_info_t *currentloc = - rtems_filesystem_eval_path_start( &ctx, path, eval_flags ); - - if ( IMFS_is_imfs_instance( currentloc ) ) { - IMFS_types_union info; - IMFS_jnode_t *new_node; - - info.generic.context = context; - new_node = IMFS_create_node_with_control( - currentloc, - node_control, - rtems_filesystem_eval_path_get_token( &ctx ), - rtems_filesystem_eval_path_get_tokenlen( &ctx ), - mode, - &info - ); - - if ( new_node != NULL ) { - IMFS_jnode_t *parent = currentloc->node_access; - - IMFS_mtime_ctime_update( parent ); - } else { - rv = -1; - } + rtems_filesystem_eval_path_context_t ctx; + int eval_flags = RTEMS_FS_FOLLOW_LINK + | RTEMS_FS_MAKE + | RTEMS_FS_EXCLUSIVE; + const rtems_filesystem_location_info_t *currentloc = + rtems_filesystem_eval_path_start( &ctx, path, eval_flags ); + + if ( IMFS_is_imfs_instance( currentloc ) ) { + IMFS_jnode_t *new_node = IMFS_create_node_with_control( + currentloc, + node_control, + rtems_filesystem_eval_path_get_token( &ctx ), + rtems_filesystem_eval_path_get_tokenlen( &ctx ), + mode, + context + ); + + if ( new_node != NULL ) { + IMFS_jnode_t *parent = currentloc->node_access; + + IMFS_mtime_ctime_update( parent ); } else { - rtems_filesystem_eval_path_error( &ctx, ENOTSUP ); rv = -1; } - - rtems_filesystem_eval_path_cleanup( &ctx ); } else { - errno = EINVAL; + rtems_filesystem_eval_path_error( &ctx, ENOTSUP ); rv = -1; } + + rtems_filesystem_eval_path_cleanup( &ctx ); } return rv; |