Lines Matching refs:buf
33 char *buf;
37 static void expand_buf(struct bufstate *buf, int newsize)
39 buf->buf = realloc(buf->buf, newsize);
40 if (!buf->buf)
42 buf->size = newsize;
45 static void new_header(struct bufstate *buf, int version, const void *fdt)
56 expand_buf(buf, hdrsize);
57 memset(buf->buf, 0, hdrsize);
59 fdt_set_magic(buf->buf, FDT_MAGIC);
60 fdt_set_version(buf->buf, version);
61 fdt_set_last_comp_version(buf->buf, 16);
62 fdt_set_boot_cpuid_phys(buf->buf, fdt_boot_cpuid_phys(fdt));
65 static void add_block(struct bufstate *buf, int version, char block, const void *fdt)
97 oldsize = buf->size;
99 expand_buf(buf, offset+size);
100 memset(buf->buf + oldsize, 0, offset - oldsize);
102 memcpy(buf->buf + offset, src, size);
106 fdt_set_off_mem_rsvmap(buf->buf, offset);
110 fdt_set_off_dt_struct(buf->buf, offset);
112 fdt_set_size_dt_struct(buf->buf, size);
116 fdt_set_off_dt_strings(buf->buf, offset);
117 fdt_set_size_dt_strings(buf->buf, size);
127 struct bufstate buf = {NULL, 0};
148 new_header(&buf, version, fdt);
151 add_block(&buf, version, *blockorder, fdt);
155 fdt_set_totalsize(buf.buf, buf.size);
157 err = fdt_check_header(buf.buf);
161 save_blob(outname, buf.buf);