Lines Matching +full:2 +full:nd
15 * 2. Redistributions in binary form must reproduce the above copyright
106 * 2 - uses cfh and sfh
110 * 2 - uses a cfh and wants pre-op attributes
124 { 0, 2, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Commit */
125 { 1, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Create */
130 { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Link */
134 { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookup */
135 { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookupp */
147 { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Remove */
148 { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Rename */
153 { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */
156 { 0, 2, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Verify (AppWrite) */
157 { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */
179 { 2, 1, 1, 0, LK_SHARED, 1, 0 }, /* Copy */
181 { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Deallocate */
225 static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep);
242 { NFSV4OP_SETATTR, 2, "Setattr", 7, },
244 { NFSV4OP_ACCESS, 2, "Access", 6, },
245 { NFSV4OP_READLINK, 2, "Readlink", 8, },
247 { NFSV4OP_WRITE, 2, "Write", 5, },
256 { NFSV4OP_READDIR, 2, "Readdir", 7, },
257 { NFSV4OP_READDIR, 2, "Readdir", 7, },
261 { NFSV4OP_COMMIT, 2, "Commit", 6, },
267 { NFSV4OP_OPEN, 2, "Open", 4, },
297 { NFSV4OP_ALLOCATE, 2, "Allocate", 8, },
299 { NFSV4OP_SEEK, 2, "Seek", 4, },
301 { NFSV4OP_GETXATTR, 2, "Getxattr", 8, },
302 { NFSV4OP_SETXATTR, 2, "Setxattr", 8, },
303 { NFSV4OP_REMOVEXATTR, 2, "Rmxattr", 7, },
304 { NFSV4OP_LISTXATTRS, 2, "Listxattr", 9, },
307 { NFSV4OP_DEALLOCATE, 2, "Deallocate", 10, },
327 nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
337 * First, fill in some of the fields of nd.
339 nd->nd_slotseq = NULL;
341 nd->nd_flag = ND_NFSV4 | ND_NFSCL;
343 nd->nd_flag |= ND_NFSV41;
345 nd->nd_flag |= (ND_NFSV41 | ND_NFSV42);
347 nd->nd_flag = ND_NFSV3 | ND_NFSCL;
350 nd->nd_flag = ND_NFSV4 | ND_NFSCL;
352 nd->nd_flag |= ND_NFSV41;
353 else if (nmp->nm_minorvers == 2)
354 nd->nd_flag |= (ND_NFSV41 | ND_NFSV42);
356 nd->nd_flag = ND_NFSV3 | ND_NFSCL;
358 nd->nd_flag = ND_NFSV2 | ND_NFSCL;
360 nd->nd_procnum = procnum;
361 nd->nd_repstat = 0;
362 nd->nd_maxextsiz = 0;
372 nd->nd_mreq = nd->nd_mb = mb;
373 nd->nd_bpos = mtod(mb, char *);
382 if (nd->nd_flag & ND_NFSV4) {
385 if ((nd->nd_flag & ND_NFSV41) != 0) {
405 (void) nfsm_strtom(nd, nfsv4_opmap[procnum].tag,
407 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
408 if ((nd->nd_flag & ND_NFSV42) != 0)
410 else if ((nd->nd_flag & ND_NFSV41) != 0)
417 if ((nd->nd_flag & ND_NFSV41) != 0 &&
421 nd->nd_flag |= ND_LOOPBADSESS;
432 nfsv4_setsequence(nmp, nd, sep,
435 nfsv4_setsequence(nmp, nd, sep,
441 (void)nfsm_fhtom(nmp, nd, nfhp, fhlen, 0);
443 == 2 && procnum != NFSPROC_WRITEDS &&
461 nd->nd_flag |= ND_V4WCCATTR;
463 (void) nfsrv_putattrbit(nd, &attrbits);
467 (nd->nd_flag & ND_NFSV41) == 0) {
472 (void)nfsm_fhtom(NULL, nd, nfhp, fhlen, 0);
483 nfsm_stateidtom(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp, int flag)
492 st->other[2] = 0;
497 st->other[2] = 0xffffffff;
502 st->other[2] = stateidp->other[2];
507 st->other[2] = stateidp->other[2];
516 nfscl_fillsattr(struct nfsrv_descript *nd, struct vattr *vap,
524 switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) {
552 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
560 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
568 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
642 (void) nfsv4_fillattr(nd, vp->v_mount, vp, NULL, vap, NULL, 0,
652 nfsm_mbufuio(struct nfsrv_descript *nd, struct uio *uiop, int siz)
660 mp = nd->nd_md;
661 mbufcp = nd->nd_dpos;
711 nd->nd_dpos = mbufcp;
712 nd->nd_md = mp;
715 error = nfsm_advance(nd, rem, len);
717 nd->nd_dpos += rem;
721 NFSEXITCODE2(error, nd);
732 nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)
741 left = mtod(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos;
743 nd->nd_md = nd->nd_md->m_next;
744 if (nd->nd_md == NULL)
746 left = nd->nd_md->m_len;
747 nd->nd_dpos = mtod(nd->nd_md, caddr_t);
750 retp = nd->nd_dpos;
751 nd->nd_dpos += siz;
752 } else if (nd->nd_md->m_next == NULL) {
760 mp2->m_next = nd->nd_md->m_next;
761 nd->nd_md->m_next = mp2;
762 nd->nd_md->m_len -= left;
763 nd->nd_md = mp2;
765 NFSBCOPY(nd->nd_dpos, p, left); /* Copy what was left */
784 nd->nd_md->m_len = siz;
785 nd->nd_md = mp2;
786 nd->nd_dpos = mtod(mp2, caddr_t);
798 nfsm_advance(struct nfsrv_descript *nd, int offs, int left)
818 left = mtod(nd->nd_md, caddr_t) + nd->nd_md->m_len -
819 nd->nd_dpos;
826 nd->nd_md = nd->nd_md->m_next;
827 if (nd->nd_md == NULL) {
831 left = nd->nd_md->m_len;
832 nd->nd_dpos = mtod(nd->nd_md, caddr_t);
834 nd->nd_dpos += offs;
846 nfsm_strtom(struct nfsrv_descript *nd, const char *cp, int siz)
859 m2 = nd->nd_mb;
860 cp2 = nd->nd_bpos;
861 if ((nd->nd_flag & ND_EXTPG) != 0)
862 left = nd->nd_bextpgsiz;
867 (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) != 0) ||
869 (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) == 0),
876 if ((nd->nd_flag & ND_EXTPG) != 0) {
878 nd->nd_maxextsiz, &nd->nd_bextpg);
880 m2->m_epg_pa[nd->nd_bextpg]);
881 nd->nd_bextpgsiz = left = PAGE_SIZE;
904 if ((nd->nd_flag & ND_EXTPG) != 0) {
905 nd->nd_bextpgsiz -= xfer;
914 if ((nd->nd_flag & ND_EXTPG) != 0) {
915 nd->nd_bextpgsiz -= rem;
920 nd->nd_mb = m2;
921 if ((nd->nd_flag & ND_EXTPG) != 0)
922 nd->nd_bpos = cp2;
924 nd->nd_bpos = mtod(m2, char *) + m2->m_len;
961 nfsm_fhtom(struct nfsmount *nmp, struct nfsrv_descript *nd, u_int8_t *fhp,
972 switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) {
991 bytesize = 2 * NFSX_UNSIGNED + fullsiz;
997 (void) nfsm_strtom(nd, fhp, size);
1085 nfsm_getfh(struct nfsrv_descript *nd, struct nfsfh **nfhpp)
1092 if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) {
1103 error = nfsrv_mtostr(nd, nfhp->nfh_fh, len);
1111 NFSEXITCODE2(error, nd);
1120 nfsrv_dissectacl(struct nfsrv_descript *nd, NFSACL_T *aclp, bool server,
1151 error = nfsrv_dissectace(nd, &aclp->acl_entry[i],
1154 error = nfsrv_skipace(nd, &acesize);
1166 NFSEXITCODE2(error, nd);
1174 nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep)
1181 error = nfsm_advance(nd, NFSM_RNDUP(len), -1);
1184 NFSEXITCODE2(error, nd);
1194 nfsrv_getattrbits(struct nfsrv_descript *nd, nfsattrbit_t *attrbitp, int *cntp,
1225 NFSEXITCODE2(error, nd);
1234 nfsrv_getopbits(struct nfsrv_descript *nd, nfsopbit_t *opbitp, int *cntp)
1266 NFSEXITCODE2(error, nd);
1281 nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
1310 error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup);
1312 error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL);
1391 error = nfsrv_getattrbits(nd, &retattrbits,
1394 error = nfsrv_getattrbits(nd, &nap->na_suppattr,
1399 NFSSETSUPP_ATTRBIT(&checkattrbits, nd);
1508 tl += 2;
1560 error = nfsrv_dissectacl(nd, naclp, true,
1571 error = nfsrv_dissectacl(nd, NULL, true,
1580 error = nfsrv_dissectacl(nd, aclp, false,
1583 error = nfsrv_dissectacl(nd, NULL, false,
1670 error = nfsm_getfh(nd, &tnfhp);
1733 error = nfsrv_getrefstr(nd, &cp, &cp2, &l, &m);
1865 error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
1920 error = nfsrv_mtostr(nd, cp, j);
1928 if (nfsv4_strtouid(nd, cp, j, &uid) ||
1933 if (nfsv4_strtouid(nd, cp, j, &uid))
1954 error = nfsrv_mtostr(nd, cp, j);
1962 if (nfsv4_strtogid(nd, cp, j, &gid) ||
1967 if (nfsv4_strtogid(nd, cp, j, &gid))
2184 (fxdr_unsigned(u_int32_t, *(tl + 2)) %
2248 error = nfsrv_getattrbits(nd, &retattrbits,
2253 NFSSETSUPP_ATTRBIT(&checkattrbits, nd);
2254 NFSCLRNOTSETABLE_ATTRBIT(&checkattrbits, nd);
2346 error = nfsm_advance(nd, attrsize - attrsum, -1);
2350 NFSEXITCODE2(error, nd);
2448 * with the 2nd argument == 0 should be done before calling nfsv4_getref().
2524 nfsrv_mtostr(struct nfsrv_descript *nd, char *str, int siz)
2531 mp = nd->nd_md;
2532 cp = nd->nd_dpos;
2557 nd->nd_dpos = cp;
2558 nd->nd_md = mp;
2561 error = nfsm_advance(nd, rem, len);
2563 nd->nd_dpos += rem;
2567 NFSEXITCODE2(error, nd);
2575 nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
2611 NFSCLRNOTSETABLE_ATTRBIT(retbitp, nd);
2614 NFSCLRNOTFILLABLE_ATTRBIT(retbitp, nd);
2627 nd->nd_repstat = NFSERR_ACCES;
2669 nd->nd_repstat = NFSERR_ACCES;
2694 prefixnum = nfsrv_putattrbit(nd, retbitp);
2705 NFSSETSUPP_ATTRBIT(&attrbits, nd);
2711 retnum += nfsrv_putattrbit(nd, &attrbits);
2781 retnum += nfsrv_buildacl(nd, aclp, vp->v_type, p);
2812 retnum += nfsm_fhtom(NULL, nd, (u_int8_t *)fhp, 0, 0);
2840 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
2843 retnum += 2 * NFSX_UNSIGNED;
2899 retnum += nfsm_strtom(nd, cp, siz);
2906 retnum += nfsm_strtom(nd, cp, siz);
3095 NFSSETSUPP_ATTRBIT(&attrbits, nd);
3096 NFSCLRNOTSETABLE_ATTRBIT(&attrbits, nd);
3098 retnum += nfsrv_putattrbit(nd, &attrbits);
3105 siz = 2;
3106 if (siz == 2) {
3107 NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3136 NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
3145 retnum += 2 * NFSX_UNSIGNED;
3219 nfsrv_putattrbit(struct nfsrv_descript *nd, nfsattrbit_t *attrbitp)
3240 nfsrv_putopbit(struct nfsrv_descript *nd, nfsopbit_t *opbitp)
3350 if (ret == 0 && cnt < 2)
3414 if (ret == 0 && cnt < 2)
3429 nfsv4_strtouid(struct nfsrv_descript *nd, u_char *str, int len, uid_t *uidp)
3449 if ((nd->nd_flag & ND_KERBV) == 0 &&
3450 ((nd->nd_flag & ND_NFSCL) != 0 ||
3515 if (ret == 0 && cnt < 2)
3619 if (ret == 0 && cnt < 2)
3653 nfsv4_strtogid(struct nfsrv_descript *nd, u_char *str, int len, gid_t *gidp)
3673 if ((nd->nd_flag & ND_KERBV) == 0 &&
3674 ((nd->nd_flag & ND_NFSCL) != 0 ||
3737 if (ret == 0 && cnt < 2)
3866 struct nfsrv_descript *nd;
3886 nd = &nfsd;
3888 nd->nd_flag = ND_GSSINITREPLY;
3889 nfsrvd_rephead(nd);
3891 nd->nd_procnum = procnum;
3900 (void) nfsm_strtom(nd, name, len);
3902 error = newnfs_request(nd, NULL, NULL, &NFSD_VNET(nfsrv_nfsuserdsock),
3912 m_freem(nd->nd_mrep);
3913 error = nd->nd_repstat;
3921 * This function is called from the nfssvc(2) system call, to update the
4416 if (cnt == 2 && val == 0xd)
4444 nfsrv_getrefstr(struct nfsrv_descript *nd, u_char **fsrootp, u_char **srvp,
4478 *sump = 2 * NFSX_UNSIGNED;
4483 error = nfsrv_mtostr(nd, cp, len);
4496 xdrsum = (2 * NFSX_UNSIGNED) + NFSM_RNDUP(len);
4523 error = nfsrv_mtostr(nd, cp3, len);
4529 xdrsum += (2 * NFSX_UNSIGNED) + NFSM_RNDUP(len);
4542 error = nfsrv_mtostr(nd, lsp->host, len);
4560 error = nfsrv_mtostr(nd, cp3, len);
4578 siz += (lsp->len + stringlen + 2);
4585 NFSEXITCODE2(0, nd);
4592 NFSEXITCODE2(error, nd);
4621 nfsrvd_rephead(struct nfsrv_descript *nd)
4625 if ((nd->nd_flag & ND_EXTPG) != 0) {
4627 nd->nd_mreq = nd->nd_mb = mreq;
4628 nd->nd_bpos = (char *)(void *)
4630 nd->nd_bextpg = 0;
4631 nd->nd_bextpgsiz = PAGE_SIZE;
4636 if ((nd->nd_flag & ND_GSSINITREPLY) == 0 &&
4637 nfs_bigreply[nd->nd_procnum]) {
4639 nd->nd_mreq = mreq;
4640 nd->nd_mb = mreq;
4643 nd->nd_mreq = mreq;
4644 nd->nd_mb = mreq;
4646 nd->nd_bpos = mtod(mreq, char *);
4650 if ((nd->nd_flag & ND_GSSINITREPLY) == 0)
4651 NFSM_BUILD(nd->nd_errp, int *, NFSX_UNSIGNED);
4695 nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_in *sin,
4709 error = nfsrv_mtostr(nd, protocol, i);
4729 error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
4743 error = nfsrv_mtostr(nd, addr, i);
4755 if (k == 2)
4760 if (k == 2) {
4799 error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
4902 nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd,
4919 nd->nd_maxreq = sep->nfsess_maxreq;
4920 nd->nd_maxresp = sep->nfsess_maxresp;
4924 nd->nd_sequence = tl;
4927 nd->nd_slotseq = tl;
4929 nd->nd_flag |= ND_HASSLOTID;
4930 nd->nd_slotid = slotpos;
4952 nd->nd_flag |= ND_HASSEQUENCE;
5085 nfsm_set(struct nfsrv_descript *nd, u_int offs)
5090 m = nd->nd_mb;
5092 nd->nd_bextpg = 0;
5094 if (nd->nd_bextpg == 0)
5097 rlen = m_epg_pagelen(m, nd->nd_bextpg, 0);
5101 nd->nd_bextpg++;
5102 if (nd->nd_bextpg == m->m_epg_npgs) {
5105 nd->nd_bextpg--;
5109 nd->nd_bpos = (char *)(void *)
5110 PHYS_TO_DMAP(m->m_epg_pa[nd->nd_bextpg]);
5111 if (nd->nd_bextpg == 0)
5112 nd->nd_bpos += m->m_epg_1st_off;
5114 nd->nd_bpos += offs;
5115 nd->nd_bextpgsiz = rlen - offs;
5116 } else if (nd->nd_bextpg == 0)
5117 nd->nd_bextpgsiz = PAGE_SIZE - m->m_epg_1st_off;
5119 nd->nd_bextpgsiz = PAGE_SIZE;
5121 nd->nd_bpos = mtod(m, char *) + offs;
5159 struct nfsrv_descript *nd = &nfsd;
5166 nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
5170 nd->nd_flag |= ND_USEGSSNAME;
5171 error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
5175 error = nd->nd_repstat;
5176 m_freem(nd->nd_mrep);