Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ufs/ufs_lookup.c
Show First 20 Lines • Show All 1,063 Lines • ▼ Show 20 Lines | # if (BYTE_ORDER == LITTLE_ENDIAN) | ||||
if (OFSFMT(dvp)) | if (OFSFMT(dvp)) | ||||
namlen = ep->d_type; | namlen = ep->d_type; | ||||
else | else | ||||
namlen = ep->d_namlen; | namlen = ep->d_namlen; | ||||
# else | # else | ||||
namlen = ep->d_namlen; | namlen = ep->d_namlen; | ||||
# endif | # endif | ||||
if (ep->d_ino == 0 || | if (ep->d_ino == 0 || | ||||
(ep->d_ino == WINO && namlen == dirp->d_namlen && | (ep->d_ino == UFS_WINO && namlen == dirp->d_namlen && | ||||
bcmp(ep->d_name, dirp->d_name, dirp->d_namlen) == 0)) { | bcmp(ep->d_name, dirp->d_name, dirp->d_namlen) == 0)) { | ||||
if (spacefree + dsize < newentrysize) | if (spacefree + dsize < newentrysize) | ||||
panic("ufs_direnter: compact1"); | panic("ufs_direnter: compact1"); | ||||
dirp->d_reclen = spacefree + dsize; | dirp->d_reclen = spacefree + dsize; | ||||
} else { | } else { | ||||
if (spacefree < newentrysize) | if (spacefree < newentrysize) | ||||
panic("ufs_direnter: compact2"); | panic("ufs_direnter: compact2"); | ||||
dirp->d_reclen = spacefree; | dirp->d_reclen = spacefree; | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (ip) { | ||||
} else { | } else { | ||||
ip->i_nlink--; | ip->i_nlink--; | ||||
DIP_SET(ip, i_nlink, ip->i_nlink); | DIP_SET(ip, i_nlink, ip->i_nlink); | ||||
ip->i_flag |= IN_CHANGE; | ip->i_flag |= IN_CHANGE; | ||||
} | } | ||||
} | } | ||||
if (flags & DOWHITEOUT) { | if (flags & DOWHITEOUT) { | ||||
/* | /* | ||||
* Whiteout entry: set d_ino to WINO. | * Whiteout entry: set d_ino to UFS_WINO. | ||||
*/ | */ | ||||
if ((error = | if ((error = | ||||
UFS_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp)) != 0) | UFS_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp)) != 0) | ||||
return (error); | return (error); | ||||
ep->d_ino = WINO; | ep->d_ino = UFS_WINO; | ||||
ep->d_type = DT_WHT; | ep->d_type = DT_WHT; | ||||
goto out; | goto out; | ||||
} | } | ||||
if ((error = UFS_BLKATOFF(dvp, | if ((error = UFS_BLKATOFF(dvp, | ||||
(off_t)(dp->i_offset - dp->i_count), (char **)&ep, &bp)) != 0) | (off_t)(dp->i_offset - dp->i_count), (char **)&ep, &bp)) != 0) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | for (off = 0; off < ip->i_size; off += dp->d_reclen) { | ||||
* be 0 unless we're at end of file. | * be 0 unless we're at end of file. | ||||
*/ | */ | ||||
if (error || count != 0) | if (error || count != 0) | ||||
return (0); | return (0); | ||||
/* avoid infinite loops */ | /* avoid infinite loops */ | ||||
if (dp->d_reclen == 0) | if (dp->d_reclen == 0) | ||||
return (0); | return (0); | ||||
/* skip empty entries */ | /* skip empty entries */ | ||||
if (dp->d_ino == 0 || dp->d_ino == WINO) | if (dp->d_ino == 0 || dp->d_ino == UFS_WINO) | ||||
continue; | continue; | ||||
/* accept only "." and ".." */ | /* accept only "." and ".." */ | ||||
# if (BYTE_ORDER == LITTLE_ENDIAN) | # if (BYTE_ORDER == LITTLE_ENDIAN) | ||||
if (OFSFMT(ITOV(ip))) | if (OFSFMT(ITOV(ip))) | ||||
namlen = dp->d_type; | namlen = dp->d_type; | ||||
else | else | ||||
namlen = dp->d_namlen; | namlen = dp->d_namlen; | ||||
# else | # else | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | ufs_checkpath(ino_t source_ino, ino_t parent_ino, struct inode *target, struct ucred *cred, ino_t *wait_ino) | ||||
vp = tvp = ITOV(target); | vp = tvp = ITOV(target); | ||||
mp = vp->v_mount; | mp = vp->v_mount; | ||||
*wait_ino = 0; | *wait_ino = 0; | ||||
if (target->i_number == source_ino) | if (target->i_number == source_ino) | ||||
return (EEXIST); | return (EEXIST); | ||||
if (target->i_number == parent_ino) | if (target->i_number == parent_ino) | ||||
return (0); | return (0); | ||||
if (target->i_number == ROOTINO) | if (target->i_number == UFS_ROOTINO) | ||||
return (0); | return (0); | ||||
for (;;) { | for (;;) { | ||||
error = ufs_dir_dd_ino(vp, cred, &dd_ino, &vp1); | error = ufs_dir_dd_ino(vp, cred, &dd_ino, &vp1); | ||||
if (error != 0) | if (error != 0) | ||||
break; | break; | ||||
if (dd_ino == source_ino) { | if (dd_ino == source_ino) { | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
if (dd_ino == ROOTINO) | if (dd_ino == UFS_ROOTINO) | ||||
break; | break; | ||||
if (dd_ino == parent_ino) | if (dd_ino == parent_ino) | ||||
break; | break; | ||||
if (vp1 == NULL) { | if (vp1 == NULL) { | ||||
error = VFS_VGET(mp, dd_ino, LK_SHARED | LK_NOWAIT, | error = VFS_VGET(mp, dd_ino, LK_SHARED | LK_NOWAIT, | ||||
&vp1); | &vp1); | ||||
if (error != 0) { | if (error != 0) { | ||||
*wait_ino = dd_ino; | *wait_ino = dd_ino; | ||||
Show All 19 Lines |