Lines Matching +full:0 +full:m
52 struct mbuf *m; in m_get() local
57 m = malloc(M_BASESIZE + len); in m_get()
58 if (m == NULL) in m_get()
60 bzero(m, M_BASESIZE + len); in m_get()
61 m->m_maxlen = len; in m_get()
62 m->m_data = M_TOP(m); in m_get()
63 *mpp = m; in m_get()
64 return 0; in m_get()
68 m_free(struct mbuf *m) in m_free() argument
70 free(m); in m_free()
76 struct mbuf *m; in m_freem() local
79 m = m0->m_next; in m_freem()
81 m0 = m; in m_freem()
88 struct mbuf *m = m0; in m_totlen() local
89 int len = 0; in m_totlen()
91 while (m) { in m_totlen()
92 len += m->m_len; in m_totlen()
93 m = m->m_next; in m_totlen()
101 struct mbuf *nm, *m; in m_lineup() local
108 return 0; in m_lineup()
110 if ((error = m_get(m_totlen(m0), &nm)) != 0) in m_lineup()
117 m = m0->m_next; in m_lineup()
119 m0 = m; in m_lineup()
122 return 0; in m_lineup()
128 struct mbuf *m; in mb_init() local
131 if ((error = m_get(size, &m)) != 0) in mb_init()
133 return mb_initm(mbp, m); in mb_init()
137 mb_initm(struct mbdata *mbp, struct mbuf *m) in mb_initm() argument
140 mbp->mb_top = mbp->mb_cur = m; in mb_initm()
141 mbp->mb_pos = mtod(m, char *); in mb_initm()
142 return 0; in mb_initm()
152 return 0; in mb_done()
159 struct mbuf *m = mbp->mb_top;
160 int len = 0;
162 while (m) {
163 len += m->m_len;
164 m = m->m_next;
173 struct mbuf *m, *mp; in m_getm() local
182 if (len > 0) { in m_getm()
183 if ((error = m_get(len, &m)) != 0) in m_getm()
185 mp->m_next = m; in m_getm()
188 return 0; in m_getm()
195 if ((error = mb_fit(mbp, sizeof(t), (char**)&p)) != 0) \
206 struct mbuf *m, *mn; in mb_fit() local
209 m = mbp->mb_cur; in mb_fit()
210 if (M_TRAILINGSPACE(m) < (int)size) { in mb_fit()
211 if ((error = m_get(size, &mn)) != 0) in mb_fit()
214 mbp->mb_cur = m->m_next = mn; in mb_fit()
215 m = mn; in mb_fit()
217 m->m_len += size; in mb_fit()
221 return 0; in mb_fit()
229 return 0; in mb_put_uint8()
236 setwbe(p, 0, x); in mb_put_uint16be()
237 return 0; in mb_put_uint16be()
244 setwle(p, 0, x); in mb_put_uint16le()
245 return 0; in mb_put_uint16le()
252 setdbe(p, 0, x); in mb_put_uint32be()
253 return 0; in mb_put_uint32be()
260 setdle(p, 0, x); in mb_put_uint32le()
261 return 0; in mb_put_uint32le()
269 return 0; in mb_put_int64be()
277 return 0; in mb_put_int64le()
283 struct mbuf *m; in mb_put_mem() local
288 if (size == 0) in mb_put_mem()
289 return 0; in mb_put_mem()
290 m = mbp->mb_cur; in mb_put_mem()
291 if ((error = m_getm(m, size, &m)) != 0) in mb_put_mem()
293 while (size > 0) { in mb_put_mem()
294 cplen = M_TRAILINGSPACE(m); in mb_put_mem()
295 if (cplen == 0) { in mb_put_mem()
296 m = m->m_next; in mb_put_mem()
301 dst = mtod(m, char *) + m->m_len; in mb_put_mem()
308 m->m_len += cplen; in mb_put_mem()
311 mbp->mb_pos = mtod(m, char *) + m->m_len; in mb_put_mem()
312 mbp->mb_cur = m; in mb_put_mem()
313 return 0; in mb_put_mem()
317 mb_put_mbuf(struct mbdata *mbp, struct mbuf *m) in mb_put_mbuf() argument
319 mbp->mb_cur->m_next = m; in mb_put_mbuf()
320 while (m) { in mb_put_mbuf()
321 mbp->mb_count += m->m_len; in mb_put_mbuf()
322 if (m->m_next == NULL) in mb_put_mbuf()
324 m = m->m_next; in mb_put_mbuf()
326 mbp->mb_pos = mtod(m, char *) + m->m_len; in mb_put_mbuf()
327 mbp->mb_cur = m; in mb_put_mbuf()
328 return 0; in mb_put_mbuf()
339 if ((error = mb_put_uint8(mbp, len)) != 0) in mb_put_pstring()
347 #define mb_left(m,p) (mtod(m, char *) + (m)->m_len - (p)) argument
439 struct mbuf *m = mbp->mb_cur; in mb_get_mem() local
442 while (size > 0) { in mb_get_mem()
443 if (m == NULL) { in mb_get_mem()
447 count = mb_left(m, mbp->mb_pos); in mb_get_mem()
448 if (count == 0) { in mb_get_mem()
449 mbp->mb_cur = m = m->m_next; in mb_get_mem()
450 if (m) in mb_get_mem()
451 mbp->mb_pos = mtod(m, char *); in mb_get_mem()
467 return 0; in mb_get_mem()