From 065cbc77076ec8d38385406deefa8331bc2432f5 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 27 Jul 2022 22:07:52 -0600 Subject: [PATCH] kboot: Do a style(9) pass on kbootfdt.c Mostly just properly indent. Sponsored by: Netflix --- stand/kboot/kbootfdt.c | 68 +++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/stand/kboot/kbootfdt.c b/stand/kboot/kbootfdt.c index 14bc94326fe6..5e0ef9ea3068 100644 --- a/stand/kboot/kbootfdt.c +++ b/stand/kboot/kbootfdt.c @@ -53,44 +53,44 @@ add_node_to_fdt(void *buffer, const char *path, int fdt_offset) fd = host_open(path, O_RDONLY, 0); while (1) { - dentsize = host_getdents(fd, dents, sizeof(dents)); - if (dentsize <= 0) - break; - for (dent = (struct host_dent *)dents; - (char *)dent < dents + dentsize; - dent = (struct host_dent *)((void *)dent + dent->d_reclen)) { - sprintf(subpath, "%s/%s", path, dent->d_name); - if (strcmp(dent->d_name, ".") == 0 || - strcmp(dent->d_name, "..") == 0) - continue; - d_type = *((char *)(dent) + dent->d_reclen - 1); - if (d_type == 4 /* DT_DIR */) { - child_offset = fdt_add_subnode(buffer, fdt_offset, - dent->d_name); - if (child_offset < 0) { - printf("Error %d adding node %s/%s, skipping\n", - child_offset, path, dent->d_name); + dentsize = host_getdents(fd, dents, sizeof(dents)); + if (dentsize <= 0) + break; + for (dent = (struct host_dent *)dents; + (char *)dent < dents + dentsize; + dent = (struct host_dent *)((void *)dent + dent->d_reclen)) { + sprintf(subpath, "%s/%s", path, dent->d_name); + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) continue; - } + d_type = *((char *)(dent) + dent->d_reclen - 1); + if (d_type == 4 /* DT_DIR */) { + child_offset = fdt_add_subnode(buffer, fdt_offset, + dent->d_name); + if (child_offset < 0) { + printf("Error %d adding node %s/%s, skipping\n", + child_offset, path, dent->d_name); + continue; + } - add_node_to_fdt(buffer, subpath, child_offset); - } else { - propbuf = malloc(1024); - proplen = 0; - pfd = host_open(subpath, O_RDONLY, 0); - if (pfd > 0) { - proplen = host_read(pfd, propbuf, 1024); - host_close(pfd); + add_node_to_fdt(buffer, subpath, child_offset); + } else { + propbuf = malloc(1024); + proplen = 0; + pfd = host_open(subpath, O_RDONLY, 0); + if (pfd > 0) { + proplen = host_read(pfd, propbuf, 1024); + host_close(pfd); + } + error = fdt_setprop(buffer, fdt_offset, dent->d_name, + propbuf, proplen); + free(propbuf); + if (error) + printf("Error %d adding property %s to " + "node %d\n", error, dent->d_name, + fdt_offset); } - error = fdt_setprop(buffer, fdt_offset, dent->d_name, - propbuf, proplen); - free(propbuf); - if (error) - printf("Error %d adding property %s to " - "node %d\n", error, dent->d_name, - fdt_offset); } - } } host_close(fd);