[Libsysio-commit] HEAD: libsysio/src ioctx.c
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2004-03-11 15:07:35
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7290/src Modified Files: ioctx.c Log Message: Fixing buf in enumerate_extents. Added a somewhat less trivial test for strided I/O to test suite. Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- ioctx.c 1 Mar 2004 19:03:46 -0000 1.11 +++ ioctx.c 11 Mar 2004 14:40:52 -0000 1.12 @@ -372,6 +372,10 @@ _sysio_enumerate_extents(const struct in } while (xtvec.xtv_len) { if (iovec.iov_len) { + tmp = iovec.iov_len; + if (iovec.iov_len > xtvec.xtv_len) { + iovec.iov_len = xtvec.xtv_len; + } cc = (*f)(&iovec, 1, xtvec.xtv_off, @@ -383,7 +387,7 @@ _sysio_enumerate_extents(const struct in return cc; } iovec.iov_base = (char *)iovec.iov_base + cc; - iovec.iov_len -= cc; + iovec.iov_len = tmp - cc; tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ @@ -403,8 +407,11 @@ _sysio_enumerate_extents(const struct in } while (--iovlen); if (iov == start) { iovec = *iov++; - if (iovec.iov_len > n) +#if 0 + if (iovec.iov_len > n) { iovec.iov_len = n; + } +#endif continue; } remain = xtvec.xtv_len - n; @@ -418,11 +425,16 @@ _sysio_enumerate_extents(const struct in return acc; return cc; } - remain -= cc; + tmp = cc + acc; if (acc && tmp <= acc) abort(); /* paranoia */ acc = tmp; + + if (remain && !iovlen) + return acc; + + remain -= cc; if (remain) return acc; /* short */ } |