Skip to contentSkip to conversation

device_tree: Add info message when dumping dtb to file

PATCH In review Leonardo Bras 3 participants 3 messages Mar 19, 2020 – Mar 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 device_tree: Add info message when dumping dtb to file

When dumping dtb to a file, qemu exits silently before starting the VM.

Add info message so user can easily track why the proccess exits. Add error message if dtb dump failed.

---
 device_tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
device_tree.c +6 -1
index f8b46b3c73..bba6cc2164 100644
@@ -530,7 +530,12 @@ void qemu_fdt_dumpdtb(void *fdt, int size)
 
     if (dumpdtb) {
         /* Dump the dtb to a file and quit */
-        exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
+        if (g_file_set_contents(dumpdtb, fdt, size, NULL)) {
+            info_report("dtb dumped to %s. Exiting.", dumpdtb);
+            exit(0);
+        }
+        error_report("%s: Failed dumping dtb to %s", __func__, dumpdtb);
+        exit(1);
     }
 }
 
Signature · 1 line
2.24.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Leonardo Bras

When dumping dtb to a file, qemu exits silently before starting the VM.

Add info message so user can easily track why the proccess exits. Add error message if dtb dump failed.

Quoted 22 lines
---
 device_tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
device_tree.c +6 -1
index f8b46b3c73..bba6cc2164 100644
@@ -530,7 +530,12 @@ void qemu_fdt_dumpdtb(void *fdt, int size)
 
     if (dumpdtb) {
         /* Dump the dtb to a file and quit */
-        exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
+        if (g_file_set_contents(dumpdtb, fdt, size, NULL)) {
+            info_report("dtb dumped to %s. Exiting.", dumpdtb);
+            exit(0);
+        }
+        error_report("%s: Failed dumping dtb to %s", __func__, dumpdtb);
+        exit(1);
     }
 }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by on v2 1/1
#2 lore raw
In reply to Leonardo Bras
Quoted 7 lines · Leonardo Bras

When dumping dtb to a file, qemu exits silently before starting the VM.

Add info message so user can easily track why the proccess exits. Add error message if dtb dump failed.

Thanks for the patch

I have sent a PR with this patch.

Alistair

Quoted 26 lines
---
 device_tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
device_tree.c +6 -2
index f8b46b3c73..bba6cc2164 100644
@@ -530,7 +530,12 @@ void qemu_fdt_dumpdtb(void *fdt, int size)
 
     if (dumpdtb) {
         /* Dump the dtb to a file and quit */
-        exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
+        if (g_file_set_contents(dumpdtb, fdt, size, NULL)) {
+            info_report("dtb dumped to %s. Exiting.", dumpdtb);
+            exit(0);
+        }
+        error_report("%s: Failed dumping dtb to %s", __func__, dumpdtb);
+        exit(1);
     }
 }
 
--

2.24.1