diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-14 15:21:30 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-15 10:01:42 +0200 |
commit | 53da07e436df21f078de665d90442ee5c7166ab7 (patch) | |
tree | 0249d3ca4e181c677f243907a754dd1e8518bb36 /cpukit/libfs/src/imfs/memfile.c | |
parent | Filesystem: Add shared device IO support (diff) | |
download | rtems-53da07e436df21f078de665d90442ee5c7166ab7.tar.bz2 |
Filesystem: PR1255: Move offset update to handlers
It is now the responsibility of the read() and write() handler to update
the offset field of the IO descriptor (rtems_libio_t). This change
makes it possible to protect the IO descriptor from concurrent access by
per file locks.
Diffstat (limited to 'cpukit/libfs/src/imfs/memfile.c')
-rw-r--r-- | cpukit/libfs/src/imfs/memfile.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c index fcbeed96b3..2eb7949275 100644 --- a/cpukit/libfs/src/imfs/memfile.c +++ b/cpukit/libfs/src/imfs/memfile.c @@ -121,10 +121,16 @@ ssize_t memfile_read( ) { IMFS_jnode_t *the_jnode; + ssize_t status; the_jnode = iop->pathinfo.node_access; - return IMFS_memfile_read( the_jnode, iop->offset, buffer, count ); + status = IMFS_memfile_read( the_jnode, iop->offset, buffer, count ); + + if ( status > 0 ) + iop->offset += status; + + return status; } /* @@ -148,6 +154,9 @@ ssize_t memfile_write( status = IMFS_memfile_write( the_jnode, iop->offset, buffer, count ); + if ( status > 0 ) + iop->offset += status; + return status; } |