diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-07 16:30:37 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-11 13:58:43 +0200 |
commit | 30d412469c930fe4150ad2b9a321eea2747ec6f4 (patch) | |
tree | d91c4bfaa8e968a6da87ba9b5860502758d4a26f /cpukit/libfs/src/imfs/imfs_directory.c | |
parent | pc386 - Clock driver compiles again plus clean up (diff) | |
download | rtems-30d412469c930fe4150ad2b9a321eea2747ec6f4.tar.bz2 |
Filesystem: PR1398: Fix lseek() mechanic
According to POSIX the lseek() function shall not, by itself, extend the
size of a file.
Remove the size field of rtems_libio_t. A file has only one size but
may have multiple open file descriptors. Thus a file size field in the
file descriptor may lead to inconsistencies.
New default handlers rtems_filesystem_default_lseek_file() and
rtems_filesystem_default_lseek_directory().
Diffstat (limited to 'cpukit/libfs/src/imfs/imfs_directory.c')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_directory.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_directory.c b/cpukit/libfs/src/imfs/imfs_directory.c index c6be71ffcc..f77b68bc14 100644 --- a/cpukit/libfs/src/imfs/imfs_directory.c +++ b/cpukit/libfs/src/imfs/imfs_directory.c @@ -99,41 +99,3 @@ ssize_t imfs_dir_read( return bytes_transferred; } - -/* - * imfs_dir_lseek - * - * This routine will behave in one of three ways based on the state of - * argument whence. Based on the state of its value the offset argument will - * be interpreted using one of the following methods: - * - * SEEK_SET - offset is the absolute byte offset from the start of the - * logical start of the dirent sequence that represents the - * directory - * SEEK_CUR - offset is used as the relative byte offset from the current - * directory position index held in the iop structure - * SEEK_END - N/A --> This will cause an EINVAL to be returned. - */ - -off_t imfs_dir_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - switch( whence ) { - case SEEK_SET: /* absolute move from the start of the file */ - case SEEK_CUR: /* relative move */ - iop->offset = (iop->offset/sizeof(struct dirent)) * - sizeof(struct dirent); - break; - - case SEEK_END: /* Movement past the end of the directory via lseek */ - /* is not a permitted operation */ - default: - rtems_set_errno_and_return_minus_one( EINVAL ); - break; - } - - return 0; -} |