Lines Matching refs:inb
570 static void inbuf_init(struct inbuf *inb, void *base, void *limit) in inbuf_init() argument
572 inb->base = base; in inbuf_init()
573 inb->limit = limit; in inbuf_init()
574 inb->ptr = inb->base; in inbuf_init()
577 static void flat_read_chunk(struct inbuf *inb, void *p, int len) in flat_read_chunk() argument
579 if ((inb->ptr + len) > inb->limit) in flat_read_chunk()
582 memcpy(p, inb->ptr, len); in flat_read_chunk()
584 inb->ptr += len; in flat_read_chunk()
587 static uint32_t flat_read_word(struct inbuf *inb) in flat_read_word() argument
591 assert(((inb->ptr - inb->base) % sizeof(val)) == 0); in flat_read_word()
593 flat_read_chunk(inb, &val, sizeof(val)); in flat_read_word()
598 static void flat_realign(struct inbuf *inb, int align) in flat_realign() argument
600 int off = inb->ptr - inb->base; in flat_realign()
602 inb->ptr = inb->base + ALIGN(off, align); in flat_realign()
603 if (inb->ptr > inb->limit) in flat_realign()
607 static char *flat_read_string(struct inbuf *inb) in flat_read_string() argument
610 const char *p = inb->ptr; in flat_read_string()
614 if (p >= inb->limit) in flat_read_string()
619 str = xstrdup(inb->ptr); in flat_read_string()
621 inb->ptr += len; in flat_read_string()
623 flat_realign(inb, sizeof(uint32_t)); in flat_read_string()
628 static struct data flat_read_data(struct inbuf *inb, int len) in flat_read_data() argument
638 flat_read_chunk(inb, d.val, len); in flat_read_data()
640 flat_realign(inb, sizeof(uint32_t)); in flat_read_data()
645 static char *flat_read_stringtable(struct inbuf *inb, int offset) in flat_read_stringtable() argument
649 p = inb->base + offset; in flat_read_stringtable()
651 if (p >= inb->limit || p < inb->base) in flat_read_stringtable()
661 return xstrdup(inb->base + offset); in flat_read_stringtable()
685 static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) in flat_read_mem_reserve() argument
700 flat_read_chunk(inb, &re, sizeof(re)); in flat_read_mem_reserve()