readdir now returns an eof indication
[unix-history] / usr / src / sys / ufs / lfs / lfs_vnops.c
index 247e9d0..f434a61 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_vnops.c 7.31 (Berkeley) %G%
+ *     @(#)lfs_vnops.c 7.33 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -1245,10 +1245,11 @@ ufs_symlink(ndp, vap, target)
 /*
  * Vnode op for read and write
  */
 /*
  * Vnode op for read and write
  */
-ufs_readdir(vp, uio, cred)
+ufs_readdir(vp, uio, cred, eofflagp)
        struct vnode *vp;
        register struct uio *uio;
        struct ucred *cred;
        struct vnode *vp;
        register struct uio *uio;
        struct ucred *cred;
+       int *eofflagp;
 {
        int count, lost, error;
 
 {
        int count, lost, error;
 
@@ -1261,6 +1262,10 @@ ufs_readdir(vp, uio, cred)
        uio->uio_iov->iov_len = count;
        error = ufs_read(vp, uio, 0, cred);
        uio->uio_resid += lost;
        uio->uio_iov->iov_len = count;
        error = ufs_read(vp, uio, 0, cred);
        uio->uio_resid += lost;
+       if ((VTOI(vp)->i_size - uio->uio_offset) <= 0)
+               *eofflagp = 1;
+       else
+               *eofflagp = 0;
        return (error);
 }
 
        return (error);
 }
 
@@ -1416,9 +1421,13 @@ ufs_print(vp)
 {
        register struct inode *ip = VTOI(vp);
 
 {
        register struct inode *ip = VTOI(vp);
 
-       printf("tag VT_UFS, ino %d, on dev %d, %d%s\n", ip->i_number,
-               major(ip->i_dev), minor(ip->i_dev),
-               (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
+       printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
+               major(ip->i_dev), minor(ip->i_dev));
+#ifdef FIFO
+       if (vp->v_type == VFIFO)
+               fifo_printinfo(vp);
+#endif /* FIFO */
+       printf("%s\n", (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
        if (ip->i_spare0 == 0)
                return;
        printf("\towner pid %d", ip->i_spare0);
        if (ip->i_spare0 == 0)
                return;
        printf("\towner pid %d", ip->i_spare0);