diff options
author | swallace <swallace@FreeBSD.org> | 1995-10-10 23:13:27 +0000 |
---|---|---|
committer | swallace <swallace@FreeBSD.org> | 1995-10-10 23:13:27 +0000 |
commit | 02d471bd8d6d4eac0b1abc4a8db46321a14e7b71 (patch) | |
tree | de2ad668f6112b8b7a1e565e6984c0eae9a48e56 /sys/compat | |
parent | c4598e0910b5a262c66fa89d9001a592ba1960c4 (diff) | |
download | FreeBSD-src-02d471bd8d6d4eac0b1abc4a8db46321a14e7b71.zip FreeBSD-src-02d471bd8d6d4eac0b1abc4a8db46321a14e7b71.tar.gz |
Fix the getdirentries of ibcs2 to handle uneven DIRBLKSIZ offsets.
Slight modification from previous fix.
Also, fix problem where an entry would be skipped next call if not enough room
in buffer current call.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_file.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 03f22a9..b851d29 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_file.c,v 1.1 1995/06/25 17:32:34 sos Exp $ + * $Id: linux_file.c,v 1.2 1995/08/28 00:50:08 swallace Exp $ */ #include <i386/linux/linux.h> @@ -359,7 +359,7 @@ linux_readdir(struct proc *p, struct linux_readdir_args *args, int *retval) if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) { return error; - } + } nbytes = args->count; if (nbytes == 1) { @@ -370,8 +370,9 @@ linux_readdir(struct proc *p, struct linux_readdir_args *args, int *retval) justone = 0; off = fp->f_offset; - blockoff = off % va.va_blocksize; - buflen = max(va.va_blocksize, (nbytes + blockoff)); + blockoff = off % DIRBLKSIZ; + buflen = max(DIRBLKSIZ, nbytes + blockoff); + buflen = min(buflen, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); again: @@ -385,7 +386,7 @@ again: auio.uio_resid = buflen; auio.uio_offset = off - (off_t)blockoff; - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, 0, 0); if (error) { goto out; } @@ -407,9 +408,9 @@ again: goto out; } - off += reclen; if (bdp->d_fileno == 0) { inp += reclen; + off += reclen; len -= reclen; continue; } @@ -426,6 +427,7 @@ again: goto out; } inp += reclen; + off += reclen; outp += linuxreclen; resid -= linuxreclen; len -= reclen; |