FreeBSD/sys/fs/tmpfs/tmpfs_subr.c
/*
 * Change access and modification times of the given vnode.
 * Caller should execute tmpfs_update on vp after a successful execution.
 * The vnode must be locked on entry and remain locked on exit.
 */
Change access and modification times of the given vnode.
Caller should execute tmpfs_update on vp after a successful execution.
The vnode must be locked on entry and remain locked on exit.
Change access and modification times of the given vnode . Caller should execute tmpfs_update on vp after a successful execution . The vnode must be locked on entry and remain locked on exit .
int
tmpfs_chtimes(struct vnode *vp, struct vattr *vap,
    struct ucred *cred, struct thread *l)
{
	int error;
	struct tmpfs_node *node;
	MPASS(VOP_ISLOCKED(vp));
	node = VP_TO_TMPFS_NODE(vp);
	if (vp->v_mount->mnt_flag & MNT_RDONLY)
		return EROFS;
	if (node->tn_flags & (IMMUTABLE | APPEND))
		return EPERM;
	error = vn_utimes_perm(vp, vap, cred, l);
	if (error != 0)
		return (error);
	if (vap->va_atime.tv_sec != VNOVAL)
		node->tn_status |= TMPFS_NODE_ACCESSED;
	if (vap->va_mtime.tv_sec != VNOVAL)
		node->tn_status |= TMPFS_NODE_MODIFIED;
	if (vap->va_birthtime.tv_sec != VNOVAL)
		node->tn_status |= TMPFS_NODE_MODIFIED;
	tmpfs_itimes(vp, &vap->va_atime, &vap->va_mtime);
	if (vap->va_birthtime.tv_sec != VNOVAL)
		node->tn_birthtime = vap->va_birthtime;
	MPASS(VOP_ISLOCKED(vp));
	return 0;
}
int tmpfs_chtimes ( struct vnode * vp , struct vattr * vap , struct ucred * cred , struct thread * l ) { int error ; struct tmpfs_node * node ; MPASS ( VOP_ISLOCKED ( vp ) ) ; node = VP_TO_TMPFS_NODE ( vp ) ; if ( vp -> v_mount -> mnt_flag & MNT_RDONLY ) return EROFS ; if ( node -> tn_flags & ( IMMUTABLE | APPEND ) ) return EPERM ; error = vn_utimes_perm ( vp , vap , cred , l ) ; if ( error != 0 ) return ( error ) ; if ( vap -> va_atime . tv_sec != VNOVAL ) node -> tn_status |= TMPFS_NODE_ACCESSED ; if ( vap -> va_mtime . tv_sec != VNOVAL ) node -> tn_status |= TMPFS_NODE_MODIFIED ; if ( vap -> va_birthtime . tv_sec != VNOVAL ) node -> tn_status |= TMPFS_NODE_MODIFIED ; tmpfs_itimes ( vp , & vap -> va_atime , & vap -> va_mtime ) ; if ( vap -> va_birthtime . tv_sec != VNOVAL ) node -> tn_birthtime = vap -> va_birthtime ; MPASS ( VOP_ISLOCKED ( vp ) ) ; return 0 ; }
Change access and modification times of the given vnode.
Change access and modification times of the given vnode .
/* Disallow this operation if the file system is mounted read-only. */ /* Immutable or append-only files cannot be modified, either. */