mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
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: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
711934334e
commit
6641b77254
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user