diff options
Diffstat (limited to 'cpukit/libfs/src/imfs')
-rw-r--r-- | cpukit/libfs/src/imfs/deviceio.c | 17 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/imfs.h | 18 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_directory.c | 38 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_handlers_device.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_handlers_directory.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_handlers_memfile.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/imfs/memfile.c | 35 |
7 files changed, 5 insertions, 109 deletions
diff --git a/cpukit/libfs/src/imfs/deviceio.c b/cpukit/libfs/src/imfs/deviceio.c index c4e7a921ff..f18c9e7cee 100644 --- a/cpukit/libfs/src/imfs/deviceio.c +++ b/cpukit/libfs/src/imfs/deviceio.c @@ -192,23 +192,6 @@ int device_ioctl( } /* - * device_lseek - * - * This handler eats all lseek() operations and does not create - * an error. It assumes all devices can handle the seek. The - * writes fail. - */ - -off_t device_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - return offset; -} - -/* * device_stat * * The IMFS_stat() is used. diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h index dd7c158383..daad052f9d 100644 --- a/cpukit/libfs/src/imfs/imfs.h +++ b/cpukit/libfs/src/imfs/imfs.h @@ -418,12 +418,6 @@ extern ssize_t imfs_dir_read( size_t count /* IN */ ); -extern off_t imfs_dir_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - extern int memfile_open( rtems_libio_t *iop, /* IN */ const char *pathname, /* IN */ @@ -449,12 +443,6 @@ extern int memfile_ioctl( void *buffer /* IN */ ); -extern off_t memfile_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - extern int device_open( rtems_libio_t *iop, /* IN */ const char *pathname, /* IN */ @@ -484,12 +472,6 @@ extern int device_ioctl( void *buffer /* IN */ ); -extern off_t device_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - extern int device_ftruncate( rtems_libio_t *iop, /* IN */ off_t length /* IN */ 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; -} diff --git a/cpukit/libfs/src/imfs/imfs_handlers_device.c b/cpukit/libfs/src/imfs/imfs_handlers_device.c index dfbd8949c5..fe3973df05 100644 --- a/cpukit/libfs/src/imfs/imfs_handlers_device.c +++ b/cpukit/libfs/src/imfs/imfs_handlers_device.c @@ -36,7 +36,7 @@ static const rtems_filesystem_file_handlers_r IMFS_device_handlers = { device_read, device_write, device_ioctl, - device_lseek, + rtems_filesystem_default_lseek_file, IMFS_stat_device, device_ftruncate, rtems_filesystem_default_fsync_or_fdatasync, diff --git a/cpukit/libfs/src/imfs/imfs_handlers_directory.c b/cpukit/libfs/src/imfs/imfs_handlers_directory.c index 9c3f77416a..579fdec2ea 100644 --- a/cpukit/libfs/src/imfs/imfs_handlers_directory.c +++ b/cpukit/libfs/src/imfs/imfs_handlers_directory.c @@ -52,7 +52,7 @@ static const rtems_filesystem_file_handlers_r IMFS_directory_handlers = { imfs_dir_read, rtems_filesystem_default_write, rtems_filesystem_default_ioctl, - imfs_dir_lseek, + rtems_filesystem_default_lseek_directory, IMFS_stat_directory, rtems_filesystem_default_ftruncate_directory, rtems_filesystem_default_fsync_or_fdatasync_success, diff --git a/cpukit/libfs/src/imfs/imfs_handlers_memfile.c b/cpukit/libfs/src/imfs/imfs_handlers_memfile.c index 57d488af6f..262b93aa2a 100644 --- a/cpukit/libfs/src/imfs/imfs_handlers_memfile.c +++ b/cpukit/libfs/src/imfs/imfs_handlers_memfile.c @@ -36,7 +36,7 @@ static const rtems_filesystem_file_handlers_r IMFS_memfile_handlers = { memfile_read, memfile_write, memfile_ioctl, - memfile_lseek, + rtems_filesystem_default_lseek_file, IMFS_stat_file, memfile_ftruncate, rtems_filesystem_default_fsync_or_fdatasync_success, diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c index d2cff01517..64679df037 100644 --- a/cpukit/libfs/src/imfs/memfile.c +++ b/cpukit/libfs/src/imfs/memfile.c @@ -109,7 +109,6 @@ int memfile_open( if (iop->flags & LIBIO_FLAGS_APPEND) iop->offset = the_jnode->info.file.size; - iop->size = the_jnode->info.file.size; return 0; } @@ -148,7 +147,6 @@ ssize_t memfile_write( the_jnode = iop->pathinfo.node_access; status = IMFS_memfile_write( the_jnode, iop->offset, buffer, count ); - iop->size = the_jnode->info.file.size; return status; } @@ -170,34 +168,6 @@ int memfile_ioctl( } /* - * memfile_lseek - * - * This routine processes the lseek() system call. - */ -off_t memfile_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->pathinfo.node_access; - - if (IMFS_type( the_jnode ) == IMFS_LINEAR_FILE) { - if (iop->offset > the_jnode->info.linearfile.size) - iop->offset = the_jnode->info.linearfile.size; - } - else { /* Must be a block file (IMFS_MEMORY_FILE). */ - if (IMFS_memfile_extend( the_jnode, iop->offset )) - rtems_set_errno_and_return_minus_one( ENOSPC ); - - iop->size = the_jnode->info.file.size; - } - return iop->offset; -} - -/* * memfile_stat * * This IMFS_stat() can be used. @@ -232,7 +202,6 @@ int memfile_ftruncate( * future use and just set the length. */ the_jnode->info.file.size = length; - iop->size = the_jnode->info.file.size; IMFS_update_atime( the_jnode ); @@ -265,7 +234,7 @@ MEMFILE_STATIC int IMFS_memfile_extend( * Verify new file size is supported */ if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE ) - rtems_set_errno_and_return_minus_one( EINVAL ); + rtems_set_errno_and_return_minus_one( EFBIG ); /* * Verify new file size is actually larger than current size @@ -654,7 +623,7 @@ MEMFILE_STATIC ssize_t IMFS_memfile_write( if ( last_byte > the_jnode->info.file.size ) { status = IMFS_memfile_extend( the_jnode, last_byte ); if ( status ) - rtems_set_errno_and_return_minus_one( ENOSPC ); + return status; } copied = 0; |