speed-ups using the new constants
[unix-history] / usr / src / sys / kern / vfs_lookup.c
index dc8526d..d42e012 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_lookup.c    4.31    82/11/17        */
+/*     vfs_lookup.c    4.34    82/12/22        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -159,7 +159,7 @@ dirloop2:
         * e.g. like "/." or ".".
         */
        if (u.u_dent.d_name[0] == 0) {
         * e.g. like "/." or ".".
         */
        if (u.u_dent.d_name[0] == 0) {
-               if (flag) {
+               if (flag || lockparent) {
                        u.u_error = ENOENT;
                        goto bad;
                }
                        u.u_error = ENOENT;
                        goto bad;
                }
@@ -723,17 +723,19 @@ blkatoff(ip, offset, res)
  * Inode supplied must be locked.
  */
 dirempty(ip)
  * Inode supplied must be locked.
  */
 dirempty(ip)
-       struct inode *ip;
+       register struct inode *ip;
 {
        register off_t off;
        struct direct dbuf;
        register struct direct *dp = &dbuf;
 {
        register off_t off;
        struct direct dbuf;
        register struct direct *dp = &dbuf;
-       int error;
+       int error, count;
 
        for (off = 0; off < ip->i_size; off += dp->d_reclen) {
                error = rdwri(UIO_READ, ip, (caddr_t)dp,
 
        for (off = 0; off < ip->i_size; off += dp->d_reclen) {
                error = rdwri(UIO_READ, ip, (caddr_t)dp,
-                       sizeof (struct direct), off, 1, (int *)0);
-               if (error)
+                       sizeof (struct direct), off, 1, &count);
+               count = sizeof (struct direct) - count;
+#define        MINDIRSIZ (sizeof (struct direct) - (MAXNAMLEN + 1))
+               if (error || count < MINDIRSIZ || count < DIRSIZ(dp))
                        return (0);
                if (dp->d_ino == 0)
                        continue;
                        return (0);
                if (dp->d_ino == 0)
                        continue;