diff options
author | Kevin Lo <kevlo@FreeBSD.org> | 2012-02-06 06:03:16 +0000 |
---|---|---|
committer | Kevin Lo <kevlo@FreeBSD.org> | 2012-02-06 06:03:16 +0000 |
commit | 0ca2381d9bd2b2388b42fe2397188ed2729a458b (patch) | |
tree | ef3075f48edf98526defebd75b7a42b35ab440bb /sys/kern/subr_mchain.c | |
parent | 39b86fdc25852d637ec2d63390c9741c85336210 (diff) | |
download | src-0ca2381d9bd2b2388b42fe2397188ed2729a458b.tar.gz src-0ca2381d9bd2b2388b42fe2397188ed2729a458b.zip |
Notes
Diffstat (limited to 'sys/kern/subr_mchain.c')
-rw-r--r-- | sys/kern/subr_mchain.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c index faf8f6719011..cd2a5f370ed2 100644 --- a/sys/kern/subr_mchain.c +++ b/sys/kern/subr_mchain.c @@ -62,7 +62,7 @@ mb_init(struct mbchain *mbp) m = m_gethdr(M_WAIT, MT_DATA); m->m_len = 0; mb_initm(mbp, m); - return 0; + return (0); } void @@ -89,13 +89,13 @@ mb_detach(struct mbchain *mbp) m = mbp->mb_top; mbp->mb_top = NULL; - return m; + return (m); } int mb_fixhdr(struct mbchain *mbp) { - return mbp->mb_top->m_pkthdr.len = m_fixhdr(mbp->mb_top); + return (mbp->mb_top->m_pkthdr.len = m_fixhdr(mbp->mb_top)); } /* @@ -124,70 +124,70 @@ mb_reserve(struct mbchain *mbp, int size) mbp->mb_count += size; bpos = mtod(m, caddr_t) + m->m_len; m->m_len += size; - return bpos; + return (bpos); } int mb_put_padbyte(struct mbchain *mbp) { caddr_t dst; - char x = 0; + uint8_t x = 0; dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; - /* only add padding if address is odd */ + /* Only add padding if address is odd */ if ((unsigned long)dst & 1) - return mb_put_mem(mbp, (caddr_t)&x, 1, MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); else - return 0; + return (0); } int mb_put_uint8(struct mbchain *mbp, uint8_t x) { - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint16be(struct mbchain *mbp, uint16_t x) { x = htobe16(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint16le(struct mbchain *mbp, uint16_t x) { x = htole16(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint32be(struct mbchain *mbp, uint32_t x) { x = htobe32(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint32le(struct mbchain *mbp, uint32_t x) { x = htole32(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_int64be(struct mbchain *mbp, int64_t x) { x = htobe64(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_int64le(struct mbchain *mbp, int64_t x) { x = htole64(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int @@ -220,7 +220,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type) dstlen = mleft; error = mbp->mb_copy(mbp, source, dst, &srclen, &dstlen); if (error) - return error; + return (error); break; case MB_MINLINE: for (src = source, count = cplen; count; count--) @@ -232,7 +232,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type) case MB_MUSER: error = copyin(source, dst, cplen); if (error) - return error; + return (error); break; case MB_MZERO: bzero(dst, cplen); @@ -246,7 +246,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type) } mbp->mb_cur = m; mbp->mb_mleft = mleft; - return 0; + return (0); } int @@ -261,7 +261,7 @@ mb_put_mbuf(struct mbchain *mbp, struct mbuf *m) } mbp->mb_mleft = M_TRAILINGSPACE(m); mbp->mb_cur = m; - return 0; + return (0); } /* @@ -277,7 +277,7 @@ mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size) while (size > 0 && uiop->uio_resid) { if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return EFBIG; + return (EFBIG); left = uiop->uio_iov->iov_len; if (left == 0) { uiop->uio_iov++; @@ -288,7 +288,7 @@ mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size) left = size; error = mb_put_mem(mbp, uiop->uio_iov->iov_base, left, mtype); if (error) - return error; + return (error); uiop->uio_offset += left; uiop->uio_resid -= left; uiop->uio_iov->iov_base = @@ -296,7 +296,7 @@ mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size) uiop->uio_iov->iov_len -= left; size -= left; } - return 0; + return (0); } /* @@ -310,7 +310,7 @@ md_init(struct mdchain *mdp) m = m_gethdr(M_WAIT, MT_DATA); m->m_len = 0; md_initm(mdp, m); - return 0; + return (0); } void @@ -360,25 +360,25 @@ md_next_record(struct mdchain *mdp) struct mbuf *m; if (mdp->md_top == NULL) - return ENOENT; + return (ENOENT); m = mdp->md_top->m_nextpkt; md_done(mdp); if (m == NULL) - return ENOENT; + return (ENOENT); md_initm(mdp, m); - return 0; + return (0); } int md_get_uint8(struct mdchain *mdp, uint8_t *x) { - return md_get_mem(mdp, x, 1, MB_MINLINE); + return (md_get_mem(mdp, x, 1, MB_MINLINE)); } int md_get_uint16(struct mdchain *mdp, uint16_t *x) { - return md_get_mem(mdp, (caddr_t)x, 2, MB_MINLINE); + return (md_get_mem(mdp, (caddr_t)x, 2, MB_MINLINE)); } int @@ -389,7 +389,7 @@ md_get_uint16le(struct mdchain *mdp, uint16_t *x) if (x != NULL) *x = le16toh(v); - return error; + return (error); } int @@ -400,13 +400,13 @@ md_get_uint16be(struct mdchain *mdp, uint16_t *x) if (x != NULL) *x = be16toh(v); - return error; + return (error); } int md_get_uint32(struct mdchain *mdp, uint32_t *x) { - return md_get_mem(mdp, (caddr_t)x, 4, MB_MINLINE); + return (md_get_mem(mdp, (caddr_t)x, 4, MB_MINLINE)); } int @@ -418,7 +418,7 @@ md_get_uint32be(struct mdchain *mdp, uint32_t *x) error = md_get_uint32(mdp, &v); if (x != NULL) *x = be32toh(v); - return error; + return (error); } int @@ -430,13 +430,13 @@ md_get_uint32le(struct mdchain *mdp, uint32_t *x) error = md_get_uint32(mdp, &v); if (x != NULL) *x = le32toh(v); - return error; + return (error); } int md_get_int64(struct mdchain *mdp, int64_t *x) { - return md_get_mem(mdp, (caddr_t)x, 8, MB_MINLINE); + return (md_get_mem(mdp, (caddr_t)x, 8, MB_MINLINE)); } int @@ -448,7 +448,7 @@ md_get_int64be(struct mdchain *mdp, int64_t *x) error = md_get_int64(mdp, &v); if (x != NULL) *x = be64toh(v); - return error; + return (error); } int @@ -460,7 +460,7 @@ md_get_int64le(struct mdchain *mdp, int64_t *x) error = md_get_int64(mdp, &v); if (x != NULL) *x = le64toh(v); - return error; + return (error); } int @@ -474,7 +474,7 @@ md_get_mem(struct mdchain *mdp, caddr_t target, int size, int type) while (size > 0) { if (m == NULL) { MBERROR("incomplete copy\n"); - return EBADRPC; + return (EBADRPC); } s = mdp->md_pos; count = mtod(m, u_char*) + m->m_len - s; @@ -506,7 +506,7 @@ md_get_mem(struct mdchain *mdp, caddr_t target, int size, int type) } target += count; } - return 0; + return (0); } int @@ -517,7 +517,7 @@ md_get_mbuf(struct mdchain *mdp, int size, struct mbuf **ret) rm = m_copym(m, mdp->md_pos - mtod(m, u_char*), size, M_WAIT); md_get_mem(mdp, NULL, size, MB_MZERO); *ret = rm; - return 0; + return (0); } int @@ -530,7 +530,7 @@ md_get_uio(struct mdchain *mdp, struct uio *uiop, int size) mtype = (uiop->uio_segflg == UIO_SYSSPACE) ? MB_MSYSTEM : MB_MUSER; while (size > 0 && uiop->uio_resid) { if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return EFBIG; + return (EFBIG); left = uiop->uio_iov->iov_len; if (left == 0) { uiop->uio_iov++; @@ -542,7 +542,7 @@ md_get_uio(struct mdchain *mdp, struct uio *uiop, int size) left = size; error = md_get_mem(mdp, uiocp, left, mtype); if (error) - return error; + return (error); uiop->uio_offset += left; uiop->uio_resid -= left; uiop->uio_iov->iov_base = @@ -550,5 +550,5 @@ md_get_uio(struct mdchain *mdp, struct uio *uiop, int size) uiop->uio_iov->iov_len -= left; size -= left; } - return 0; + return (0); } |