diff mbox

[U-Boot,1/6] cmd_pxe.c add any option for filesystem with sysboot uses generic load

Message ID 1387264612-17834-2-git-send-email-dennis@ausil.us
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Dennis Gilmore Dec. 17, 2013, 7:16 a.m. UTC
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
---
 common/cmd_pxe.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

Stephen Warren Jan. 16, 2014, 8:03 p.m. UTC | #1
On 12/17/2013 12:16 AM, Dennis Gilmore wrote:
> Signed-off-by: Dennis Gilmore <dennis@ausil.us>

Nit pick: A patch description might be useful.

> @@ -1539,6 +1553,8 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  		do_getfile = do_get_ext2;
>  	else if (strstr(argv[3], "fat"))
>  		do_getfile = do_get_fat;
> +	else if (strstr(argv[3], "any"))
> +		do_getfile = do_get_any;

This is a total bikeshed, so feel free to ignore it cmopletely:

Is "any" the best choice here? In other U-Boot commands, "-" is used to
mean something similar, so perhaps "-" would work better here? Still, I
guess "-" usually means "none" or "missing" more than "any", so perhaps
"any" is better after all. Anyway, just a point for thought; I'm fine
either way.
diff mbox

Patch

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index db6b156..08c0ff5 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -11,6 +11,7 @@ 
 #include <linux/ctype.h>
 #include <errno.h>
 #include <linux/list.h>
+#include <fs.h>
 
 #include "menu.h"
 
@@ -160,6 +161,19 @@  static int do_get_fat(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
 	return -ENOENT;
 }
 
+static int do_get_any(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+{
+#ifdef CONFIG_CMD_FS_GENERIC
+	fs_argv[0] = "load";
+	fs_argv[3] = file_addr;
+	fs_argv[4] = (void *)file_path;
+
+	if (!do_load(cmdtp, 0, 5, fs_argv, FS_TYPE_ANY))
+		return 1;
+#endif
+	return -ENOENT;
+}
+
 /*
  * As in pxelinux, paths to files referenced from files we retrieve are
  * relative to the location of bootfile. get_relfile takes such a path and
@@ -1539,6 +1553,8 @@  int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		do_getfile = do_get_ext2;
 	else if (strstr(argv[3], "fat"))
 		do_getfile = do_get_fat;
+	else if (strstr(argv[3], "any"))
+		do_getfile = do_get_any;
 	else {
 		printf("Invalid filesystem: %s\n", argv[3]);
 		return 1;
@@ -1576,7 +1592,7 @@  int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD(
 	sysboot, 7, 1, do_sysboot,
 	"command to get and boot from syslinux files",
-	"[-p] <interface> <dev[:part]> <ext2|fat> [addr] [filename]\n"
-	"    - load and parse syslinux menu file 'filename' from ext2 or fat\n"
-	"      filesystem on 'dev' on 'interface' to address 'addr'"
+	"[-p] <interface> <dev[:part]> <ext2|fat|any> [addr] [filename]\n"
+	"    - load and parse syslinux menu file 'filename' from ext2, fat\n"
+	"      or any filesystem on 'dev' on 'interface' to address 'addr'"
 );