SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.75
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.75
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.74 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.75 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
struct vnode *dvp, **vpp;
struct componentname *cnp;
{
struct vnode *dvp, **vpp;
struct componentname *cnp;
{
- register char *cp; /* pointer into pathname argument */
register struct vnode *dp = 0; /* the directory we are searching */
struct vnode *tdp; /* saved dp */
struct mount *mp; /* mount table entry */
int docache; /* == 0 do not cache last component */
int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
register struct vnode *dp = 0; /* the directory we are searching */
struct vnode *tdp; /* saved dp */
struct mount *mp; /* mount table entry */
int docache; /* == 0 do not cache last component */
int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
+ char *cp; /* DEBUG: check name ptr/len */
+ int newhash; /* DEBUG: check name hash */
/*
* Setup: break out flag bits into variables.
/*
* Setup: break out flag bits into variables.
* responsibility for freeing the pathname buffer.
*/
#ifdef NAMEI_DIAGNOSTIC
* responsibility for freeing the pathname buffer.
*/
#ifdef NAMEI_DIAGNOSTIC
- newhash = 0;
- for (cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++)
+ for (newhash = 0, cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++)
newhash += (unsigned char)*cp;
if (newhash != cnp->cn_hash)
panic("relookup: bad hash");
if (cnp->cn_namelen != cp - cnp->cn_nameptr)
panic ("relookup: bad len");
newhash += (unsigned char)*cp;
if (newhash != cnp->cn_hash)
panic("relookup: bad hash");
if (cnp->cn_namelen != cp - cnp->cn_nameptr)
panic ("relookup: bad len");
- { char c = *cp;
- *cp = '\0';
+ if (*cp != 0)
+ panic("relookup: not last component");
printf("{%s}: ", cnp->cn_nameptr);
printf("{%s}: ", cnp->cn_nameptr);
printf("not found\n");
#endif
if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
printf("not found\n");
#endif
if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
- error != ENOENT || *cp != 0)
goto bad;
/*
* If creating and at end of pathname, then can consider
goto bad;
/*
* If creating and at end of pathname, then can consider
error = EROFS;
goto bad;
}
error = EROFS;
goto bad;
}
+ /* ASSERT(dvp == ndp->ni_startdir) */
+ if (cnp->cn_flags & SAVESTART)
+ VREF(dvp);
/*
* We return with ni_vp NULL to indicate that the entry
* doesn't currently exist, leaving a pointer to the
* (possibly locked) directory inode in ndp->ni_dvp.
*/
/*
* We return with ni_vp NULL to indicate that the entry
* doesn't currently exist, leaving a pointer to the
* (possibly locked) directory inode in ndp->ni_dvp.
*/
- if (cnp->cn_flags & SAVESTART) {
- /*
- * startdir == dvp, always
- */
- VREF(dvp);
- }
return (0);
}
#ifdef NAMEI_DIAGNOSTIC
return (0);
}
#ifdef NAMEI_DIAGNOSTIC
- if (cnp->cn_flags & SAVESTART) {
- /* ASSERT(dvp==ndp->ni_startdir) */
+ /* ASSERT(dvp == ndp->ni_startdir) */
+ if (cnp->cn_flags & SAVESTART)
if (!wantparent)
vrele(dvp);
if (!wantparent)
vrele(dvp);
if ((fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
if ((fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
- (void) relookup(fdvp, &fvp, fcnp); /* NEEDSWORK: startdir stuff */
+ (void) relookup(fdvp, &fvp, fcnp);
if (fvp != NULL) {
xp = VTOI(fvp);
dp = VTOI(fdvp);
if (fvp != NULL) {
xp = VTOI(fvp);
dp = VTOI(fdvp);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.74 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.75 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
struct vnode *dvp, **vpp;
struct componentname *cnp;
{
struct vnode *dvp, **vpp;
struct componentname *cnp;
{
- register char *cp; /* pointer into pathname argument */
register struct vnode *dp = 0; /* the directory we are searching */
struct vnode *tdp; /* saved dp */
struct mount *mp; /* mount table entry */
int docache; /* == 0 do not cache last component */
int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
register struct vnode *dp = 0; /* the directory we are searching */
struct vnode *tdp; /* saved dp */
struct mount *mp; /* mount table entry */
int docache; /* == 0 do not cache last component */
int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
+ char *cp; /* DEBUG: check name ptr/len */
+ int newhash; /* DEBUG: check name hash */
/*
* Setup: break out flag bits into variables.
/*
* Setup: break out flag bits into variables.
* responsibility for freeing the pathname buffer.
*/
#ifdef NAMEI_DIAGNOSTIC
* responsibility for freeing the pathname buffer.
*/
#ifdef NAMEI_DIAGNOSTIC
- newhash = 0;
- for (cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++)
+ for (newhash = 0, cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++)
newhash += (unsigned char)*cp;
if (newhash != cnp->cn_hash)
panic("relookup: bad hash");
if (cnp->cn_namelen != cp - cnp->cn_nameptr)
panic ("relookup: bad len");
newhash += (unsigned char)*cp;
if (newhash != cnp->cn_hash)
panic("relookup: bad hash");
if (cnp->cn_namelen != cp - cnp->cn_nameptr)
panic ("relookup: bad len");
- { char c = *cp;
- *cp = '\0';
+ if (*cp != 0)
+ panic("relookup: not last component");
printf("{%s}: ", cnp->cn_nameptr);
printf("{%s}: ", cnp->cn_nameptr);
printf("not found\n");
#endif
if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
printf("not found\n");
#endif
if (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == DELETE ||
- error != ENOENT || *cp != 0)
goto bad;
/*
* If creating and at end of pathname, then can consider
goto bad;
/*
* If creating and at end of pathname, then can consider
error = EROFS;
goto bad;
}
error = EROFS;
goto bad;
}
+ /* ASSERT(dvp == ndp->ni_startdir) */
+ if (cnp->cn_flags & SAVESTART)
+ VREF(dvp);
/*
* We return with ni_vp NULL to indicate that the entry
* doesn't currently exist, leaving a pointer to the
* (possibly locked) directory inode in ndp->ni_dvp.
*/
/*
* We return with ni_vp NULL to indicate that the entry
* doesn't currently exist, leaving a pointer to the
* (possibly locked) directory inode in ndp->ni_dvp.
*/
- if (cnp->cn_flags & SAVESTART) {
- /*
- * startdir == dvp, always
- */
- VREF(dvp);
- }
return (0);
}
#ifdef NAMEI_DIAGNOSTIC
return (0);
}
#ifdef NAMEI_DIAGNOSTIC
- if (cnp->cn_flags & SAVESTART) {
- /* ASSERT(dvp==ndp->ni_startdir) */
+ /* ASSERT(dvp == ndp->ni_startdir) */
+ if (cnp->cn_flags & SAVESTART)
if (!wantparent)
vrele(dvp);
if (!wantparent)
vrele(dvp);
if ((fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
if ((fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
- (void) relookup(fdvp, &fvp, fcnp); /* NEEDSWORK: startdir stuff */
+ (void) relookup(fdvp, &fvp, fcnp);
if (fvp != NULL) {
xp = VTOI(fvp);
dp = VTOI(fdvp);
if (fvp != NULL) {
xp = VTOI(fvp);
dp = VTOI(fdvp);