/*
- * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
int error;
struct nfs_vattr nva;
struct vnode_attr *vap = ap->a_vap;
+ struct nfsmount *nmp;
dev_t rdev;
/*
return (error);
/* copy nva to *a_vap */
+ nmp = VTONMP(ap->a_vp);
+ vap->va_flags |= nmp ? (nmp->nm_vers > 2 ? VA_64BITOBJIDS : 0) : 0;
VATTR_RETURN(vap, va_type, nva.nva_type);
VATTR_RETURN(vap, va_mode, nva.nva_mode);
rdev = makedev(nva.nva_rawdev.specdata1, nva.nva_rawdev.specdata2);
} */ *ap)
{
nfsnode_t np = VTONFS(ap->a_vp);
- struct timeval now;
+ struct timespec now;
int error;
/*
if ((error = nfs_node_lock(np)))
return (error);
np->n_flag |= NACC;
- microtime(&now);
+ nanotime(&now);
np->n_atim.tv_sec = now.tv_sec;
- np->n_atim.tv_nsec = now.tv_usec * 1000;
+ np->n_atim.tv_nsec = now.tv_nsec;
nfs_node_unlock(np);
return (VOCALL(spec_vnodeop_p, VOFFSET(vnop_read), ap));
}
} */ *ap)
{
nfsnode_t np = VTONFS(ap->a_vp);
- struct timeval now;
+ struct timespec now;
int error;
/*
if ((error = nfs_node_lock(np)))
return (error);
np->n_flag |= NUPD;
- microtime(&now);
+ nanotime(&now);
np->n_mtim.tv_sec = now.tv_sec;
- np->n_mtim.tv_nsec = now.tv_usec * 1000;
+ np->n_mtim.tv_nsec = now.tv_nsec;
nfs_node_unlock(np);
return (VOCALL(spec_vnodeop_p, VOFFSET(vnop_write), ap));
}
} */ *ap)
{
nfsnode_t np = VTONFS(ap->a_vp);
- struct timeval now;
+ struct timespec now;
int error;
/*
if ((error = nfs_node_lock(np)))
return (error);
np->n_flag |= NACC;
- microtime(&now);
+ nanotime(&now);
np->n_atim.tv_sec = now.tv_sec;
- np->n_atim.tv_nsec = now.tv_usec * 1000;
+ np->n_atim.tv_nsec = now.tv_nsec;
nfs_node_unlock(np);
return (VOCALL(fifo_vnodeop_p, VOFFSET(vnop_read), ap));
}
} */ *ap)
{
nfsnode_t np = VTONFS(ap->a_vp);
- struct timeval now;
+ struct timespec now;
int error;
/*
if ((error = nfs_node_lock(np)))
return (error);
np->n_flag |= NUPD;
- microtime(&now);
+ nanotime(&now);
np->n_mtim.tv_sec = now.tv_sec;
- np->n_mtim.tv_nsec = now.tv_usec * 1000;
+ np->n_mtim.tv_nsec = now.tv_nsec;
nfs_node_unlock(np);
return (VOCALL(fifo_vnodeop_p, VOFFSET(vnop_write), ap));
}
vnode_t vp = ap->a_vp;
nfsnode_t np = VTONFS(vp);
struct vnode_attr vattr;
- struct timeval now;
+ struct timespec now;
mount_t mp;
int error;
if ((error = nfs_node_lock(np)))
return (error);
if (np->n_flag & (NACC | NUPD)) {
- microtime(&now);
+ nanotime(&now);
if (np->n_flag & NACC) {
np->n_atim.tv_sec = now.tv_sec;
- np->n_atim.tv_nsec = now.tv_usec * 1000;
+ np->n_atim.tv_nsec = now.tv_nsec;
}
if (np->n_flag & NUPD) {
np->n_mtim.tv_sec = now.tv_sec;
- np->n_mtim.tv_nsec = now.tv_usec * 1000;
+ np->n_mtim.tv_nsec = now.tv_nsec;
}
np->n_flag |= NCHG;
if (!vnode_isinuse(vp, 1) && (mp = vnode_mount(vp)) && !vfs_isrdonly(mp)) {
return (EROFS);
error = nfs_flush(VTONFS(vp), MNT_WAIT, vfs_context_thread(ctx), 0);
break;
- case NFS_FSCTL_DESTROY_CRED:
+ case NFS_IOC_DESTROY_CRED:
if (!auth_is_kerberized(mp->nm_auth))
return (ENOTSUP);
error = nfs_gss_clnt_ctx_remove(mp, vfs_context_ucred(ctx));
break;
- case NFS_FSCTL_SET_CRED:
+ case NFS_IOC_SET_CRED:
+ case NFS_IOC_SET_CRED64:
if (!auth_is_kerberized(mp->nm_auth))
return (ENOTSUP);
+ if ((ap->a_command == NFS_IOC_SET_CRED && vfs_context_is64bit(ctx)) ||
+ (ap->a_command == NFS_IOC_SET_CRED64 && !vfs_context_is64bit(ctx)))
+ return (EINVAL);
if (vfs_context_is64bit(ctx)) {
gprinc = *(struct user_nfs_gss_principal *)ap->a_data;
} else {
NFS_DBG(NFS_FAC_GSS, 7, "Seting credential to principal %s returned %d\n", p, error);
FREE(p, M_TEMP);
break;
- case NFS_FSCTL_GET_CRED:
+ case NFS_IOC_GET_CRED:
+ case NFS_IOC_GET_CRED64:
if (!auth_is_kerberized(mp->nm_auth))
return (ENOTSUP);
+ if ((ap->a_command == NFS_IOC_GET_CRED && vfs_context_is64bit(ctx)) ||
+ (ap->a_command == NFS_IOC_GET_CRED64 && !vfs_context_is64bit(ctx)))
+ return (EINVAL);
error = nfs_gss_clnt_ctx_get_principal(mp, ctx, &gprinc);
if (error)
break;
if (!nfs_getattrcache(np, &nvattr, 0)) {
vap = &vattr;
VATTR_INIT(vap);
+
+ vap->va_flags |= nmp->nm_vers > 2 ? VA_64BITOBJIDS : 0;
VATTR_RETURN(vap, va_fsid, vfs_statfs(nmp->nm_mountp)->f_fsid.val[0]);
VATTR_RETURN(vap, va_fileid, nvattr.nva_fileid);
VATTR_RETURN(vap, va_mode, nvattr.nva_mode);