Deleted Added
full compact
nfs_clrpcops.c (265466) nfs_clrpcops.c (265469)
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: stable/10/sys/fs/nfsclient/nfs_clrpcops.c 265466 2014-05-06 21:47:43Z rmacklem $");
35__FBSDID("$FreeBSD: stable/10/sys/fs/nfsclient/nfs_clrpcops.c 265469 2014-05-06 21:54:52Z rmacklem $");
36
37/*
38 * Rpc op calls, generally called from the vnode op calls or through the
39 * buffer cache, for NFS v2, 3 and 4.
40 * These do not normally make any changes to vnode arguments or use
41 * structures that might change between the VFS variants. The returned
42 * arguments are all at the end, after the NFSPROC_T *p one.
43 */

--- 2496 unchanged lines hidden (view full) ---

2540 struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap,
2541 struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp,
2542 int *dattrflagp, void *dstuff)
2543{
2544 u_int32_t *tl;
2545 struct nfsrv_descript nfsd, *nd = &nfsd;
2546 nfsattrbit_t attrbits;
2547 int error = 0;
36
37/*
38 * Rpc op calls, generally called from the vnode op calls or through the
39 * buffer cache, for NFS v2, 3 and 4.
40 * These do not normally make any changes to vnode arguments or use
41 * structures that might change between the VFS variants. The returned
42 * arguments are all at the end, after the NFSPROC_T *p one.
43 */

--- 2496 unchanged lines hidden (view full) ---

2540 struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap,
2541 struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp,
2542 int *dattrflagp, void *dstuff)
2543{
2544 u_int32_t *tl;
2545 struct nfsrv_descript nfsd, *nd = &nfsd;
2546 nfsattrbit_t attrbits;
2547 int error = 0;
2548 struct nfsfh *fhp;
2548
2549 *nfhpp = NULL;
2550 *attrflagp = 0;
2551 *dattrflagp = 0;
2549
2550 *nfhpp = NULL;
2551 *attrflagp = 0;
2552 *dattrflagp = 0;
2553 fhp = VTONFS(dvp)->n_fhp;
2552 if (namelen > NFS_MAXNAMLEN)
2553 return (ENAMETOOLONG);
2554 NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp);
2555 if (nd->nd_flag & ND_NFSV4) {
2556 NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2557 *tl = txdr_unsigned(NFDIR);
2558 }
2559 (void) nfsm_strtom(nd, name, namelen);
2560 nfscl_fillsattr(nd, vap, dvp, NFSSATTR_SIZENEG1, 0);
2561 if (nd->nd_flag & ND_NFSV4) {
2562 NFSGETATTR_ATTRBIT(&attrbits);
2563 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2564 *tl++ = txdr_unsigned(NFSV4OP_GETFH);
2565 *tl = txdr_unsigned(NFSV4OP_GETATTR);
2566 (void) nfsrv_putattrbit(nd, &attrbits);
2554 if (namelen > NFS_MAXNAMLEN)
2555 return (ENAMETOOLONG);
2556 NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp);
2557 if (nd->nd_flag & ND_NFSV4) {
2558 NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2559 *tl = txdr_unsigned(NFDIR);
2560 }
2561 (void) nfsm_strtom(nd, name, namelen);
2562 nfscl_fillsattr(nd, vap, dvp, NFSSATTR_SIZENEG1, 0);
2563 if (nd->nd_flag & ND_NFSV4) {
2564 NFSGETATTR_ATTRBIT(&attrbits);
2565 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2566 *tl++ = txdr_unsigned(NFSV4OP_GETFH);
2567 *tl = txdr_unsigned(NFSV4OP_GETATTR);
2568 (void) nfsrv_putattrbit(nd, &attrbits);
2569 NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2570 *tl = txdr_unsigned(NFSV4OP_PUTFH);
2571 (void) nfsm_fhtom(nd, fhp->nfh_fh, fhp->nfh_len, 0);
2572 NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2573 *tl = txdr_unsigned(NFSV4OP_GETATTR);
2574 (void) nfsrv_putattrbit(nd, &attrbits);
2567 }
2568 error = nfscl_request(nd, dvp, p, cred, dstuff);
2569 if (error)
2570 return (error);
2571 if (nd->nd_flag & ND_NFSV4)
2572 error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff);
2573 if (!nd->nd_repstat && !error) {
2574 if (nd->nd_flag & ND_NFSV4) {
2575 NFSM_DISSECT(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
2576 error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL);
2577 }
2578 if (!error)
2579 error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp);
2575 }
2576 error = nfscl_request(nd, dvp, p, cred, dstuff);
2577 if (error)
2578 return (error);
2579 if (nd->nd_flag & ND_NFSV4)
2580 error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff);
2581 if (!nd->nd_repstat && !error) {
2582 if (nd->nd_flag & ND_NFSV4) {
2583 NFSM_DISSECT(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
2584 error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL);
2585 }
2586 if (!error)
2587 error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp);
2588 if (error == 0 && (nd->nd_flag & ND_NFSV4) != 0) {
2589 /* Get rid of the PutFH and Getattr status values. */
2590 NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
2591 /* Load the directory attributes. */
2592 error = nfsm_loadattr(nd, dnap);
2593 if (error == 0)
2594 *dattrflagp = 1;
2595 }
2580 }
2581 if ((nd->nd_flag & ND_NFSV3) && !error)
2582 error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff);
2583 if (nd->nd_repstat && !error)
2584 error = nd->nd_repstat;
2585nfsmout:
2586 mbuf_freem(nd->nd_mrep);
2587 /*

--- 3309 unchanged lines hidden ---
2596 }
2597 if ((nd->nd_flag & ND_NFSV3) && !error)
2598 error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff);
2599 if (nd->nd_repstat && !error)
2600 error = nd->nd_repstat;
2601nfsmout:
2602 mbuf_freem(nd->nd_mrep);
2603 /*

--- 3309 unchanged lines hidden ---