Skip to content
Snippets Groups Projects
Commit 6641b772 authored by Alexander Graf's avatar Alexander Graf
Browse files

device tree: simplify dumpdtb code


As per Peter's suggestion, we can use glib to write out a buffer in whole to
a file, simplifying the code dramatically.

Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 71193433
No related branches found
No related tags found
No related merge requests found
......@@ -314,14 +314,7 @@ void qemu_devtree_dumpdtb(void *fdt, int size)
const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
if (dumpdtb) {
/* Dump the dtb to a file and quit */
FILE *f = fopen(dumpdtb, "wb");
size_t len;
len = fwrite(fdt, size, 1, f);
fclose(f);
if (len != size) {
exit(1);
}
exit(0);
exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment