diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-12-21 20:12:28 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-01-22 07:52:40 +0100 |
commit | c625a641218fbda23582354b3cfc7a7c7a4e4287 (patch) | |
tree | 82853d039ebb88fb4e7afe0b572c1d072a3f4d00 /cpukit/libcsupport/src | |
parent | powerpc: Fix AltiVec VSCR save/restore (diff) | |
download | rtems-c625a641218fbda23582354b3cfc7a7c7a4e4287.tar.bz2 |
Filesystem: Delete node type operation
Use the fstat handler instead.
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r-- | cpukit/libcsupport/src/__usrenv.c | 1 | ||||
-rw-r--r-- | cpukit/libcsupport/src/chdir.c | 5 | ||||
-rw-r--r-- | cpukit/libcsupport/src/chroot.c | 7 | ||||
-rw-r--r-- | cpukit/libcsupport/src/getdents.c | 6 | ||||
-rw-r--r-- | cpukit/libcsupport/src/open.c | 5 | ||||
-rw-r--r-- | cpukit/libcsupport/src/readlink.c | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/rmdir.c | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/sup_fs_node_type.c | 39 |
8 files changed, 13 insertions, 58 deletions
diff --git a/cpukit/libcsupport/src/__usrenv.c b/cpukit/libcsupport/src/__usrenv.c index d032aea4ab..8fd107e011 100644 --- a/cpukit/libcsupport/src/__usrenv.c +++ b/cpukit/libcsupport/src/__usrenv.c @@ -203,7 +203,6 @@ static const rtems_filesystem_operations_table null_ops = { .eval_path_h = rtems_filesystem_default_eval_path, .link_h = null_op_link, .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal, - .node_type_h = rtems_filesystem_default_node_type, .mknod_h = null_op_mknod, .rmnod_h = null_op_rmnod, .fchmod_h = null_op_fchmod, diff --git a/cpukit/libcsupport/src/chdir.c b/cpukit/libcsupport/src/chdir.c index 2a1c3c4806..4bcb30075e 100644 --- a/cpukit/libcsupport/src/chdir.c +++ b/cpukit/libcsupport/src/chdir.c @@ -30,10 +30,9 @@ int rtems_filesystem_chdir( rtems_filesystem_location_info_t *loc ) int rv = 0; rtems_filesystem_global_location_t *global_loc = rtems_filesystem_location_transform_to_global( loc ); - rtems_filesystem_node_types_t type = - rtems_filesystem_node_type( &global_loc->location ); + mode_t type = rtems_filesystem_location_type( &global_loc->location ); - if ( type == RTEMS_FILESYSTEM_DIRECTORY ) { + if ( S_ISDIR( type ) ) { rtems_filesystem_global_location_assign( &rtems_filesystem_current, global_loc diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c index e1f83d34ab..b7c2891f6a 100644 --- a/cpukit/libcsupport/src/chroot.c +++ b/cpukit/libcsupport/src/chroot.c @@ -54,12 +54,9 @@ int chroot( const char *path ) if ( !rtems_filesystem_global_location_is_null( new_current_loc ) ) { rtems_filesystem_global_location_t *new_root_loc = rtems_filesystem_global_location_obtain( &new_current_loc ); - rtems_filesystem_node_types_t type = - (*new_root_loc->location.mt_entry->ops->node_type_h)( - &new_root_loc->location - ); + mode_t type = rtems_filesystem_location_type( &new_root_loc->location ); - if ( type == RTEMS_FILESYSTEM_DIRECTORY ) { + if ( S_ISDIR( type ) ) { sc = rtems_libio_set_private_env(); if (sc == RTEMS_SUCCESSFUL) { rtems_filesystem_global_location_assign( diff --git a/cpukit/libcsupport/src/getdents.c b/cpukit/libcsupport/src/getdents.c index be1969faa4..7008def316 100644 --- a/cpukit/libcsupport/src/getdents.c +++ b/cpukit/libcsupport/src/getdents.c @@ -47,7 +47,7 @@ int getdents( ) { rtems_libio_t *iop; - rtems_filesystem_node_types_t type; + mode_t type; /* * Get the file control block structure associated with the file descriptor @@ -57,8 +57,8 @@ int getdents( /* * Make sure we are working on a directory */ - type = rtems_filesystem_node_type( &iop->pathinfo ); - if ( type != RTEMS_FILESYSTEM_DIRECTORY ) + type = rtems_filesystem_location_type( &iop->pathinfo ); + if ( !S_ISDIR( type ) ) rtems_set_errno_and_return_minus_one( ENOTDIR ); /* diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c index 042d405f1d..399b5a4eac 100644 --- a/cpukit/libcsupport/src/open.c +++ b/cpukit/libcsupport/src/open.c @@ -89,10 +89,9 @@ static int do_open( if ( write_access ) { const rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_get_currentloc( &ctx ); - rtems_filesystem_node_types_t type = - (*currentloc->mt_entry->ops->node_type_h)( currentloc ); + mode_t type = rtems_filesystem_location_type( currentloc ); - if ( type == RTEMS_FILESYSTEM_DIRECTORY ) { + if ( S_ISDIR( type ) ) { rtems_filesystem_eval_path_error( &ctx, EISDIR ); } } diff --git a/cpukit/libcsupport/src/readlink.c b/cpukit/libcsupport/src/readlink.c index a43cb2cdf9..71a9d0d726 100644 --- a/cpukit/libcsupport/src/readlink.c +++ b/cpukit/libcsupport/src/readlink.c @@ -34,9 +34,9 @@ ssize_t readlink( const char *__restrict path, char *__restrict buf, const rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_start( &ctx, path, eval_flags ); const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops; - rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc ); + mode_t type = rtems_filesystem_location_type( currentloc ); - if ( type == RTEMS_FILESYSTEM_SYM_LINK ) { + if ( S_ISLNK( type ) ) { rv = (*ops->readlink_h)( currentloc, buf, bufsize ); } else { rtems_filesystem_eval_path_error( &ctx, EINVAL ); diff --git a/cpukit/libcsupport/src/rmdir.c b/cpukit/libcsupport/src/rmdir.c index 50c41d5f74..8aec6f784e 100644 --- a/cpukit/libcsupport/src/rmdir.c +++ b/cpukit/libcsupport/src/rmdir.c @@ -43,9 +43,9 @@ int rmdir( const char *path ) parent_eval_flags ); const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops; - rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc ); + mode_t type = rtems_filesystem_location_type( currentloc ); - if ( type == RTEMS_FILESYSTEM_DIRECTORY ) { + if ( S_ISDIR( type ) ) { if ( !rtems_filesystem_location_is_instance_root( currentloc ) ) { rv = (*ops->rmnod_h)( &parentloc, currentloc ); } else { diff --git a/cpukit/libcsupport/src/sup_fs_node_type.c b/cpukit/libcsupport/src/sup_fs_node_type.c deleted file mode 100644 index a86d08e56d..0000000000 --- a/cpukit/libcsupport/src/sup_fs_node_type.c +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file - * - * @brief Returns the Type of a Node - * @ingroup LibIOInternal - */ - -/* - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H - #include "config.h" -#endif - -#include <rtems/libio_.h> - -rtems_filesystem_node_types_t rtems_filesystem_node_type( - const rtems_filesystem_location_info_t *loc -) -{ - rtems_filesystem_node_types_t type; - - rtems_filesystem_instance_lock(loc); - type = (*loc->mt_entry->ops->node_type_h)(loc); - rtems_filesystem_instance_unlock(loc); - - return type; -} |