commit 6179bd86785ddbe6508d89999ed37f5802ac3e87
parent c3e6e5a073288d4adbb48e54fb2b7c0826c0e83e
Author: Roberto E. Vargas Caballero <roberto@clue.aero>
Date: Mon, 12 Aug 2019 15:57:07 +0200
[native] Simplify namespace()
We don't need the complexity of having an error label.
Change-Id: I016a641e458ede18a89c19a7d06e858549c3e770
Diffstat:
1 file changed, 13 insertions(+), 38 deletions(-)
diff --git a/target/native/rom.c b/target/native/rom.c
@@ -94,64 +94,39 @@ namespace(void)
/* Standard input set to 0 */
kin = open("#c/raw", O_READ);
- if (kin != 0) {
- kerror("open:#c/raw read");
- goto error;
- }
+ if (kin != 0)
+ panic("open:#c/raw read");
/* Standard output set to 1 */
kout = open("#c/raw", O_WRITE);
- if (kout != 1) {
- kerror("open:#c/raw write");
- goto error;
- }
+ if (kout != 1)
+ panic("open:#c/raw write");
/* Standard error set to 2 */
kerr = open("#c/raw", O_WRITE);
if (kerr != 2) {
- kerror("open:#c/raw write");
- goto error;
- }
+ panic("open:#c/raw write");
if (bind("#c", "/dev/cons") < 0) {
- kerror("bind:/dev/cons");
- goto error;
- }
+ panic("bind:/dev/cons");
if (bind("#t0", "/dev/uart0") < 0) {
- kerror("bind:/dev/uart0");
- goto error;
- }
+ panic("bind:/dev/uart0");
if (bind("#t1", "/dev/uart3") < 0) {
- kerror("bind:/dev/uart3");
- goto error;
- }
+ panic("bind:/dev/uart3");
if ((fd = open("/dev/cons/ctl", O_WRITE)) < 0) {
- kerror("open:/dev/cons/ctl write");
- goto error;
- }
+ panic("open:/dev/cons/ctl write");
if (write(fd, setin, sizeof(setin)) < 0) {
- kerror("write:setin");
- goto error;
- }
+ panic("write:setin");
if (write(fd, setout, sizeof(setout)) < 0) {
- kerror("write:setout");
- goto error;
- }
+ panic("write:setout");
if (close(fd) < 0) {
- kerror("close:/dev/cons/ctl");
- goto error;
- }
+ panic("close:/dev/cons/ctl");
if (mount("#F", "/fip", "/blobs/fip.bin") < 0) {
- kerror("mount:/fip");
- goto error;
- }
+ panic("mount:/fip");
return;
-
-error:
- panic("namespace");
}
// TODO: move to generic code