- * Unlock and decrement the reference count of an inode structure.
- */
-iput(ip)
- register struct inode *ip;
-{
-
- if ((ip->i_flag & ILOCKED) == 0)
- panic("iput");
- IUNLOCK(ip);
- vrele(ITOV(ip));
-}
-
-/*
- * Last reference to an inode, write the inode out and if necessary,
- * truncate and deallocate the file.
- */
-ufs_inactive(vp)
- struct vnode *vp;
-{
- register struct inode *ip = VTOI(vp);
- int mode, error = 0;
-
- if (prtactive && vp->v_usecount != 0)
- vprint("ufs_inactive: pushing active", vp);
- /*
- * Get rid of inodes related to stale file handles.
- */
- if (ip->i_mode == 0) {
- if ((vp->v_flag & VXLOCK) == 0)
- vgone(vp);
- return (0);
- }
- ILOCK(ip);
- if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
-#ifdef QUOTA
- if (!getinoquota(ip))
- (void) chkiq(ip, -1, NOCRED, 0);
-#endif
- error = itrunc(ip, (u_long)0, 0);
- mode = ip->i_mode;
- ip->i_mode = 0;
- ip->i_rdev = 0;
- ip->i_flag |= IUPD|ICHG;
- ifree(ip, ip->i_number, mode);
- }
- IUPDAT(ip, &time, &time, 0);
- IUNLOCK(ip);
- ip->i_flag = 0;
- /*
- * If we are done with the inode, reclaim it
- * so that it can be reused immediately.
- */
- if (vp->v_usecount == 0 && ip->i_mode == 0)
- vgone(vp);
- return (error);
-}
-
-/*
- * Reclaim an inode so that it can be used for other purposes.
+ * Update the access, modified, and inode change times as specified
+ * by the IACC, IUPD, and ICHG flags respectively. The IMOD flag
+ * is used to specify that the inode needs to be updated but that
+ * the times have already been set. The access and modified times
+ * are taken from the second and third parameters; the inode change
+ * time is always taken from the current time. If waitfor is set,
+ * then wait for the disk write of the inode to complete.