Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/ext2fs/ext2_inode.c
Show First 20 Lines • Show All 556 Lines • ▼ Show 20 Lines | ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, | ||||
ASSERT_VOP_LOCKED(vp, "ext2_truncate"); | ASSERT_VOP_LOCKED(vp, "ext2_truncate"); | ||||
if (length < 0) | if (length < 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
ip = VTOI(vp); | ip = VTOI(vp); | ||||
if (vp->v_type == VLNK && | if (vp->v_type == VLNK && | ||||
ip->i_size < vp->v_mount->mnt_maxsymlinklen) { | ip->i_size < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) { | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
if (length != 0) | if (length != 0) | ||||
panic("ext2_truncate: partial truncate of symlink"); | panic("ext2_truncate: partial truncate of symlink"); | ||||
#endif | #endif | ||||
bzero((char *)&ip->i_shortlink, (u_int)ip->i_size); | bzero((char *)&ip->i_shortlink, (u_int)ip->i_size); | ||||
ip->i_size = 0; | ip->i_size = 0; | ||||
ip->i_flag |= IN_CHANGE | IN_UPDATE; | ip->i_flag |= IN_CHANGE | IN_UPDATE; | ||||
return (ext2_update(vp, 1)); | return (ext2_update(vp, 1)); | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |