diff options
Diffstat (limited to 'cpukit/libfs/src/dosfs')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos.h | 12 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_dir.c | 32 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_file.c | 54 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_handlers_dir.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_handlers_file.c | 2 |
5 files changed, 3 insertions, 99 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos.h b/cpukit/libfs/src/dosfs/msdos.h index 9bdfd881ec..a7aff1d96d 100644 --- a/cpukit/libfs/src/dosfs/msdos.h +++ b/cpukit/libfs/src/dosfs/msdos.h @@ -286,12 +286,6 @@ ssize_t msdos_file_write( size_t count /* IN */ ); -off_t msdos_file_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - int msdos_file_stat( const rtems_filesystem_location_info_t *loc, struct stat *buf @@ -322,12 +316,6 @@ ssize_t msdos_dir_read( size_t count /* IN */ ); -off_t msdos_dir_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - int msdos_dir_sync(rtems_libio_t *iop); int msdos_dir_stat( diff --git a/cpukit/libfs/src/dosfs/msdos_dir.c b/cpukit/libfs/src/dosfs/msdos_dir.c index 67a0bdaaa9..be6b5a91ff 100644 --- a/cpukit/libfs/src/dosfs/msdos_dir.c +++ b/cpukit/libfs/src/dosfs/msdos_dir.c @@ -465,38 +465,6 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count) * no write for directory */ -/* msdos_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 assert. - * - * PARAMETERS: - * iop - file control block - * offset - offset - * whence - predefine directive - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno - * set apropriately). - */ -off_t -msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence) -{ - if (iop->offset >= 0 && iop->offset <= iop->size) { - return 0; - } else { - rtems_set_errno_and_return_minus_one(EINVAL); - } -} - /* msdos_dir_stat -- * * This routine will obtain the following information concerning the current diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c index 7cd55b0494..c2db196c77 100644 --- a/cpukit/libfs/src/dosfs/msdos_file.c +++ b/cpukit/libfs/src/dosfs/msdos_file.c @@ -64,8 +64,6 @@ msdos_file_open(rtems_libio_t *iop, const char *pathname, int oflag, if (iop->flags & LIBIO_FLAGS_APPEND) iop->offset = fat_fd->fat_file_size; - iop->size = fat_fd->fat_file_size; - rtems_semaphore_release(fs_info->vol_sema); return RC_OK; } @@ -203,60 +201,10 @@ msdos_file_write(rtems_libio_t *iop,const void *buffer, size_t count) if (iop->offset + ret > fat_fd->fat_file_size) fat_fd->fat_file_size = iop->offset + ret; - iop->size = fat_fd->fat_file_size; - rtems_semaphore_release(fs_info->vol_sema); return ret; } -/* msdos_file_lseek -- - * Process lseek call to the file: extend file if lseek is up to the end - * of the file. - * - * PARAMETERS: - * iop - file control block - * offset - new offset - * whence - predefine directive - * - * RETURNS: - * new offset on success, or -1 if error occured (errno set - * appropriately). - */ -off_t -msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->pathinfo.node_access; - uint32_t real_size = 0; - - if (iop->offset < 0 || iop->offset > UINT32_MAX) { - rtems_set_errno_and_return_minus_one(EINVAL); - } - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); - - rc = fat_file_extend(iop->pathinfo.mt_entry, fat_fd, iop->offset, - &real_size); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (real_size > fat_fd->fat_file_size) - fat_fd->fat_file_size = iop->offset = real_size; - - iop->size = fat_fd->fat_file_size; - - rtems_semaphore_release(fs_info->vol_sema); - return iop->offset; -} - /* msdos_file_stat -- * * PARAMETERS: @@ -332,7 +280,7 @@ msdos_file_ftruncate(rtems_libio_t *iop, off_t length) * file size only if length < fat-file size */ if (length < fat_fd->fat_file_size) - iop->size = fat_fd->fat_file_size = length; + fat_fd->fat_file_size = length; rtems_semaphore_release(fs_info->vol_sema); return RC_OK; diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c index 193d796dd9..eeaa77d15e 100644 --- a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c +++ b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c @@ -24,7 +24,7 @@ const rtems_filesystem_file_handlers_r msdos_dir_handlers = { msdos_dir_read, rtems_filesystem_default_write, rtems_filesystem_default_ioctl, - msdos_dir_lseek, + rtems_filesystem_default_lseek_directory, msdos_dir_stat, rtems_filesystem_default_ftruncate_directory, msdos_dir_sync, diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_file.c b/cpukit/libfs/src/dosfs/msdos_handlers_file.c index fefb6795d9..e68a09f1d3 100644 --- a/cpukit/libfs/src/dosfs/msdos_handlers_file.c +++ b/cpukit/libfs/src/dosfs/msdos_handlers_file.c @@ -24,7 +24,7 @@ const rtems_filesystem_file_handlers_r msdos_file_handlers = { msdos_file_read, msdos_file_write, rtems_filesystem_default_ioctl, - msdos_file_lseek, + rtems_filesystem_default_lseek_file, msdos_file_stat, msdos_file_ftruncate, msdos_file_sync, |