Lines Matching refs:pb

48 p9pbuf_get_type(struct puffs_framebuf *pb)
52 puffs_framebuf_getdata_atoff(pb, 4, &val, 1);
57 p9pbuf_get_tag(struct puffs_framebuf *pb)
61 puffs_framebuf_getdata_atoff(pb, 5, &val, 2);
66 p9pbuf_get_len(struct puffs_framebuf *pb)
70 puffs_framebuf_getdata_atoff(pb, 0, &val, 4);
74 #define CUROFF(pb) (puffs_framebuf_telloff(pb))
76 p9pbuf_read(struct puffs_usermount *pu, struct puffs_framebuf *pb,
85 if ((lenstate = (CUROFF(pb) < 4)))
86 howmuch = 4 - CUROFF(pb);
88 howmuch = p9pbuf_get_len(pb) - CUROFF(pb);
90 if (puffs_framebuf_reserve_space(pb, howmuch) == -1)
95 if (puffs_framebuf_getwindow(pb, CUROFF(pb), &win, &winlen)==-1)
107 puffs_framebuf_seekset(pb, CUROFF(pb) + n);
113 puffs_framebuf_seekset(pb, 7);
121 p9pbuf_write(struct puffs_usermount *pu, struct puffs_framebuf *pb,
128 if (CUROFF(pb) == 0) {
131 len = htole32(puffs_framebuf_tellsize(pb));
132 puffs_framebuf_putdata_atoff(pb, 0, &len, 4);
135 howmuch = puffs_framebuf_tellsize(pb) - CUROFF(pb);
138 if (puffs_framebuf_getwindow(pb, CUROFF(pb), &win, &winlen)==-1)
150 puffs_framebuf_seekset(pb, CUROFF(pb) + n);
171 struct puffs_framebuf *pb;
173 pb = puffs_framebuf_make();
174 puffs_framebuf_seekset(pb, 4);
175 return pb;
179 p9pbuf_recycleout(struct puffs_framebuf *pb)
182 puffs_framebuf_recycle(pb);
183 puffs_framebuf_seekset(pb, 4);
187 p9pbuf_put_1(struct puffs_framebuf *pb, uint8_t val)
191 rv = puffs_framebuf_putdata(pb, &val, 1);
196 p9pbuf_put_2(struct puffs_framebuf *pb, uint16_t val)
201 rv = puffs_framebuf_putdata(pb, &val, 2);
206 p9pbuf_put_4(struct puffs_framebuf *pb, uint32_t val)
211 rv = puffs_framebuf_putdata(pb, &val, 4);
216 p9pbuf_put_8(struct puffs_framebuf *pb, uint64_t val)
221 rv = puffs_framebuf_putdata(pb, &val, 8);
226 p9pbuf_put_data(struct puffs_framebuf *pb, const void *data, uint16_t dlen)
230 p9pbuf_put_2(pb, dlen);
231 rv = puffs_framebuf_putdata(pb, data, dlen);
236 p9pbuf_put_str(struct puffs_framebuf *pb, const char *str)
239 p9pbuf_put_data(pb, str, strlen(str));
243 p9pbuf_write_data(struct puffs_framebuf *pb, uint8_t *data, uint32_t dlen)
247 rv = puffs_framebuf_putdata(pb, data, dlen);
254 p9pbuf_get_1(struct puffs_framebuf *pb, uint8_t *val)
257 ERETURN(puffs_framebuf_getdata(pb, val, 1));
261 p9pbuf_get_2(struct puffs_framebuf *pb, uint16_t *val)
265 rv = puffs_framebuf_getdata(pb, val, 2);
272 p9pbuf_get_4(struct puffs_framebuf *pb, uint32_t *val)
276 rv = puffs_framebuf_getdata(pb, val, 4);
283 p9pbuf_get_8(struct puffs_framebuf *pb, uint64_t *val)
287 rv = puffs_framebuf_getdata(pb, val, 8);
294 p9pbuf_get_data(struct puffs_framebuf *pb, uint8_t **dp, uint16_t *dlenp)
300 rv = p9pbuf_get_2(pb, &len);
304 if (puffs_framebuf_remaining(pb) < len)
309 rv = puffs_framebuf_getdata(pb, data, len);
317 puffs_framebuf_seekset(pb, puffs_framebuf_telloff(pb)+len);
326 p9pbuf_read_data(struct puffs_framebuf *pb, uint8_t *buf, uint32_t dlen)
329 ERETURN(puffs_framebuf_getdata(pb, buf, dlen));
333 p9pbuf_get_str(struct puffs_framebuf *pb, char **dp, uint16_t *dlenp)
336 return p9pbuf_get_data(pb, (uint8_t **)dp, dlenp);