FreeBSD/sys/fs/nfsclient/nfs_clport.c
/*
 * Check each of the attributes to be set, to ensure they aren't already
 * the correct value. Disable setting ones already correct.
 */
Check each of the attributes to be set, to ensure they aren't already
the correct value. Disable setting ones already correct.
Check each of the attributes to be set to ensure they aren ' t already the correct value . Disable setting ones already correct .
int
nfscl_checksattr(struct vattr *vap, struct nfsvattr *nvap)
{
	if (vap->va_mode != (mode_t)VNOVAL) {
		if (vap->va_mode == nvap->na_mode)
			vap->va_mode = (mode_t)VNOVAL;
	}
	if (vap->va_uid != (uid_t)VNOVAL) {
		if (vap->va_uid == nvap->na_uid)
			vap->va_uid = (uid_t)VNOVAL;
	}
	if (vap->va_gid != (gid_t)VNOVAL) {
		if (vap->va_gid == nvap->na_gid)
			vap->va_gid = (gid_t)VNOVAL;
	}
	if (vap->va_size != VNOVAL) {
		if (vap->va_size == nvap->na_size)
			vap->va_size = VNOVAL;
	}
	if (vap->va_mtime.tv_sec == VNOVAL) {
		vfs_timestamp(&vap->va_mtime);
		vap->va_vaflags |= VA_UTIMES_NULL;
	}
	if (vap->va_atime.tv_sec == VNOVAL)
		vap->va_atime = vap->va_mtime;
	return (1);
}
int nfscl_checksattr ( struct vattr * vap , struct nfsvattr * nvap ) { if ( vap -> va_mode != ( mode_t ) VNOVAL ) { if ( vap -> va_mode == nvap -> na_mode ) vap -> va_mode = ( mode_t ) VNOVAL ; } if ( vap -> va_uid != ( uid_t ) VNOVAL ) { if ( vap -> va_uid == nvap -> na_uid ) vap -> va_uid = ( uid_t ) VNOVAL ; } if ( vap -> va_gid != ( gid_t ) VNOVAL ) { if ( vap -> va_gid == nvap -> na_gid ) vap -> va_gid = ( gid_t ) VNOVAL ; } if ( vap -> va_size != VNOVAL ) { if ( vap -> va_size == nvap -> na_size ) vap -> va_size = VNOVAL ; } if ( vap -> va_mtime . tv_sec == VNOVAL ) { vfs_timestamp ( & vap -> va_mtime ) ; vap -> va_vaflags |= VA_UTIMES_NULL ; } if ( vap -> va_atime . tv_sec == VNOVAL ) vap -> va_atime = vap -> va_mtime ; return ( 1 ) ; }
Check each of the attributes to be set, to ensure they aren't already
 the correct value.
Check each of the attributes to be set to ensure they aren ' t already the correct value .
/*
	 * We are normally called with only a partially initialized
	 * VAP.  Since the NFSv3 spec says that server may use the
	 * file attributes to store the verifier, the spec requires
	 * us to do a SETATTR RPC. FreeBSD servers store the verifier
	 * in atime, but we can't really assume that all servers will
	 * so we ensure that our SETATTR sets both atime and mtime.
	 * Set the VA_UTIMES_NULL flag for this case, so that
	 * the server's time will be used.  This is needed to
	 * work around a bug in some Solaris servers, where
	 * setting the time TOCLIENT causes the Setattr RPC
	 * to return NFS_OK, but not set va_mode.
	 */