diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-05 11:51:23 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-13 12:24:16 +0100 |
commit | e998c9851848691e98b1b1043d8d90c06215961b (patch) | |
tree | 63d021d81016111ac527541fda7a54f9e7d2d108 /cpukit/libfs/src/imfs/imfs_handlers_link.c | |
parent | IMFS: Generic device identifier (diff) | |
download | rtems-e998c9851848691e98b1b1043d8d90c06215961b.tar.bz2 |
IMFS: Node specific stat handlers
Diffstat (limited to '')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_handlers_link.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_handlers_link.c b/cpukit/libfs/src/imfs/imfs_handlers_link.c index 08dddb701d..c1d772c53b 100644 --- a/cpukit/libfs/src/imfs/imfs_handlers_link.c +++ b/cpukit/libfs/src/imfs/imfs_handlers_link.c @@ -18,6 +18,28 @@ #include "imfs.h" #include <stdlib.h> +#include <string.h> + +static int IMFS_stat_link( + const rtems_filesystem_location_info_t *loc, + struct stat *buf +) +{ + const IMFS_jnode_t *node = loc->node_access; + + if ( IMFS_type( node ) != IMFS_HARD_LINK ) { + buf->st_size = strlen( node->info.sym_link.name ); + + return IMFS_stat( loc, buf ); + } else { + rtems_filesystem_location_info_t targetloc = *loc; + + targetloc.node_access = node->info.hard_link.link_node; + IMFS_Set_handlers( &targetloc ); + + return (targetloc.handlers->fstat_h)( &targetloc, buf ); + } +} static const rtems_filesystem_file_handlers_r IMFS_link_handlers = { rtems_filesystem_default_open, @@ -26,7 +48,7 @@ static const rtems_filesystem_file_handlers_r IMFS_link_handlers = { rtems_filesystem_default_write, rtems_filesystem_default_ioctl, rtems_filesystem_default_lseek, - IMFS_stat, /* stat */ + IMFS_stat_link, rtems_filesystem_default_ftruncate, rtems_filesystem_default_fsync_or_fdatasync, rtems_filesystem_default_fsync_or_fdatasync, |