[Libsysio-commit] HEAD: libsysio/src read.c write.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-09-17 16:33:58
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv23866 Modified Files: read.c write.c Log Message: Allan Porterfield from Cray reported that pread/pwrite and (by inspection) our derivatives updated the file pointer when IO completed. This is not correct. POSIX defines these operations such that no update should be made to that value. Fixed to comply. Index: read.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/read.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- read.c 14 Aug 2003 18:39:33 -0000 1.3 +++ read.c 17 Sep 2003 16:33:53 -0000 1.4 @@ -57,9 +57,10 @@ * Schedule asynchronous read of iovec at some file extent. */ static struct ioctx * -do_ipreadv(struct file *fil, +do_ixreadv(struct file *fil, const struct iovec *iov, size_t count, - off_t offset) + off_t offset, + void (*fcompletio)(struct ioctx *)) { struct inode *ino; int err; @@ -82,7 +83,7 @@ do_ipreadv(struct file *fil, IOARG_INIT(&ioarguments, iov, count, offset, - (void (*)(void *))_sysio_fcompletio, fil); + (void (*)(void *))fcompletio, fil); err = ino->i_ops.inop_ipreadv(fil->f_ino, &ioarguments, &ioctx); if (err) { errno = -err; @@ -106,7 +107,7 @@ ipreadv(int fd, const struct iovec *iov, return IOID_FAIL; } - ioctxp = do_ipreadv(fil, iov, count, offset); + ioctxp = do_ixreadv(fil, iov, count, offset, NULL); return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; } @@ -168,7 +169,7 @@ ireadv(int fd, const struct iovec *iov, return IOID_FAIL; } - ioctxp = do_ipreadv(fil, iov, count, fil->f_pos); + ioctxp = do_ixreadv(fil, iov, count, fil->f_pos, _sysio_fcompletio); if (!ioctxp) return IOID_FAIL; return ioctxp->ioctx_id; Index: write.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/write.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- write.c 14 Aug 2003 18:39:33 -0000 1.3 +++ write.c 17 Sep 2003 16:33:54 -0000 1.4 @@ -59,9 +59,10 @@ * Schedule asynchronous write of iovec at some file extent. */ static struct ioctx * -do_ipwritev(struct file *fil, +do_ixwritev(struct file *fil, const struct iovec *iov, size_t count, - off_t offset) + off_t offset, + void (*fcompletio)(struct ioctx *)) { struct inode *ino; int err; @@ -88,7 +89,7 @@ do_ipwritev(struct file *fil, IOARG_INIT(&ioarguments, iov, count, offset, - (void (*)(void *))_sysio_fcompletio, fil); + (void (*)(void *))fcompletio, fil); err = ino->i_ops.inop_ipwritev(fil->f_ino, &ioarguments, &ioctx); if (err) { errno = -err; @@ -112,7 +113,7 @@ ipwritev(int fd, const struct iovec *iov return IOID_FAIL; } - ioctxp = do_ipwritev(fil, iov, count, offset); + ioctxp = do_ixwritev(fil, iov, count, offset, NULL); return ioctxp ? ioctxp->ioctx_id : IOID_FAIL; } @@ -174,7 +175,7 @@ iwritev(int fd, const struct iovec *iov, return IOID_FAIL; } - ioctxp = do_ipwritev(fil, iov, count, fil->f_pos); + ioctxp = do_ixwritev(fil, iov, count, fil->f_pos, _sysio_fcompletio); if (!ioctxp) return IOID_FAIL; return ioctxp->ioctx_id; |