>
> ok:
>
> #define nfsm_srvmtofh(f) \
> { int fhlen = NFSX_V3FH; \
> if (nfsd->nd_flag & ND_NFSV3) { \
> nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
> fhlen = fxdr_unsigned(int, *tl); \
> if (fhlen == 0) { \
> bzero((caddr_t)(f), NFSX_V3FH); \
> } else if (fhlen != NFSX_V3FH) { \
> error = EBADRPC; \
> nfsm_reply(0); \
> } \
> } \
> if (fhlen != 0) { \
> nfsm_dissect(tl, u_int32_t *, NFSX_V3FH); \
> bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \
> if ((nfsd->nd_flag & ND_NFSV3) == 0) \
> nfsm_adv(NFSX_V2FH - NFSX_V3FH); \
> } \
> }
>
> notice the bcopy? i don't really understand why we always
> seem to copy 64 bytes (NFSX_V3FH), isn't this a bug?
Yeah, you could probably rewrite as:
#define nfsm_srvmtofh(f) \
{ int fhlen; \
if (nfsd->nd_flag & ND_NFSV3) { \
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
fhlen = fxdr_unsigned(int, *tl); \
if (fhlen == 0) { \
bzero((caddr_t)(f), NFSX_V3FH); \
} else if (fhlen != NFSX_V3FH) { \
error = EBADRPC; \
nfsm_reply(0); \
} else { \
nfsm_dissect(tl, u_int32_t *, NFSX_V3FH); \
bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \
}\
} else {
nfsm_dissect(tl, u_int32_t *, NFSX_V2FH); \
bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V2FH); \
} \
}
which avoids using fhlen as an argument to anything (speed) and limits
the bcopy size appropriately by protocol.
--
\\ The mind's the standard \\ Mike Smith
\\ of the man. \\ [EMAIL PROTECTED]
\\ -- Joseph Merrick \\ [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message