From bc122022f949f237aecea9ea5738eb2735a0040c Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 27 Sep 2001 02:33:36 +0000 Subject: Tidy up nfsm_build usage. This is only partially finished. --- sys/nfs/nfs_common.c | 8 +++++--- sys/nfs/nfs_common.h | 9 +++------ 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'sys/nfs') diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index d51edc5..5635945 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -245,10 +245,11 @@ nfs_adv(struct mbuf **mdp, caddr_t *dposp, int offs, int left) return (0); } -void -nfsm_build_xx(void **a, int s, struct mbuf **mb, caddr_t *bpos) +void * +nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos) { struct mbuf *mb2; + void *ret; if (s > M_TRAILINGSPACE(*mb)) { MGET(mb2, M_TRYWAIT, MT_DATA); @@ -259,9 +260,10 @@ nfsm_build_xx(void **a, int s, struct mbuf **mb, caddr_t *bpos) (*mb)->m_len = 0; *bpos = mtod(*mb, caddr_t); } - *a = *bpos; + ret = *bpos; (*mb)->m_len += s; *bpos += s; + return ret; } int diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h index 825ab35..c43dd3e 100644 --- a/sys/nfs/nfs_common.h +++ b/sys/nfs/nfs_common.h @@ -56,7 +56,7 @@ extern nfstype nfsv3_type[]; } while (0) int nfs_adv(struct mbuf **, caddr_t *, int, int); -void nfsm_build_xx(void **a, int s, struct mbuf **mb, caddr_t *bpos); +void *nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos); int nfsm_dissect_xx(void **a, int s, struct mbuf **md, caddr_t *dpos); int nfsm_strsiz_xx(int *s, int m, u_int32_t **tl, struct mbuf **mb, caddr_t *bpos); @@ -64,11 +64,8 @@ int nfsm_adv_xx(int s, u_int32_t **tl, struct mbuf **md, caddr_t *dpos); u_quad_t nfs_curusec(void); int nfsm_disct(struct mbuf **, caddr_t *, int, int, caddr_t *); -#define nfsm_build(a, c, s) \ -do { \ - nfsm_build_xx((void **)&(a), (s), &mb, &bpos); \ -} while (0) - +#define nfsm_build(c, s) \ + (c)nfsm_build_xx((s), &mb, &bpos); \ /* XXX 'c' arg (type) is not used */ #define nfsm_dissect(a, c, s) \ -- cgit v1.1