diff options
| author | mycroft <mycroft@NetBSD.org> | 1995-06-10 22:19:06 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1995-06-10 22:19:06 +0000 |
| commit | 1e1e52e395ce80ee2874b10f4fa5ce7ff756c008 (patch) | |
| tree | fd6ae3155f17414a47ffe3bb3481b70477bbb456 /sys/compat/linux | |
| parent | c049178b0359207044566bf78eeb33b05905aff5 (diff) | |
Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
Diffstat (limited to 'sys/compat/linux')
19 files changed, 226 insertions, 226 deletions
diff --git a/sys/compat/linux/common/linux_break.c b/sys/compat/linux/common/linux_break.c index e4b0315d409..0bc1348a01b 100644 --- a/sys/compat/linux/common/linux_break.c +++ b/sys/compat/linux/common/linux_break.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_break.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_break.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_dirent.h b/sys/compat/linux/common/linux_dirent.h index 48d47c5a332..6b8b01dacd6 100644 --- a/sys/compat/linux/common/linux_dirent.h +++ b/sys/compat/linux/common/linux_dirent.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dirent.h,v 1.1 1995/02/28 23:25:31 fvdl Exp $ */ +/* $NetBSD: linux_dirent.h,v 1.2 1995/06/10 22:19:06 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -37,13 +37,13 @@ #define LINUX_NAME_MAX 255 struct linux_dirent { - long l_dino; - linux_off_t l_doff; - unsigned short l_dreclen; - char l_dname[LINUX_NAME_MAX + 1]; + long d_ino; + linux_off_t d_off; + unsigned short d_reclen; + char d_name[LINUX_NAME_MAX + 1]; }; -#define LINUX_NAMEOFF(dp) ((char *)&(dp)->l_dname - (char *)dp) +#define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp) #define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1)) #endif /* _LINUX_DIRENT_H */ diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index 28a846ae86e..9109c6496ca 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_misc.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_misc_notalpha.c b/sys/compat/linux/common/linux_misc_notalpha.c index c422843e53d..11710e762f5 100644 --- a/sys/compat/linux/common/linux_misc_notalpha.c +++ b/sys/compat/linux/common/linux_misc_notalpha.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc_notalpha.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_misc_notalpha.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_oldmmap.c b/sys/compat/linux/common/linux_oldmmap.c index f9509979b95..ee5f4fb0c6f 100644 --- a/sys/compat/linux/common/linux_oldmmap.c +++ b/sys/compat/linux/common/linux_oldmmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldmmap.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldmmap.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_oldolduname.c b/sys/compat/linux/common/linux_oldolduname.c index 70fc03d6f7b..74e2c43b5bb 100644 --- a/sys/compat/linux/common/linux_oldolduname.c +++ b/sys/compat/linux/common/linux_oldolduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldolduname.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldolduname.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_oldselect.c b/sys/compat/linux/common/linux_oldselect.c index e64b3ae30b2..0850965ed31 100644 --- a/sys/compat/linux/common/linux_oldselect.c +++ b/sys/compat/linux/common/linux_oldselect.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldselect.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldselect.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_olduname.c b/sys/compat/linux/common/linux_olduname.c index 6b9b69e52ef..20b3e371f76 100644 --- a/sys/compat/linux/common/linux_olduname.c +++ b/sys/compat/linux/common/linux_olduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_olduname.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_olduname.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_pipe.c b/sys/compat/linux/common/linux_pipe.c index acd699025cf..8a3bdd88015 100644 --- a/sys/compat/linux/common/linux_pipe.c +++ b/sys/compat/linux/common/linux_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_pipe.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_pipe.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/include/linux_dirent.h b/sys/compat/linux/include/linux_dirent.h index 48d47c5a332..6b8b01dacd6 100644 --- a/sys/compat/linux/include/linux_dirent.h +++ b/sys/compat/linux/include/linux_dirent.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dirent.h,v 1.1 1995/02/28 23:25:31 fvdl Exp $ */ +/* $NetBSD: linux_dirent.h,v 1.2 1995/06/10 22:19:06 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -37,13 +37,13 @@ #define LINUX_NAME_MAX 255 struct linux_dirent { - long l_dino; - linux_off_t l_doff; - unsigned short l_dreclen; - char l_dname[LINUX_NAME_MAX + 1]; + long d_ino; + linux_off_t d_off; + unsigned short d_reclen; + char d_name[LINUX_NAME_MAX + 1]; }; -#define LINUX_NAMEOFF(dp) ((char *)&(dp)->l_dname - (char *)dp) +#define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp) #define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1)) #endif /* _LINUX_DIRENT_H */ diff --git a/sys/compat/linux/linux_dirent.h b/sys/compat/linux/linux_dirent.h index 48d47c5a332..6b8b01dacd6 100644 --- a/sys/compat/linux/linux_dirent.h +++ b/sys/compat/linux/linux_dirent.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dirent.h,v 1.1 1995/02/28 23:25:31 fvdl Exp $ */ +/* $NetBSD: linux_dirent.h,v 1.2 1995/06/10 22:19:06 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -37,13 +37,13 @@ #define LINUX_NAME_MAX 255 struct linux_dirent { - long l_dino; - linux_off_t l_doff; - unsigned short l_dreclen; - char l_dname[LINUX_NAME_MAX + 1]; + long d_ino; + linux_off_t d_off; + unsigned short d_reclen; + char d_name[LINUX_NAME_MAX + 1]; }; -#define LINUX_NAMEOFF(dp) ((char *)&(dp)->l_dname - (char *)dp) +#define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp) #define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1)) #endif /* _LINUX_DIRENT_H */ diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 28a846ae86e..9109c6496ca 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_misc.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_break.c b/sys/compat/linux/multiarch/linux_break.c index e4b0315d409..0bc1348a01b 100644 --- a/sys/compat/linux/multiarch/linux_break.c +++ b/sys/compat/linux/multiarch/linux_break.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_break.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_break.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_misc_notalpha.c b/sys/compat/linux/multiarch/linux_misc_notalpha.c index c422843e53d..11710e762f5 100644 --- a/sys/compat/linux/multiarch/linux_misc_notalpha.c +++ b/sys/compat/linux/multiarch/linux_misc_notalpha.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc_notalpha.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_misc_notalpha.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_oldmmap.c b/sys/compat/linux/multiarch/linux_oldmmap.c index f9509979b95..ee5f4fb0c6f 100644 --- a/sys/compat/linux/multiarch/linux_oldmmap.c +++ b/sys/compat/linux/multiarch/linux_oldmmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldmmap.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldmmap.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_oldolduname.c b/sys/compat/linux/multiarch/linux_oldolduname.c index 70fc03d6f7b..74e2c43b5bb 100644 --- a/sys/compat/linux/multiarch/linux_oldolduname.c +++ b/sys/compat/linux/multiarch/linux_oldolduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldolduname.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldolduname.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_oldselect.c b/sys/compat/linux/multiarch/linux_oldselect.c index e64b3ae30b2..0850965ed31 100644 --- a/sys/compat/linux/multiarch/linux_oldselect.c +++ b/sys/compat/linux/multiarch/linux_oldselect.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_oldselect.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_oldselect.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_olduname.c b/sys/compat/linux/multiarch/linux_olduname.c index 6b9b69e52ef..20b3e371f76 100644 --- a/sys/compat/linux/multiarch/linux_olduname.c +++ b/sys/compat/linux/multiarch/linux_olduname.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_olduname.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_olduname.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/multiarch/linux_pipe.c b/sys/compat/linux/multiarch/linux_pipe.c index acd699025cf..8a3bdd88015 100644 --- a/sys/compat/linux/multiarch/linux_pipe.c +++ b/sys/compat/linux/multiarch/linux_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_pipe.c,v 1.4 1995/03/22 05:24:47 mycroft Exp $ */ +/* $NetBSD: linux_pipe.c,v 1.5 1995/06/10 22:19:14 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -643,7 +643,7 @@ linux_readdir(p, uap, retval) if ((fp->f_flag & FREAD) == 0) return (EBADF); - vp = (struct vnode *) fp->f_data; + vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */ return (EINVAL); @@ -654,12 +654,12 @@ linux_readdir(p, uap, retval) nbytes = SCARG(uap, count); if (nbytes == 1) { /* Need this for older Linux libs, apparently */ nbytes = sizeof (struct linux_dirent); + buflen = max(va.va_blocksize, nbytes); justone = 1; - } - else + } else { + buflen = min(MAXBSIZE, nbytes); justone = 0; - - buflen = max(va.va_blocksize, nbytes); + } buf = malloc(buflen, M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; @@ -677,7 +677,7 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *) 0, 0); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); if (error) goto out; @@ -688,11 +688,11 @@ again: goto eof; for (; len > 0; len -= reclen) { - reclen = ((struct dirent *) inp)->d_reclen; + bdp = (struct dirent *)inp; + reclen = bdp->d_reclen; if (reclen & 3) panic("linux_readdir"); off += reclen; /* each entry points to next */ - bdp = (struct dirent *) inp; if (bdp->d_fileno == 0) { inp += reclen; /* it is a hole; squish it out */ continue; @@ -708,10 +708,10 @@ again: * we have to worry about touching user memory outside of * the copyout() call). */ - idb.l_dino = (long) bdp->d_fileno; - idb.l_doff = (linux_off_t) linuxreclen; - idb.l_dreclen = (u_short) bdp->d_namlen; /* sigh */ - strcpy(idb.l_dname, bdp->d_name); + idb.d_ino = (long)bdp->d_fileno; + idb.d_off = (linux_off_t)linuxreclen; + idb.d_reclen = (u_short)bdp->d_namlen; + strcpy(idb.d_name, bdp->d_name); if ((error = copyout((caddr_t)&idb, outp, linuxreclen))) goto out; /* advance past this real entry */ |
