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/rfs/rtems-rfs-rtems-dir.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/rfs/rtems-rfs-rtems-dir.c')
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c index 550973db0c..88f71e53a9 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c @@ -150,43 +150,6 @@ rtems_rfs_rtems_dir_read (rtems_libio_t* iop, return bytes_transferred; } -/** - * 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 assert. - * - * @param iop - * @param offset - * @param whence - * return off_t - */ -static off_t -rtems_rfs_rtems_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 */ - break; - - case SEEK_END: /* Movement past the end of the directory via lseek */ - /* is not a permitted operation */ - default: - return rtems_rfs_rtems_error ("dir_lseek: bad whence", EINVAL); - break; - } - return 0; -} - /* * Set of operations handlers for operations on directories. */ @@ -197,7 +160,7 @@ const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers = { .read_h = rtems_rfs_rtems_dir_read, .write_h = rtems_filesystem_default_write, .ioctl_h = rtems_filesystem_default_ioctl, - .lseek_h = rtems_rfs_rtems_dir_lseek, + .lseek_h = rtems_filesystem_default_lseek_directory, .fstat_h = rtems_rfs_rtems_fstat, .ftruncate_h = rtems_filesystem_default_ftruncate_directory, .fsync_h = rtems_filesystem_default_fsync_or_fdatasync, |