[Libsysio-commit] HEAD: libsysio/dev/stdfd stdfd.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-10-13 01:04:43
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1:/tmp/cvs-serv31768/dev/stdfd Modified Files: stdfd.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: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- stdfd.c 10 Oct 2003 18:50:30 -0000 1.5 +++ stdfd.c 13 Oct 2003 01:04:34 -0000 1.6 @@ -79,11 +79,9 @@ static int stdfd_open(struct pnode *pno, int flags, mode_t mode); static int stdfd_close(struct inode *ino); static int stdfd_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int stdfd_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp); + struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); static int stdfd_datasync(struct inode *ino); static int stdfd_ioctl(struct inode *ino, @@ -128,18 +126,12 @@ stdfd_close(struct inode *ino __IS_UNUSE static int doio(ssize_t (*f)(int, char *, size_t), struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - struct ioctx *ioctx; const struct iovec *iov; size_t n; ssize_t cc = 0; - ioctx = _sysio_ioctx_new(ino, ioargs); - if (!ioctx) - return -ENOMEM; - iov = ioctx->ioctx_iovec; for (n = ioctx->ioctx_iovlen, iov = ioctx->ioctx_iovec; n--; @@ -159,7 +151,6 @@ doio(ssize_t (*f)(int, char *, size_t), ioctx->ioctx_errno = -cc; } - *ioctxp = ioctx; return 0; } @@ -172,11 +163,10 @@ stdfd_read(int fd, char *buf, size_t nby static int stdfd_ipreadv(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { - return doio(stdfd_read, ino, ioargs, ioctxp); + return doio(stdfd_read, ino, ioctx); } static ssize_t @@ -190,14 +180,12 @@ stdfd_write(int fd, static int stdfd_ipwritev(struct inode *ino, - struct io_arguments *ioargs, - struct ioctx **ioctxp) + struct ioctx *ioctx) { return doio((ssize_t (*)(int, char *, size_t))stdfd_write, ino, - ioargs, - ioctxp); + ioctx); } static int |