/* * We avoid a copy by merely adding this mblk to the list. The caller is * responsible for allocating and filling in the mblk. If len is * not a multiple of BYTES_PER_XDR_UNIT, the caller has the option * of making the data a BYTES_PER_XDR_UNIT multiple (b_wptr - b_rptr is * a BYTES_PER_XDR_UNIT multiple), but in this case the caller has to ensure * that the filler bytes are initialized to zero. */ bool_t xdrmblk_putmblk(XDR *xdrs, mblk_t *m, uint_t len) { struct xdrmblk_params *p; int32_t llen = (int32_t)len; if ((DLEN(m) % BYTES_PER_XDR_UNIT) != 0) return (FALSE); if (!xdrmblk_putint32(xdrs, &llen)) return (FALSE); p = (struct xdrmblk_params *)xdrs->x_private; /* LINTED pointer alignment */ ((mblk_t *)xdrs->x_base)->b_cont = m; p->apos += p->rpos; /* base points to the last mblk */ while (m->b_cont) { p->apos += MBLKL(m); m = m->b_cont; } xdrs->x_base = (caddr_t)m; xdrs->x_handy = 0; p->rpos = MBLKL(m); return (TRUE); }
/* * We avoid a copy by merely adding this mblk to the list. The caller is * responsible for allocating and filling in the mblk. If len is * not a multiple of BYTES_PER_XDR_UNIT, the caller has the option * of making the data a BYTES_PER_XDR_UNIT multiple (b_wptr - b_rptr is * a BYTES_PER_XDR_UNIT multiple), but in this case the caller has to ensure * that the filler bytes are initialized to zero. Note: Doesn't to work for * chained mblks. */ bool_t xdrmblk_putmblk(XDR *xdrs, mblk_t *m, uint_t len) { int32_t llen = (int32_t)len; if (((m->b_wptr - m->b_rptr) % BYTES_PER_XDR_UNIT) != 0) return (FALSE); if (!xdrmblk_putint32(xdrs, &llen)) return (FALSE); /* LINTED pointer alignment */ ((mblk_t *)xdrs->x_base)->b_cont = m; xdrs->x_base = (caddr_t)m; xdrs->x_handy = 0; return (TRUE); }