symlinks are OK if not being followed
[unix-history] / usr / src / sys / ufs / ufs / ufs_vnops.c
index 638eb1f..076f951 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 7.75 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.79 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 int ufs_chmod __P((struct vnode *, int, struct proc *));
 int ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
 
 int ufs_chmod __P((struct vnode *, int, struct proc *));
 int ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
 
-enum vtype iftovt_tab[16] = {
-       VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
-       VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,
-};
-int    vttoif_tab[9] = {
-       0, IFREG, IFDIR, IFBLK, IFCHR, IFLNK, IFSOCK, IFIFO, IFMT,
-};
-
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
 #define        SETLOW(q, l)    (q).val[_QUAD_LOWWORD] = (l)
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
 #define        SETLOW(q, l)    (q).val[_QUAD_LOWWORD] = (l)
@@ -685,9 +677,6 @@ relookup(dvp, vpp, cnp)
 #ifdef DIAGNOSTIC
                if (*vpp != NULL)
                        panic("leaf should be empty");
 #ifdef DIAGNOSTIC
                if (*vpp != NULL)
                        panic("leaf should be empty");
-#endif
-#ifdef NAMEI_DIAGNOSTIC
-               printf("not found\n");
 #endif
                if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
                    error != ENOENT)
 #endif
                if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
                    error != ENOENT)
@@ -710,26 +699,16 @@ relookup(dvp, vpp, cnp)
                 */
                return (0);
        }
                 */
                return (0);
        }
-#ifdef NAMEI_DIAGNOSTIC
-       printf("found\n");
-#endif
-
        dp = *vpp;
        dp = *vpp;
+
 #ifdef DIAGNOSTIC
        /*
         * Check for symbolic link
         */
 #ifdef DIAGNOSTIC
        /*
         * Check for symbolic link
         */
-       if (dp->v_type == VLNK) {
+       if (dp->v_type == VLNK && (cnp->cn_flags & FOLLOW))
                panic ("relookup: symlink found.\n");
                panic ("relookup: symlink found.\n");
-       };
-
-       /*
-        * Check to see if the vnode has been mounted on;
-        * if so find the root of the mounted file system.
-        */
 #endif
 
 #endif
 
-
 nextname:
        /*
         * Check for read-only file systems.
 nextname:
        /*
         * Check for read-only file systems.
@@ -1309,7 +1288,13 @@ ufs_symlink(dvp, vpp, cnp, vap, target)
 }
 
 /*
 }
 
 /*
- * Vnode op for read and write
+ * Vnode op for reading directories.
+ * 
+ * The routine below assumes that the on-disk format of a directory
+ * is the same as that defined by <sys/dirent.h>. If the on-disk
+ * format changes, then it will be necessary to do a conversion
+ * from the on-disk format that read returns to the format defined
+ * by <sys/dirent.h>.
  */
 int
 ufs_readdir(vp, uio, cred, eofflagp)
  */
 int
 ufs_readdir(vp, uio, cred, eofflagp)
@@ -1800,21 +1785,3 @@ bad:
        ufs_iput(ip);
        return (error);
 }
        ufs_iput(ip);
        return (error);
 }
-
-
-#if defined(JOHNH) && 0
-/*
- * A hack to get the kernel to compile.
- */
-int
-hang_addrlist()
-{
-    return 0;
-}
-int
-free_addrlist()
-{
-    return 0;
-}
-#endif
-