Thread: [Libsysio-commit] strided-io: libsysio/src rw.c
Brought to you by:
lward
|
From: Lee W. <lw...@us...> - 2004-01-27 22:06:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10878/src Modified Files: Tag: strided-io rw.c Log Message: With the integration and rewrite of read.c and write.c, needed to go back and put the SYIO_{ENTER,LEAVE} pairs. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -w -b -B -p -r1.1.2.3 -r1.1.2.4 --- rw.c 26 Jan 2004 07:24:29 -0000 1.1.2.3 +++ rw.c 27 Jan 2004 22:05:23 -0000 1.1.2.4 @@ -250,15 +250,19 @@ ireadv(int fd, const struct iovec *iov, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } xtv = malloc(sizeof(struct intnl_xtvec)); - if (!xtv) + if (!xtv) { + SYSIO_LEAVE; return IOID_FAIL; + } err = _sysio_iiov(fil->f_ino->i_ops.inop_read, fil, @@ -268,8 +272,10 @@ ireadv(int fd, const struct iovec *iov, if (err) { free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -281,9 +287,11 @@ readv(int fd, const struct iovec *iov, i struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -295,8 +303,10 @@ readv(int fd, const struct iovec *iov, i &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -322,15 +332,19 @@ iread(int fd, void *buf, size_t count) struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } iov = malloc(sizeof(struct iovec)); - if (!iov) + if (!iov) { + SYSIO_LEAVE; return IOID_FAIL; + } iov->iov_base = buf; iov->iov_len = count; xtv = malloc(sizeof(struct intnl_xtvec)); @@ -340,6 +354,7 @@ iread(int fd, void *buf, size_t count) oerrno = errno; free(iov); errno = oerrno; + SYSIO_LEAVE; return IOID_FAIL; } err = @@ -352,8 +367,10 @@ iread(int fd, void *buf, size_t count) free(xtv); free(iov); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -366,9 +383,11 @@ read(int fd, void *buf, size_t count) int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -382,8 +401,10 @@ read(int fd, void *buf, size_t count) &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -414,9 +435,12 @@ _sysio_ipiov(ssize_t (*f)(struct inode * ssize_t cc; int err; + SYSIO_ENTER; cc = _sysio_sum_iovec(iov, count); - if (cc < 0) + if (cc < 0) { + SYSIO_LEAVE; return (int )-cc; + } xtv->xtv_off = off, xtv->xtv_len = cc; err = @@ -426,6 +450,7 @@ _sysio_ipiov(ssize_t (*f)(struct inode * xtv, 1, xtv_free, NULL, ioctxp); + SYSIO_LEAVE; if (err) return err; return 0; @@ -439,15 +464,19 @@ _ipreadv(int fd, const struct iovec *iov struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } xtv = malloc(sizeof(struct intnl_xtvec)); - if (!xtv) + if (!xtv) { + SYSIO_LEAVE; return IOID_FAIL; + } err = _sysio_ipiov(fil->f_ino->i_ops.inop_read, fil, @@ -458,8 +487,10 @@ _ipreadv(int fd, const struct iovec *iov if (err) { free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -483,9 +514,11 @@ _preadv(int fd, const struct iovec *iov, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -498,8 +531,10 @@ _preadv(int fd, const struct iovec *iov, &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -524,9 +559,11 @@ _ipread(int fd, void *buf, size_t count, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } @@ -553,8 +590,10 @@ error: if (xtv) free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -579,9 +618,11 @@ _pread(int fd, void *buf, size_t count, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -597,8 +638,10 @@ _pread(int fd, void *buf, size_t count, &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -623,9 +666,11 @@ _ireadx(int fd, int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!(fil && xtv_count)) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } @@ -638,8 +683,10 @@ _ireadx(int fd, &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -660,15 +707,19 @@ ireadx(int fd, int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_WRONLY); if (!(fil && xtv_count)) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); - if (!ixtv) + if (!ixtv) { + SYSIO_LEAVE; return IOID_FAIL; + } count = xtv_count; while (count--) { ixtvent->xtv_off = xtv->xtv_off; @@ -687,8 +738,10 @@ ireadx(int fd, if (err) { free(ixtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } #else @@ -747,15 +800,19 @@ iwritev(int fd, const struct iovec *iov, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } xtv = malloc(sizeof(struct intnl_xtvec)); - if (!xtv) + if (!xtv) { + SYSIO_LEAVE; return IOID_FAIL; + } err = _sysio_iiov(fil->f_ino->i_ops.inop_write, fil, @@ -765,8 +822,10 @@ iwritev(int fd, const struct iovec *iov, if (err) { free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -778,9 +837,11 @@ writev(int fd, const struct iovec *iov, struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -792,8 +853,10 @@ writev(int fd, const struct iovec *iov, &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -811,15 +874,19 @@ iwrite(int fd, const void *buf, size_t c struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } iov = malloc(sizeof(struct iovec)); - if (!iov) + if (!iov) { + SYSIO_LEAVE; return IOID_FAIL; + } iov->iov_base = (void *)buf; iov->iov_len = count; xtv = malloc(sizeof(struct intnl_xtvec)); @@ -829,6 +896,7 @@ iwrite(int fd, const void *buf, size_t c oerrno = errno; free(iov); errno = oerrno; + SYSIO_LEAVE; return IOID_FAIL; } err = @@ -841,8 +909,10 @@ iwrite(int fd, const void *buf, size_t c free(xtv); free(iov); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -855,9 +925,11 @@ write(int fd, const void *buf, size_t co int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -871,8 +943,10 @@ write(int fd, const void *buf, size_t co &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -894,15 +968,19 @@ _ipwritev(int fd, const struct iovec *io struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } xtv = malloc(sizeof(struct intnl_xtvec)); - if (!xtv) + if (!xtv) { + SYSIO_LEAVE; return IOID_FAIL; + } err = _sysio_ipiov(fil->f_ino->i_ops.inop_write, fil, @@ -913,8 +991,10 @@ _ipwritev(int fd, const struct iovec *io if (err) { free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -938,9 +1018,11 @@ _pwritev(int fd, const struct iovec *iov struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -953,8 +1035,10 @@ _pwritev(int fd, const struct iovec *iov &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -979,9 +1063,11 @@ _ipwrite(int fd, const void *buf, size_t struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } @@ -1008,8 +1094,10 @@ error: if (xtv) free(xtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -1034,9 +1122,11 @@ _pwrite(int fd, const void *buf, size_t struct ioctx *ioctx; int err; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!fil) { errno = EBADF; + SYSIO_LEAVE; return -1; } @@ -1052,8 +1142,10 @@ _pwrite(int fd, const void *buf, size_t &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return -1; } + SYSIO_LEAVE; return _sysio_ioctx_wait(ioctx); } @@ -1078,9 +1170,11 @@ _iwritex(int fd, int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!(fil && xtv_count)) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } @@ -1093,8 +1187,10 @@ _iwritex(int fd, &ioctx); if (err) { errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } @@ -1115,15 +1211,19 @@ iwritex(int fd, int err; struct ioctx *ioctx; + SYSIO_ENTER; fil = _sysio_fd_find_capable(fd, O_RDONLY); if (!(fil && xtv_count)) { errno = EBADF; + SYSIO_LEAVE; return IOID_FAIL; } ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); - if (!ixtv) + if (!ixtv) { + SYSIO_LEAVE; return IOID_FAIL; + } count = xtv_count; while (count--) { ixtvent->xtv_off = xtv->xtv_off; @@ -1142,8 +1242,10 @@ iwritex(int fd, if (err) { free(ixtv); errno = -err; + SYSIO_LEAVE; return IOID_FAIL; } + SYSIO_LEAVE; return ioctx->ioctx_id; } #else |
|
From: Lee W. <lw...@us...> - 2004-01-28 04:50:43
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11915/src Modified Files: Tag: strided-io rw.c Log Message: Need proper aliases for REDSTORM due to rewrite and integration of {read,write}.c Much more lenient than before. No BSD support any longer and we always want the GLIBC symbols, REDSTORM or no. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -w -b -B -p -r1.1.2.4 -r1.1.2.5 --- rw.c 27 Jan 2004 22:05:23 -0000 1.1.2.4 +++ rw.c 28 Jan 2004 04:49:35 -0000 1.1.2.5 @@ -310,9 +310,11 @@ readv(int fd, const struct iovec *iov, i return _sysio_ioctx_wait(ioctx); } -#if defined(BSD) || defined(REDSTORM) -#undef _readv -sysio_sym_weak_alias(readv, _readv) +#if defined(__GLIBC__) +#undef __readv +sysio_sym_weak_alias(readv, __readv) +#undef __libc_readv +sysio_sym_weak_alias(readv, __libc_readv) #endif static void @@ -411,11 +413,8 @@ read(int fd, void *buf, size_t count) #ifdef __GLIBC__ #undef __read sysio_sym_weak_alias(read, __read) -#endif - -#if defined(BSD) || defined(REDSTORM) -#undef _read -sysio_sym_weak_alias(read, _read) +#undef __libc_read +sysio_sym_weak_alias(read, __libc_read) #endif /* @@ -648,6 +647,12 @@ _pread(int fd, void *buf, size_t count, #if _LARGEFILE64_SOURCE #undef pread64 sysio_sym_weak_alias(_pread, pread64) +#if __GLIBC__ +#undef __pread64 +sysio_sym_weak_alias(_pread, __pread64) +#undef __libc_pread64 +sysio_sym_weak_alias(_pread, __libc_pread64) +#endif #endif ssize_t @@ -657,6 +662,13 @@ pread(int fd, void *buf, size_t count, o return _pread(fd, buf, count, offset); } +#if __GLIBC__ +#undef _pread +sysio_sym_weak_alias(pread, __pread) +#undef __libc_pread +sysio_sym_weak_alias(pread, __libc_pread) +#endif + static ioid_t _ireadx(int fd, const struct iovec *iov, size_t iov_count, @@ -749,7 +761,6 @@ ireadx(int fd, sysio_sym_weak_alias(_ireadx, ireadx) #endif -#undef readx ssize_t readx(int fd, const struct iovec *iov, size_t iov_count, @@ -860,9 +871,11 @@ writev(int fd, const struct iovec *iov, return _sysio_ioctx_wait(ioctx); } -#if defined(BSD) || defined(REDSTORM) -#undef _writev -sysio_sym_weak_alias(writev, _writev) +#ifdef __GLIBC__ +#undef __writev +sysio_sym_weak_alias(writev, __writev) +#undef __libc_writev +sysio_sym_weak_alias(writev, __libc_writev) #endif ioid_t @@ -953,11 +966,8 @@ write(int fd, const void *buf, size_t co #ifdef __GLIBC__ #undef __write sysio_sym_weak_alias(write, __write) -#endif - -#if defined(BSD) || defined(REDSTORM) -#undef _write -sysio_sym_weak_alias(write, _write) +#undef __libc_write +sysio_sym_weak_alias(write, __libc_write) #endif static ioid_t @@ -1152,6 +1162,12 @@ _pwrite(int fd, const void *buf, size_t #if _LARGEFILE64_SOURCE #undef pwrite64 sysio_sym_weak_alias(_pwrite, pwrite64) +#ifdef __GLIBC +#undef __pwrite64 +sysio_sym_weak_alias(_pwrite, __pwrite64) +#undef __libc_pwrite64 +sysio_sym_weak_alias(_pwrite, __libc_pwrite64) +#endif #endif ssize_t @@ -1161,6 +1177,11 @@ pwrite(int fd, const void *buf, size_t c return _pwrite(fd, buf, count, offset); } +#ifdef __GLIBC +#undef __libc_pwrite +sysio_sym_weak_alias(pwrite, __libc_pwrite) +#endif + static ioid_t _iwritex(int fd, const struct iovec *iov, size_t iov_count, |
|
From: Sonja T. <so...@us...> - 2004-01-31 02:57:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3213/src Modified Files: Tag: strided-io rw.c Log Message: Fixed bug in iwrite and iread where the byte count was being passed in as the iovec count Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -w -b -B -p -r1.1.2.5 -r1.1.2.6 --- rw.c 28 Jan 2004 04:49:35 -0000 1.1.2.5 +++ rw.c 29 Jan 2004 18:45:49 -0000 1.1.2.6 @@ -362,7 +362,7 @@ iread(int fd, void *buf, size_t count) err = _sysio_iiov(fil->f_ino->i_ops.inop_read, fil, - iov, count, free_iov, + iov, 1, free_iov, xtv, free_xtv, &ioctx); if (err) { @@ -915,7 +915,7 @@ iwrite(int fd, const void *buf, size_t c err = _sysio_iiov(fil->f_ino->i_ops.inop_write, fil, - iov, count, free_iov, + iov, 1, free_iov, xtv, free_xtv, &ioctx); if (err) { |
|
From: Lee W. <lw...@us...> - 2004-02-02 16:24:36
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28435 Modified Files: Tag: strided-io rw.c Log Message: The free_xtv() routine would free the iovec, instead of the xtvec. From Sonja Tideman. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -w -b -B -p -r1.1.2.6 -r1.1.2.7 --- rw.c 29 Jan 2004 18:45:49 -0000 1.1.2.6 +++ rw.c 2 Feb 2004 16:22:32 -0000 1.1.2.7 @@ -238,7 +238,7 @@ static void free_xtv(struct ioctx *ioctx) { - free((struct iovec *)ioctx->ioctx_iov); + free((struct iovec *)ioctx->ioctx_xtv); ioctx->ioctx_iov = NULL; } |
|
From: Ruth K. <rk...@us...> - 2004-02-04 17:42:30
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23082 Modified Files: Tag: strided-io rw.c Log Message: type mismatch causing warnings on alpha Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/Attic/rw.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -w -b -B -p -r1.1.2.7 -r1.1.2.8 --- rw.c 2 Feb 2004 16:22:32 -0000 1.1.2.7 +++ rw.c 4 Feb 2004 17:40:02 -0000 1.1.2.8 @@ -81,7 +81,7 @@ * passing them in a structure. */ static int -_sysio_iiox(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_iiox(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, size_t iov_count, @@ -195,7 +195,7 @@ _sysio_sum_iovec(const struct iovec *iov * Asynch IO from/to iovec from/to current file offset. */ static int -_sysio_iiov(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_iiov(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, int count, @@ -421,7 +421,7 @@ sysio_sym_weak_alias(read, __libc_read) * Asynch IO between iovec and data at the given offset. */ static int -_sysio_ipiov(ssize_t (*f)(struct inode *, struct ioctx *), +_sysio_ipiov(int (*f)(struct inode *, struct ioctx *), struct file *fil, const struct iovec *iov, int count, |