summaryrefslogtreecommitdiff
path: root/sys/nfs
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2011-07-09 00:24:45 +0000
committerBob Beck <beck@cvs.openbsd.org>2011-07-09 00:24:45 +0000
commitde3c53b89e0b6224f4c4f0d0dc76254ad73c29b9 (patch)
tree4aaed101795d2abe93b639d2a0fd03ff266f505a /sys/nfs
parent60fe4317ee12a366727ee9b10c4604a500d67b1f (diff)
KNF
ok md5 "can't be worse" thib@
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_vfsops.c23
-rw-r--r--sys/nfs/nfs_vnops.c412
2 files changed, 216 insertions, 219 deletions
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index c02a4f5d5a4..4260cf4a1ab 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.92 2009/10/19 22:24:18 jsg Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.93 2011/07/09 00:24:44 beck Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -257,7 +257,7 @@ nfs_mountroot(void)
/*
* Call nfs_boot_init() to fill in the nfs_diskless struct.
- * Side effect: Finds and configures a network interface.
+ * Side effect: Finds and configures a network interface.
*/
bzero((caddr_t) &nd, sizeof(nd));
nfs_boot_init(&nd, procp);
@@ -311,7 +311,7 @@ nfs_mountroot(void)
}
/*
- * If swapping to an nfs node: (swdevt[0].sw_dev == NODEV)
+ * If swapping to an nfs node: (swdevt[0].sw_dev == NODEV)
* Create a fake mount point just for the swap vnode so that the
* swap file can be on a different server from the rootfs.
*
@@ -330,10 +330,11 @@ nfs_mountroot(void)
vp->v_type = VREG;
vp->v_flag = 0;
- /*
- * Next line is a hack to make swapmount() work on NFS swap files.
- * XXX-smurph
- */
+ /*
+ * Next line is a hack to make swapmount() work on NFS
+ * swap files.
+ * XXX-smurph
+ */
swdevt[0].sw_dev = NETDEV;
/* end hack */
swdevt[0].sw_vp = vp;
@@ -380,7 +381,7 @@ nfs_mount_diskless(struct nfs_dlmount *ndmntp, char *mntname, int mntflag)
args.addr = (struct sockaddr *)&ndmntp->ndm_saddr;
args.addrlen = args.addr->sa_len;
args.sotype = SOCK_DGRAM;
- args.fh = ndmntp->ndm_fh;
+ args.fh = ndmntp->ndm_fh;
args.fhsize = NFSX_V2FH;
args.hostname = ndmntp->ndm_host;
@@ -390,7 +391,7 @@ nfs_mount_diskless(struct nfs_dlmount *ndmntp, char *mntname, int mntflag)
#ifdef NFS_BOOT_RWSIZE
/*
* Reduce rsize,wsize for interfaces that consistently
- * drop fragments of long UDP messages. (i.e. wd8003).
+ * drop fragments of long UDP messages. (i.e. wd8003).
* You can always change these later via remount.
*/
args.flags |= NFSMNT_WSIZE | NFSMNT_RSIZE;
@@ -865,7 +866,6 @@ nfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
int
nfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
{
-
return (EINVAL);
}
@@ -876,7 +876,6 @@ nfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
int
nfs_vptofh(struct vnode *vp, struct fid *fhp)
{
-
return (EINVAL);
}
@@ -887,7 +886,6 @@ nfs_vptofh(struct vnode *vp, struct fid *fhp)
int
nfs_start(struct mount *mp, int flags, struct proc *p)
{
-
return (0);
}
@@ -898,7 +896,6 @@ nfs_start(struct mount *mp, int flags, struct proc *p)
int
nfs_quotactl(struct mount *mp, int cmd, uid_t uid, caddr_t arg, struct proc *p)
{
-
return (EOPNOTSUPP);
}
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 95ff3e4ac35..3380669cbad 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.137 2011/07/08 23:06:54 beck Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.138 2011/07/09 00:24:44 beck Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -85,60 +85,60 @@ void nfs_cache_enter(struct vnode *, struct vnode *, struct componentname *);
/* Global vfs data structures for nfs. */
struct vops nfs_vops = {
- .vop_lookup = nfs_lookup,
- .vop_create = nfs_create,
- .vop_mknod = nfs_mknod,
- .vop_open = nfs_open,
- .vop_close = nfs_close,
- .vop_access = nfs_access,
- .vop_getattr = nfs_getattr,
- .vop_setattr = nfs_setattr,
- .vop_read = nfs_read,
- .vop_write = nfs_write,
- .vop_ioctl = nfs_ioctl,
- .vop_poll = nfs_poll,
- .vop_kqfilter = nfs_kqfilter,
- .vop_revoke = vop_generic_revoke,
- .vop_fsync = nfs_fsync,
- .vop_remove = nfs_remove,
- .vop_link = nfs_link,
- .vop_rename = nfs_rename,
- .vop_mkdir = nfs_mkdir,
- .vop_rmdir = nfs_rmdir,
- .vop_symlink = nfs_symlink,
- .vop_readdir = nfs_readdir,
- .vop_readlink = nfs_readlink,
- .vop_abortop = vop_generic_abortop,
- .vop_inactive = nfs_inactive,
- .vop_reclaim = nfs_reclaim,
- .vop_lock = vop_generic_lock, /* XXX: beck@ must fix this. */
- .vop_unlock = vop_generic_unlock,
- .vop_bmap = nfs_bmap,
- .vop_strategy = nfs_strategy,
- .vop_print = nfs_print,
- .vop_islocked = vop_generic_islocked,
- .vop_pathconf = nfs_pathconf,
- .vop_advlock = nfs_advlock,
- .vop_bwrite = nfs_bwrite
+ .vop_lookup = nfs_lookup,
+ .vop_create = nfs_create,
+ .vop_mknod = nfs_mknod,
+ .vop_open = nfs_open,
+ .vop_close = nfs_close,
+ .vop_access = nfs_access,
+ .vop_getattr = nfs_getattr,
+ .vop_setattr = nfs_setattr,
+ .vop_read = nfs_read,
+ .vop_write = nfs_write,
+ .vop_ioctl = nfs_ioctl,
+ .vop_poll = nfs_poll,
+ .vop_kqfilter = nfs_kqfilter,
+ .vop_revoke = vop_generic_revoke,
+ .vop_fsync = nfs_fsync,
+ .vop_remove = nfs_remove,
+ .vop_link = nfs_link,
+ .vop_rename = nfs_rename,
+ .vop_mkdir = nfs_mkdir,
+ .vop_rmdir = nfs_rmdir,
+ .vop_symlink = nfs_symlink,
+ .vop_readdir = nfs_readdir,
+ .vop_readlink = nfs_readlink,
+ .vop_abortop = vop_generic_abortop,
+ .vop_inactive = nfs_inactive,
+ .vop_reclaim = nfs_reclaim,
+ .vop_lock = vop_generic_lock, /* XXX: beck@ must fix this. */
+ .vop_unlock = vop_generic_unlock,
+ .vop_bmap = nfs_bmap,
+ .vop_strategy = nfs_strategy,
+ .vop_print = nfs_print,
+ .vop_islocked = vop_generic_islocked,
+ .vop_pathconf = nfs_pathconf,
+ .vop_advlock = nfs_advlock,
+ .vop_bwrite = nfs_bwrite
};
/* Special device vnode ops. */
struct vops nfs_specvops = {
- .vop_close = nfsspec_close,
- .vop_access = nfsspec_access,
- .vop_getattr = nfs_getattr,
- .vop_setattr = nfs_setattr,
- .vop_read = nfsspec_read,
- .vop_write = nfsspec_write,
- .vop_fsync = nfs_fsync,
- .vop_inactive = nfs_inactive,
- .vop_reclaim = nfs_reclaim,
- .vop_lock = vop_generic_lock,
- .vop_unlock = vop_generic_unlock,
- .vop_print = nfs_print,
- .vop_islocked = vop_generic_islocked,
-
- /* XXX: Keep in sync with spec_vops. */
+ .vop_close = nfsspec_close,
+ .vop_access = nfsspec_access,
+ .vop_getattr = nfs_getattr,
+ .vop_setattr = nfs_setattr,
+ .vop_read = nfsspec_read,
+ .vop_write = nfsspec_write,
+ .vop_fsync = nfs_fsync,
+ .vop_inactive = nfs_inactive,
+ .vop_reclaim = nfs_reclaim,
+ .vop_lock = vop_generic_lock,
+ .vop_unlock = vop_generic_unlock,
+ .vop_print = nfs_print,
+ .vop_islocked = vop_generic_islocked,
+
+ /* XXX: Keep in sync with spec_vops. */
.vop_lookup = vop_generic_lookup,
.vop_create = spec_badop,
.vop_mknod = spec_badop,
@@ -165,22 +165,22 @@ struct vops nfs_specvops = {
#ifdef FIFO
struct vops nfs_fifovops = {
- .vop_close = nfsfifo_close,
- .vop_access = nfsspec_access,
- .vop_getattr = nfs_getattr,
- .vop_setattr = nfs_setattr,
- .vop_read = nfsfifo_read,
- .vop_write = nfsfifo_write,
- .vop_fsync = nfs_fsync,
- .vop_inactive = nfs_inactive,
- .vop_reclaim = nfsfifo_reclaim,
- .vop_lock = vop_generic_lock,
- .vop_unlock = vop_generic_unlock,
- .vop_print = nfs_print,
- .vop_islocked = vop_generic_islocked,
- .vop_bwrite = vop_generic_bwrite,
-
- /* XXX: Keep in sync with fifo_vops. */
+ .vop_close = nfsfifo_close,
+ .vop_access = nfsspec_access,
+ .vop_getattr = nfs_getattr,
+ .vop_setattr = nfs_setattr,
+ .vop_read = nfsfifo_read,
+ .vop_write = nfsfifo_write,
+ .vop_fsync = nfs_fsync,
+ .vop_inactive = nfs_inactive,
+ .vop_reclaim = nfsfifo_reclaim,
+ .vop_lock = vop_generic_lock,
+ .vop_unlock = vop_generic_unlock,
+ .vop_print = nfs_print,
+ .vop_islocked = vop_generic_islocked,
+ .vop_bwrite = vop_generic_bwrite,
+
+ /* XXX: Keep in sync with fifo_vops. */
.vop_lookup = vop_generic_lookup,
.vop_create = fifo_badop,
.vop_mknod = fifo_badop,
@@ -239,7 +239,7 @@ nfs_null(struct vnode *vp, struct ucred *cred, struct proc *procp)
{
struct nfsm_info info;
int error = 0;
-
+
info.nmi_mb = info.nmi_mreq = nfsm_reqhead(0);
error = nfs_request(vp, NFSPROC_NULL, &info);
m_freem(info.nmi_mrep);
@@ -355,15 +355,15 @@ nfs_access(void *v)
} else
return (nfsspec_access(ap));
-
+
/*
* If we got the same result as for a previous, different request, OR
* it in. Don't update the timestamp in that case.
*/
if (!error || error == EACCES) {
- if (cachevalid && np->n_accstamp != -1 &&
+ if (cachevalid && np->n_accstamp != -1 &&
error == np->n_accerror) {
- if (!error)
+ if (!error)
np->n_accmode |= ap->a_mode;
else {
if ((np->n_accmode & ap->a_mode) == ap->a_mode)
@@ -474,12 +474,12 @@ nfs_open(void *v)
* The current code does the following:
* for NFS Version 2 - play it safe and flush/invalidate all dirty buffers
* for NFS Version 3 - flush dirty buffers to the server but don't invalidate
- * or commit them (this satisfies 1 and 2 except for the
- * case where the server crashes after this close but
- * before the commit RPC, which is felt to be "good
- * enough". Changing the last argument to nfs_flush() to
- * a 1 would force a commit operation, if it is felt a
- * commit is necessary now.
+ * or commit them (this satisfies 1 and 2 except for the
+ * case where the server crashes after this close but
+ * before the commit RPC, which is felt to be "good
+ * enough". Changing the last argument to nfs_flush() to
+ * a 1 would force a commit operation, if it is felt a
+ * commit is necessary now.
*/
int
nfs_close(void *v)
@@ -568,50 +568,50 @@ nfs_setattr(void *v)
/*
* Disallow write attempts if the filesystem is mounted read-only.
*/
- if ((vap->va_uid != (uid_t)VNOVAL ||
+ if ((vap->va_uid != (uid_t)VNOVAL ||
vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) &&
(vp->v_mount->mnt_flag & MNT_RDONLY))
return (EROFS);
if (vap->va_size != VNOVAL) {
- switch (vp->v_type) {
- case VDIR:
- return (EISDIR);
- case VCHR:
- case VBLK:
- case VSOCK:
- case VFIFO:
+ switch (vp->v_type) {
+ case VDIR:
+ return (EISDIR);
+ case VCHR:
+ case VBLK:
+ case VSOCK:
+ case VFIFO:
if (vap->va_mtime.tv_sec == VNOVAL &&
vap->va_atime.tv_sec == VNOVAL &&
vap->va_mode == (mode_t)VNOVAL &&
vap->va_uid == (uid_t)VNOVAL &&
vap->va_gid == (gid_t)VNOVAL)
return (0);
- vap->va_size = VNOVAL;
- break;
- default:
+ vap->va_size = VNOVAL;
+ break;
+ default:
/*
* Disallow write attempts if the filesystem is
* mounted read-only.
*/
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
- if (vap->va_size == 0)
- error = nfs_vinvalbuf(vp, 0,
- ap->a_cred, ap->a_p);
+ if (vap->va_size == 0)
+ error = nfs_vinvalbuf(vp, 0,
+ ap->a_cred, ap->a_p);
else
error = nfs_vinvalbuf(vp, V_SAVE,
- ap->a_cred, ap->a_p);
+ ap->a_cred, ap->a_p);
if (error)
return (error);
- tsize = np->n_size;
- np->n_size = np->n_vattr.va_size = vap->va_size;
+ tsize = np->n_size;
+ np->n_size = np->n_vattr.va_size = vap->va_size;
uvm_vnp_setsize(vp, np->n_size);
- };
- } else if ((vap->va_mtime.tv_sec != VNOVAL ||
+ };
+ } else if ((vap->va_mtime.tv_sec != VNOVAL ||
vap->va_atime.tv_sec != VNOVAL) &&
vp->v_type == VREG &&
- (error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
+ (error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
ap->a_p)) == EINTR)
return (error);
error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p);
@@ -1127,11 +1127,11 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, int *iomode, int *must_commit)
tl = nfsm_build(&info.nmi_mb, 4 * NFSX_UNSIGNED);
/* Set both "begin" and "current" to non-garbage. */
x = txdr_unsigned((u_int32_t)uiop->uio_offset);
- *tl++ = x; /* "begin offset" */
- *tl++ = x; /* "current offset" */
+ *tl++ = x; /* "begin offset" */
+ *tl++ = x; /* "current offset" */
x = txdr_unsigned(len);
- *tl++ = x; /* total to this offset */
- *tl = x; /* size of this write */
+ *tl++ = x; /* total to this offset */
+ *tl = x; /* size of this write */
}
nfsm_uiotombuf(&info.nmi_mb, uiop, len);
@@ -1179,14 +1179,14 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, int *iomode, int *must_commit)
commit == NFSV3WRITE_UNSTABLE)
committed = commit;
if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0) {
- bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf,
- NFSX_V3WRITEVERF);
- nmp->nm_flag |= NFSMNT_HASWRITEVERF;
+ bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf,
+ NFSX_V3WRITEVERF);
+ nmp->nm_flag |= NFSMNT_HASWRITEVERF;
} else if (bcmp((caddr_t)tl,
(caddr_t)nmp->nm_verf, NFSX_V3WRITEVERF)) {
- *must_commit = 1;
- bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf,
- NFSX_V3WRITEVERF);
+ *must_commit = 1;
+ bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf,
+ NFSX_V3WRITEVERF);
}
} else {
nfsm_loadattr(vp, NULL);
@@ -1549,7 +1549,7 @@ nfsmout:
int
nfs_rename(void *v)
{
- struct vop_rename_args *ap = v;
+ struct vop_rename_args *ap = v;
struct vnode *fvp = ap->a_fvp;
struct vnode *tvp = ap->a_tvp;
struct vnode *fdvp = ap->a_fdvp;
@@ -1944,7 +1944,7 @@ struct nfs_dirent {
struct dirent dirent;
};
-#define NFS_DIRHDSIZ (sizeof (struct nfs_dirent) - (MAXNAMLEN + 1))
+#define NFS_DIRHDSIZ (sizeof (struct nfs_dirent) - (MAXNAMLEN + 1))
#define NFS_DIRENT_OVERHEAD offsetof(struct nfs_dirent, dirent)
/*
@@ -2022,7 +2022,7 @@ nfs_readdir(void *v)
readdir_uio.uio_procp = curproc;
if (nmp->nm_flag & NFSMNT_RDIRPLUS) {
- error = nfs_readdirplusrpc(vp, &readdir_uio, cred,
+ error = nfs_readdirplusrpc(vp, &readdir_uio, cred,
&eof);
if (error == NFSERR_NOTSUPP)
nmp->nm_flag &= ~NFSMNT_RDIRPLUS;
@@ -2033,7 +2033,7 @@ nfs_readdir(void *v)
if (error == NFSERR_BAD_COOKIE)
error = EINVAL;
- while (error == 0 &&
+ while (error == 0 &&
(ap->a_cookies == NULL || ncookies != 0) &&
ndp < (struct nfs_dirent *)readdir_iovec.iov_base) {
struct dirent *dp = &ndp->dirent;
@@ -2048,11 +2048,11 @@ nfs_readdir(void *v)
}
error = uiomove((caddr_t)dp, dp->d_reclen, uio);
- if (error)
+ if (error)
break;
-
+
newoff = fxdr_hyper(&ndp->cookie[0]);
-
+
if (ap->a_cookies != NULL) {
*cookies = newoff;
cookies++;
@@ -2065,7 +2065,7 @@ nfs_readdir(void *v)
free(data, M_TEMP);
data = NULL;
-
+
if (ap->a_cookies) {
if (error) {
free(*ap->a_cookies, M_TEMP);
@@ -2075,8 +2075,8 @@ nfs_readdir(void *v)
*ap->a_ncookies -= ncookies;
}
}
-
- if (!error)
+
+ if (!error)
uio->uio_offset = newoff;
if (!error && (eof || uio->uio_resid == tresid)) {
@@ -2119,7 +2119,7 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
info.nmi_v3 = NFS_ISV3(vp);
#ifdef DIAGNOSTIC
- if (uiop->uio_iovcnt != 1 ||
+ if (uiop->uio_iovcnt != 1 ||
(uiop->uio_resid & (NFS_DIRBLKSIZ - 1)))
panic("nfs readdirrpc bad uio");
#endif
@@ -2174,7 +2174,7 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
more_dirs = fxdr_unsigned(int, *tl);
-
+
/* loop thru the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
if (info.nmi_v3) {
@@ -2292,7 +2292,7 @@ nfsmout:
* NFS V3 readdir plus RPC. Used in place of nfs_readdirrpc().
*/
int
-nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
+nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
int *end_of_directory)
{
int len, left;
@@ -2316,7 +2316,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
int attrflag, fhsize;
#ifdef DIAGNOSTIC
- if (uiop->uio_iovcnt != 1 ||
+ if (uiop->uio_iovcnt != 1 ||
(uiop->uio_resid & (NFS_DIRBLKSIZ - 1)))
panic("nfs readdirplusrpc bad uio");
#endif
@@ -2324,8 +2324,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
newvp = NULLVP;
txdr_hyper(uiop->uio_offset, &cookie.nfsuquad[0]);
-
- /*
+
+ /*
* Loop around doing readdir rpc's of size nm_readdirsize
* truncated to a multiple of NFS_READDIRBLKSIZ.
* The stopping criteria is EOF or buffer full.
@@ -2334,7 +2334,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
nfsstats.rpccnt[NFSPROC_READDIRPLUS]++;
info.nmi_mb = info.nmi_mreq = nfsm_reqhead(NFSX_FH(1) + 6 * NFSX_UNSIGNED);
nfsm_fhtom(&info, vp, 1);
- tl = nfsm_build(&info.nmi_mb, 6 * NFSX_UNSIGNED);
+ tl = nfsm_build(&info.nmi_mb, 6 * NFSX_UNSIGNED);
*tl++ = cookie.nfsuquad[0];
*tl++ = cookie.nfsuquad[1];
if (cookie.nfsuquad[0] == 0 &&
@@ -2361,7 +2361,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
dnp->n_cookieverf.nfsuquad[0] = *tl++;
dnp->n_cookieverf.nfsuquad[1] = *tl++;
more_dirs = fxdr_unsigned(int, *tl);
-
+
/* loop thru the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
@@ -2425,52 +2425,52 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
*/
attrflag = fxdr_unsigned(int, *tl);
if (attrflag) {
- dpossav1 = info.nmi_dpos;
- mdsav1 = info.nmi_md;
- nfsm_adv(NFSX_V3FATTR);
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
- doit = fxdr_unsigned(int, *tl);
- if (doit) {
- nfsm_getfh(fhp, fhsize, 1);
- if (NFS_CMPFH(dnp, fhp, fhsize)) {
- vref(vp);
- newvp = vp;
- np = dnp;
- } else {
- error = nfs_nget(vp->v_mount, fhp,
- fhsize, &np);
- if (error)
- doit = 0;
- else
- newvp = NFSTOV(np);
+ dpossav1 = info.nmi_dpos;
+ mdsav1 = info.nmi_md;
+ nfsm_adv(NFSX_V3FATTR);
+ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ doit = fxdr_unsigned(int, *tl);
+ if (doit) {
+ nfsm_getfh(fhp, fhsize, 1);
+ if (NFS_CMPFH(dnp, fhp, fhsize)) {
+ vref(vp);
+ newvp = vp;
+ np = dnp;
+ } else {
+ error = nfs_nget(vp->v_mount,
+ fhp, fhsize, &np);
+ if (error)
+ doit = 0;
+ else
+ newvp = NFSTOV(np);
+ }
}
- }
- if (doit && bigenough) {
- dpossav2 = info.nmi_dpos;
- info.nmi_dpos = dpossav1;
- mdsav2 = info.nmi_md;
- info.nmi_md = mdsav1;
- nfsm_loadattr(newvp, NULL);
- info.nmi_dpos = dpossav2;
- info.nmi_md = mdsav2;
- dp->d_type =
- IFTODT(VTTOIF(np->n_vattr.va_type));
- if (cnp->cn_namelen <= NCHNAMLEN) {
- ndp->ni_vp = newvp;
- cache_purge(ndp->ni_dvp);
- nfs_cache_enter(ndp->ni_dvp, ndp->ni_vp,
- cnp);
+ if (doit && bigenough) {
+ dpossav2 = info.nmi_dpos;
+ info.nmi_dpos = dpossav1;
+ mdsav2 = info.nmi_md;
+ info.nmi_md = mdsav1;
+ nfsm_loadattr(newvp, NULL);
+ info.nmi_dpos = dpossav2;
+ info.nmi_md = mdsav2;
+ dp->d_type = IFTODT(
+ VTTOIF(np->n_vattr.va_type));
+ if (cnp->cn_namelen <= NCHNAMLEN) {
+ ndp->ni_vp = newvp;
+ cache_purge(ndp->ni_dvp);
+ nfs_cache_enter(ndp->ni_dvp,
+ ndp->ni_vp, cnp);
+ }
}
- }
} else {
- /* Just skip over the file handle */
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
- i = fxdr_unsigned(int, *tl);
- nfsm_adv(nfsm_rndup(i));
+ /* Just skip over the file handle */
+ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ i = fxdr_unsigned(int, *tl);
+ nfsm_adv(nfsm_rndup(i));
}
if (newvp != NULLVP) {
- vrele(newvp);
- newvp = NULLVP;
+ vrele(newvp);
+ newvp = NULLVP;
}
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
more_dirs = fxdr_unsigned(int, *tl);
@@ -2612,22 +2612,22 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred,
if (npp && !error) {
nfsm_getfh(nfhp, fhlen, info.nmi_v3);
if (*npp) {
- np = *npp;
- np->n_fhp = &np->n_fh;
- bcopy((caddr_t)nfhp, (caddr_t)np->n_fhp, fhlen);
- np->n_fhsize = fhlen;
- newvp = NFSTOV(np);
+ np = *npp;
+ np->n_fhp = &np->n_fh;
+ bcopy((caddr_t)nfhp, (caddr_t)np->n_fhp, fhlen);
+ np->n_fhsize = fhlen;
+ newvp = NFSTOV(np);
} else if (NFS_CMPFH(dnp, nfhp, fhlen)) {
- vref(dvp);
- newvp = dvp;
- np = dnp;
+ vref(dvp);
+ newvp = dvp;
+ np = dnp;
} else {
- error = nfs_nget(dvp->v_mount, nfhp, fhlen, &np);
- if (error) {
- m_freem(info.nmi_mrep);
- return (error);
- }
- newvp = NFSTOV(np);
+ error = nfs_nget(dvp->v_mount, nfhp, fhlen, &np);
+ if (error) {
+ m_freem(info.nmi_mrep);
+ return (error);
+ }
+ newvp = NFSTOV(np);
}
if (info.nmi_v3) {
nfsm_postop_attr(newvp, attrflag);
@@ -2640,7 +2640,7 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred,
nfsm_loadattr(newvp, NULL);
}
m_freem(info.nmi_mrep);
-nfsmout:
+nfsmout:
if (npp && *npp == NULL) {
if (error) {
if (newvp)
@@ -2663,7 +2663,7 @@ nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct proc *procp)
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
caddr_t cp2;
int error = 0, wccflag = NFSV3_WCCRATTR;
-
+
if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0)
return (0);
nfsstats.rpccnt[NFSPROC_COMMIT]++;
@@ -2691,7 +2691,7 @@ nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct proc *procp)
}
m_freem(info.nmi_mrep);
-nfsmout:
+nfsmout:
return (error);
}
@@ -2760,7 +2760,7 @@ nfs_fsync(void *v)
/*
* Flush all the blocks associated with a vnode.
- * Walk through the buffer pool and push any dirty pages
+ * Walk through the buffer pool and push any dirty pages
* associated with the vnode.
*/
int
@@ -2841,20 +2841,20 @@ again:
bp = bvec[i];
bp->b_flags &= ~(B_NEEDCOMMIT | B_WRITEINPROG);
if (retv) {
- if (i == 0)
- bcstats.pendingwrites--;
- brelse(bp);
+ if (i == 0)
+ bcstats.pendingwrites--;
+ brelse(bp);
} else {
- if (i > 0)
- bcstats.pendingwrites++;
- s = splbio();
- buf_undirty(bp);
- vp->v_numoutput++;
- bp->b_flags |= B_ASYNC;
- bp->b_flags &= ~(B_READ|B_DONE|B_ERROR);
- bp->b_dirtyoff = bp->b_dirtyend = 0;
- biodone(bp);
- splx(s);
+ if (i > 0)
+ bcstats.pendingwrites++;
+ s = splbio();
+ buf_undirty(bp);
+ vp->v_numoutput++;
+ bp->b_flags |= B_ASYNC;
+ bp->b_flags &= ~(B_READ|B_DONE|B_ERROR);
+ bp->b_dirtyoff = bp->b_dirtyend = 0;
+ biodone(bp);
+ splx(s);
}
}
}
@@ -2874,12 +2874,12 @@ loop:
"nfsfsync", slptimeo);
splx(s);
if (error) {
- if (nfs_sigintr(nmp, NULL, p))
- return (EINTR);
- if (slpflag == PCATCH) {
- slpflag = 0;
- slptimeo = 2 * hz;
- }
+ if (nfs_sigintr(nmp, NULL, p))
+ return (EINTR);
+ if (slpflag == PCATCH) {
+ slpflag = 0;
+ slptimeo = 2 * hz;
+ }
}
goto loop;
}
@@ -2905,7 +2905,7 @@ loop:
}
if (waitfor == MNT_WAIT) {
loop2:
- s = splbio();
+ s = splbio();
error = vwaitforio(vp, slpflag, "nfs_fsync", slptimeo);
splx(s);
if (error) {
@@ -3099,7 +3099,7 @@ nfs_writebp(struct buf *bp, int force)
}
brelse(bp);
return (rtval);
- }
+ }
return (0);
}
@@ -3117,7 +3117,7 @@ nfsspec_access(void *v)
struct vnode *vp = ap->a_vp;
int error;
- /*
+ /*
* Disallow write attempts on filesystems mounted read-only;
* unless the file is a socket, fifo, or a block or character
* device resident on the filesystem.