[Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-10-13 01:04:43
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv31768/drivers/native Modified Files: fs_native.c Log Message: The IO context record supported one call-back. It now supports a chain. This was changed to accommodate the Sandia-PVFS driver. Also, it's needed for the, coming, {read,write}_strided calls. To add a callback to the chain use: _sysio_ioctx_cb(struct ioctx *ioctx, void (*func)(struct ioctx *, void *), void *data) Callbacks are added to the end of the existing chain. When called, by _sysio_io_complete, they are run in order. So... If you're freeing things using callbacks be careful not to depend on something in a later callback that you previously free'd. Also, _sysio_io_complete no longer waits for the driver. To call this, now, is to signal completion. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- fs_native.c 10 Oct 2003 18:50:31 -0000 1.18 +++ fs_native.c 13 Oct 2003 01:04:34 -0000 1.19 @@ -222,11 +222,9 @@ static int native_inop_link(struct pnode static int native_inop_unlink(struct pnode *pno); static int native_inop_rename(struct pnode *old, struct pnode *new); static int native_inop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int native_inop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int native_inop_iodone(struct ioctx *ioctx); static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap); static int native_inop_sync(struct inode *ino); @@ -1162,11 +1160,9 @@ native_inop_unlink(struct pnode *pno) static int doio(iof f, struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { struct native_inode *nino = I2NI(ino); - struct ioctx *ioctx; #ifndef REDSTORM #if _LARGEFILE64_SOURCE loff_t result; @@ -1177,17 +1173,7 @@ doio(iof f, assert(nino->ni_fd >= 0); - if (ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0) - return -EINVAL; - - /* - * Get a new IO context. - */ - ioctx = _sysio_ioctx_new(ino, ioargs); - if (!ioctx) - return -ENOMEM; - - if ((ioargs->ioarg_iovlen && (int )ioargs->ioarg_iovlen < 0) || + if ((ioctx->ioctx_iovlen && (int )ioctx->ioctx_iovlen < 0) || !(S_ISREG(ino->i_mode) || S_ISCHR(ino->i_mode) || S_ISSOCK(ino->i_mode) || @@ -1259,7 +1245,6 @@ doio(iof f, if (ioctx->ioctx_cc > 0) nino->ni_fpos += ioctx->ioctx_cc; - *ioctxp = ioctx; out: return 0; } @@ -1309,11 +1294,10 @@ out: static int native_inop_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(native_read, ino, ioargs, ioctxp); + return doio(native_read, ino, ioctx); } /* @@ -1337,11 +1321,10 @@ native_write(int fd, const struct iovec static int native_inop_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(native_write, ino, ioargs, ioctxp); + return doio(native_write, ino, ioctx); } static int |