diff options
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/include/rtems/libio.h | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/read.c | 8 | ||||
-rw-r--r-- | cpukit/libcsupport/src/readv.c | 1 | ||||
-rw-r--r-- | cpukit/libcsupport/src/sup_fs_deviceio.c | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/write.c | 8 | ||||
-rw-r--r-- | cpukit/libcsupport/src/writev.c | 1 |
6 files changed, 10 insertions, 16 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 9268aed2e1..b42ff93dec 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -786,6 +786,8 @@ typedef int (*rtems_filesystem_close_t)( /** * @brief Reads from a node. * + * This handler is responsible to update the offset field of the IO descriptor. + * * @param[in, out] iop The IO pointer. * @param[out] buffer The buffer for read data. * @param[in] count The size of the buffer in characters. @@ -804,6 +806,8 @@ typedef ssize_t (*rtems_filesystem_read_t)( /** * @brief Writes to a node. * + * This handler is responsible to update the offset field of the IO descriptor. + * * @param[in, out] iop The IO pointer. * @param[out] buffer The buffer for write data. * @param[in] count The size of the buffer in characters. diff --git a/cpukit/libcsupport/src/read.c b/cpukit/libcsupport/src/read.c index 759133b0cb..ee10166dc8 100644 --- a/cpukit/libcsupport/src/read.c +++ b/cpukit/libcsupport/src/read.c @@ -22,7 +22,6 @@ ssize_t read( size_t count ) { - ssize_t rc; rtems_libio_t *iop; rtems_libio_check_fd( fd ); @@ -35,12 +34,7 @@ ssize_t read( /* * Now process the read(). */ - rc = (*iop->pathinfo.handlers->read_h)( iop, buffer, count ); - - if ( rc > 0 ) - iop->offset += rc; - - return rc; + return (*iop->pathinfo.handlers->read_h)( iop, buffer, count ); } /* diff --git a/cpukit/libcsupport/src/readv.c b/cpukit/libcsupport/src/readv.c index b23abd0b82..4e540d5da4 100644 --- a/cpukit/libcsupport/src/readv.c +++ b/cpukit/libcsupport/src/readv.c @@ -106,7 +106,6 @@ ssize_t readv( return -1; if ( bytes > 0 ) { - iop->offset += bytes; total += bytes; } diff --git a/cpukit/libcsupport/src/sup_fs_deviceio.c b/cpukit/libcsupport/src/sup_fs_deviceio.c index aeff60ea83..74f92cb44c 100644 --- a/cpukit/libcsupport/src/sup_fs_deviceio.c +++ b/cpukit/libcsupport/src/sup_fs_deviceio.c @@ -72,6 +72,8 @@ ssize_t rtems_deviceio_read( status = rtems_io_read( major, minor, &args ); if ( status == RTEMS_SUCCESSFUL ) { + iop->offset += args.bytes_moved; + return (ssize_t) args.bytes_moved; } else { return rtems_deviceio_errno( status ); @@ -98,6 +100,8 @@ ssize_t rtems_deviceio_write( status = rtems_io_write( major, minor, &args ); if ( status == RTEMS_SUCCESSFUL ) { + iop->offset += args.bytes_moved; + return (ssize_t) args.bytes_moved; } else { return rtems_deviceio_errno( status ); diff --git a/cpukit/libcsupport/src/write.c b/cpukit/libcsupport/src/write.c index b74738845b..dc1255867d 100644 --- a/cpukit/libcsupport/src/write.c +++ b/cpukit/libcsupport/src/write.c @@ -29,7 +29,6 @@ ssize_t write( size_t count ) { - ssize_t rc; rtems_libio_t *iop; rtems_libio_check_fd( fd ); @@ -42,10 +41,5 @@ ssize_t write( /* * Now process the write() request. */ - rc = (*iop->pathinfo.handlers->write_h)( iop, buffer, count ); - - if ( rc > 0 ) - iop->offset += rc; - - return rc; + return (*iop->pathinfo.handlers->write_h)( iop, buffer, count ); } diff --git a/cpukit/libcsupport/src/writev.c b/cpukit/libcsupport/src/writev.c index 8356c1ee66..47605a4cd9 100644 --- a/cpukit/libcsupport/src/writev.c +++ b/cpukit/libcsupport/src/writev.c @@ -113,7 +113,6 @@ ssize_t writev( return -1; if ( bytes > 0 ) { - iop->offset += bytes; total += bytes; } |