Fix for creating files on a Solaris 7 server with NFSv3 (the request was
slightly garbled but older servers seemed to understand it). Reviewed by: David O'Brien <obrien@nuxi.ucdavis.edu>
This commit is contained in:
parent
cd7eb1f87b
commit
eac8a67b28
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
|
||||
* $Id: nfsm_subs.h,v 1.20 1998/05/31 19:00:19 peter Exp $
|
||||
* $Id: nfsm_subs.h,v 1.21 1998/05/31 20:08:57 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -235,17 +235,68 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
|
||||
(f) = ttattrf; \
|
||||
} }
|
||||
|
||||
#define nfsm_v3sattr(s, a) \
|
||||
{ (s)->sa_modetrue = nfs_true; \
|
||||
(s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
|
||||
(s)->sa_uidfalse = nfs_false; \
|
||||
(s)->sa_gidfalse = nfs_false; \
|
||||
(s)->sa_sizefalse = nfs_false; \
|
||||
(s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \
|
||||
(s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \
|
||||
/* If full is true, set all fields, otherwise just set mode and time fields */
|
||||
#define nfsm_v3attrbuild(a, full) \
|
||||
{ if ((a)->va_mode != (mode_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_mode); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_uid != (uid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_uid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_gid != (gid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_gid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_size != VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
txdr_hyper(&(a)->va_size, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((a)->va_atime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_atime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
if ((a)->va_mtime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_mtime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define nfsm_strsiz(s,m) \
|
||||
{ nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.113 1998/11/13 22:58:48 msmith Exp $
|
||||
* $Id: nfs_vnops.c,v 1.114 1998/11/15 20:36:16 msmith Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -718,64 +718,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
|
||||
nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH(v3) + NFSX_SATTR(v3));
|
||||
nfsm_fhtom(vp, v3);
|
||||
if (v3) {
|
||||
if (vap->va_mode != (mode_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_mode);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_uid != (uid_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_uid);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_gid != (gid_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_gid);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_size != VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
txdr_hyper(&vap->va_size, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_atime.tv_sec != VNOVAL) {
|
||||
if (vap->va_atime.tv_sec != time_second) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||
txdr_nfsv3time(&vap->va_atime, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
|
||||
}
|
||||
if (vap->va_mtime.tv_sec != VNOVAL) {
|
||||
if (vap->va_mtime.tv_sec != time_second) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||
txdr_nfsv3time(&vap->va_mtime, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
|
||||
}
|
||||
nfsm_v3attrbuild(vap, TRUE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
} else {
|
||||
@ -1261,7 +1204,6 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
register struct vattr *vap;
|
||||
{
|
||||
register struct nfsv2_sattr *sp;
|
||||
register struct nfsv3_sattr *sp3;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1, t2;
|
||||
@ -1293,10 +1235,9 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_V3SRVSATTR);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl++ = vtonfsv3_type(vap->va_type);
|
||||
sp3 = (struct nfsv3_sattr *)tl;
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
if (vap->va_type == VCHR || vap->va_type == VBLK) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(major(vap->va_rdev));
|
||||
@ -1383,7 +1324,6 @@ nfs_create(ap)
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
register struct nfsv2_sattr *sp;
|
||||
register struct nfsv3_sattr *sp3;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1, t2;
|
||||
@ -1416,20 +1356,18 @@ nfs_create(ap)
|
||||
if (v3) {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
if (fmode & O_EXCL) {
|
||||
*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3CREATEVERF);
|
||||
*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3CREATEVERF);
|
||||
#ifdef INET
|
||||
if (!TAILQ_EMPTY(&in_ifaddrhead))
|
||||
*tl++ = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr.s_addr;
|
||||
else
|
||||
if (!TAILQ_EMPTY(&in_ifaddrhead))
|
||||
*tl++ = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr.s_addr;
|
||||
else
|
||||
#endif
|
||||
*tl++ = create_verf;
|
||||
*tl = ++create_verf;
|
||||
*tl++ = create_verf;
|
||||
*tl = ++create_verf;
|
||||
} else {
|
||||
*tl = txdr_unsigned(NFSV3CREATE_UNCHECKED);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3SRVSATTR);
|
||||
sp3 = (struct nfsv3_sattr *)tl;
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
*tl = txdr_unsigned(NFSV3CREATE_UNCHECKED);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
|
||||
@ -1820,8 +1758,7 @@ nfs_symlink(ap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(sp3, struct nfsv3_sattr *, NFSX_V3SRVSATTR);
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
}
|
||||
nfsm_strtom(ap->a_target, slen, NFS_MAXPATHLEN);
|
||||
if (!v3) {
|
||||
@ -1895,8 +1832,7 @@ nfs_mkdir(ap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(sp3, struct nfsv3_sattr *, NFSX_V3SRVSATTR);
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
} else {
|
||||
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
|
||||
sp->sa_mode = vtonfsv2_mode(VDIR, vap->va_mode);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
|
||||
* $Id: nfsm_subs.h,v 1.20 1998/05/31 19:00:19 peter Exp $
|
||||
* $Id: nfsm_subs.h,v 1.21 1998/05/31 20:08:57 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -235,17 +235,68 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
|
||||
(f) = ttattrf; \
|
||||
} }
|
||||
|
||||
#define nfsm_v3sattr(s, a) \
|
||||
{ (s)->sa_modetrue = nfs_true; \
|
||||
(s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
|
||||
(s)->sa_uidfalse = nfs_false; \
|
||||
(s)->sa_gidfalse = nfs_false; \
|
||||
(s)->sa_sizefalse = nfs_false; \
|
||||
(s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \
|
||||
(s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \
|
||||
/* If full is true, set all fields, otherwise just set mode and time fields */
|
||||
#define nfsm_v3attrbuild(a, full) \
|
||||
{ if ((a)->va_mode != (mode_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_mode); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_uid != (uid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_uid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_gid != (gid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_gid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_size != VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
txdr_hyper(&(a)->va_size, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((a)->va_atime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_atime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
if ((a)->va_mtime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_mtime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define nfsm_strsiz(s,m) \
|
||||
{ nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.113 1998/11/13 22:58:48 msmith Exp $
|
||||
* $Id: nfs_vnops.c,v 1.114 1998/11/15 20:36:16 msmith Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -718,64 +718,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
|
||||
nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH(v3) + NFSX_SATTR(v3));
|
||||
nfsm_fhtom(vp, v3);
|
||||
if (v3) {
|
||||
if (vap->va_mode != (mode_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_mode);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_uid != (uid_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_uid);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_gid != (gid_t)VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
*tl = txdr_unsigned(vap->va_gid);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_size != VNOVAL) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = nfs_true;
|
||||
txdr_hyper(&vap->va_size, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
}
|
||||
if (vap->va_atime.tv_sec != VNOVAL) {
|
||||
if (vap->va_atime.tv_sec != time_second) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||
txdr_nfsv3time(&vap->va_atime, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
|
||||
}
|
||||
if (vap->va_mtime.tv_sec != VNOVAL) {
|
||||
if (vap->va_mtime.tv_sec != time_second) {
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||
txdr_nfsv3time(&vap->va_mtime, tl);
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
|
||||
}
|
||||
nfsm_v3attrbuild(vap, TRUE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl = nfs_false;
|
||||
} else {
|
||||
@ -1261,7 +1204,6 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
register struct vattr *vap;
|
||||
{
|
||||
register struct nfsv2_sattr *sp;
|
||||
register struct nfsv3_sattr *sp3;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1, t2;
|
||||
@ -1293,10 +1235,9 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_V3SRVSATTR);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
*tl++ = vtonfsv3_type(vap->va_type);
|
||||
sp3 = (struct nfsv3_sattr *)tl;
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
if (vap->va_type == VCHR || vap->va_type == VBLK) {
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
*tl++ = txdr_unsigned(major(vap->va_rdev));
|
||||
@ -1383,7 +1324,6 @@ nfs_create(ap)
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
register struct nfsv2_sattr *sp;
|
||||
register struct nfsv3_sattr *sp3;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1, t2;
|
||||
@ -1416,20 +1356,18 @@ nfs_create(ap)
|
||||
if (v3) {
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
if (fmode & O_EXCL) {
|
||||
*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3CREATEVERF);
|
||||
*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3CREATEVERF);
|
||||
#ifdef INET
|
||||
if (!TAILQ_EMPTY(&in_ifaddrhead))
|
||||
*tl++ = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr.s_addr;
|
||||
else
|
||||
if (!TAILQ_EMPTY(&in_ifaddrhead))
|
||||
*tl++ = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr.s_addr;
|
||||
else
|
||||
#endif
|
||||
*tl++ = create_verf;
|
||||
*tl = ++create_verf;
|
||||
*tl++ = create_verf;
|
||||
*tl = ++create_verf;
|
||||
} else {
|
||||
*tl = txdr_unsigned(NFSV3CREATE_UNCHECKED);
|
||||
nfsm_build(tl, u_int32_t *, NFSX_V3SRVSATTR);
|
||||
sp3 = (struct nfsv3_sattr *)tl;
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
*tl = txdr_unsigned(NFSV3CREATE_UNCHECKED);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
}
|
||||
} else {
|
||||
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
|
||||
@ -1820,8 +1758,7 @@ nfs_symlink(ap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(sp3, struct nfsv3_sattr *, NFSX_V3SRVSATTR);
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
}
|
||||
nfsm_strtom(ap->a_target, slen, NFS_MAXPATHLEN);
|
||||
if (!v3) {
|
||||
@ -1895,8 +1832,7 @@ nfs_mkdir(ap)
|
||||
nfsm_fhtom(dvp, v3);
|
||||
nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
|
||||
if (v3) {
|
||||
nfsm_build(sp3, struct nfsv3_sattr *, NFSX_V3SRVSATTR);
|
||||
nfsm_v3sattr(sp3, vap);
|
||||
nfsm_v3attrbuild(vap, FALSE);
|
||||
} else {
|
||||
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
|
||||
sp->sa_mode = vtonfsv2_mode(VDIR, vap->va_mode);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
|
||||
* $Id: nfsm_subs.h,v 1.20 1998/05/31 19:00:19 peter Exp $
|
||||
* $Id: nfsm_subs.h,v 1.21 1998/05/31 20:08:57 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -235,17 +235,68 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
|
||||
(f) = ttattrf; \
|
||||
} }
|
||||
|
||||
#define nfsm_v3sattr(s, a) \
|
||||
{ (s)->sa_modetrue = nfs_true; \
|
||||
(s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
|
||||
(s)->sa_uidfalse = nfs_false; \
|
||||
(s)->sa_gidfalse = nfs_false; \
|
||||
(s)->sa_sizefalse = nfs_false; \
|
||||
(s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \
|
||||
(s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \
|
||||
/* If full is true, set all fields, otherwise just set mode and time fields */
|
||||
#define nfsm_v3attrbuild(a, full) \
|
||||
{ if ((a)->va_mode != (mode_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_mode); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_uid != (uid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_uid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_gid != (gid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_gid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_size != VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
txdr_hyper(&(a)->va_size, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((a)->va_atime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_atime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
if ((a)->va_mtime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_mtime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define nfsm_strsiz(s,m) \
|
||||
{ nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
|
||||
* $Id: nfsm_subs.h,v 1.20 1998/05/31 19:00:19 peter Exp $
|
||||
* $Id: nfsm_subs.h,v 1.21 1998/05/31 20:08:57 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -235,17 +235,68 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
|
||||
(f) = ttattrf; \
|
||||
} }
|
||||
|
||||
#define nfsm_v3sattr(s, a) \
|
||||
{ (s)->sa_modetrue = nfs_true; \
|
||||
(s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
|
||||
(s)->sa_uidfalse = nfs_false; \
|
||||
(s)->sa_gidfalse = nfs_false; \
|
||||
(s)->sa_sizefalse = nfs_false; \
|
||||
(s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \
|
||||
(s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \
|
||||
/* If full is true, set all fields, otherwise just set mode and time fields */
|
||||
#define nfsm_v3attrbuild(a, full) \
|
||||
{ if ((a)->va_mode != (mode_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_mode); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_uid != (uid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_uid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_gid != (gid_t)VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
*tl = txdr_unsigned((a)->va_gid); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((full) && (a)->va_size != VNOVAL) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = nfs_true; \
|
||||
txdr_hyper(&(a)->va_size, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = nfs_false; \
|
||||
} \
|
||||
if ((a)->va_atime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_atime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_atime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
if ((a)->va_mtime.tv_sec != VNOVAL) { \
|
||||
if ((a)->va_mtime.tv_sec != time_second) { \
|
||||
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
|
||||
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
|
||||
txdr_nfsv3time(&(a)->va_mtime, tl); \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
|
||||
} \
|
||||
} else { \
|
||||
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \
|
||||
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define nfsm_strsiz(s,m) \
|
||||
{ nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \
|
||||
|
Loading…
Reference in New Issue
Block a user