-#define nfsm_v3sattr(s, a, u, g) \
- { (s)->sa_modetrue = nfs_true; \
- (s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
- (s)->sa_uidtrue = nfs_true; \
- (s)->sa_uid = txdr_unsigned(u); \
- (s)->sa_gidtrue = nfs_true; \
- (s)->sa_gid = txdr_unsigned(g); \
- (s)->sa_sizefalse = nfs_false; \
- (s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
- (s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
+#define nfsm_v3sattr(vap) \
+ {\
+ struct timeval now; \
+ if (VATTR_IS_ACTIVE(vap, va_mode)) { \
+ nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED); \
+ *tl++ = nfs_true; \
+ *tl = txdr_unsigned(vap->va_mode); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = nfs_false; \
+ } \
+ if (VATTR_IS_ACTIVE(vap, va_uid)) { \
+ nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED); \
+ *tl++ = nfs_true; \
+ *tl = txdr_unsigned(vap->va_uid); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = nfs_false; \
+ } \
+ if (VATTR_IS_ACTIVE(vap, va_gid)) { \
+ nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED); \
+ *tl++ = nfs_true; \
+ *tl = txdr_unsigned(vap->va_gid); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = nfs_false; \
+ } \
+ if (VATTR_IS_ACTIVE(vap, va_data_size)) { \
+ nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED); \
+ *tl++ = nfs_true; \
+ txdr_hyper(&vap->va_data_size, tl); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = nfs_false; \
+ } \
+ microtime(&now); \
+ if (VATTR_IS_ACTIVE(vap, va_access_time)) { \
+ if (vap->va_access_time.tv_sec != now.tv_sec) { \
+ nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED); \
+ *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
+ txdr_nfsv3time(&vap->va_access_time, tl); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
+ } \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
+ } \
+ if (VATTR_IS_ACTIVE(vap, va_modify_time)) { \
+ if (vap->va_modify_time.tv_sec != now.tv_sec) { \
+ nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED); \
+ *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
+ txdr_nfsv3time(&vap->va_modify_time, tl); \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \
+ } \
+ } else { \
+ nfsm_build(tl, u_long *, NFSX_UNSIGNED); \
+ *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
+ } \