4 #include <gpxe/command.h>
5 #include <usr/autoboot.h>
7 FILE_LICENCE ( GPL2_OR_LATER
);
10 * "sanboot" command syntax message
12 * @v argv Argument list
14 static void sanboot_syntax ( char **argv
) {
18 "Boot from SAN target\n",
23 * The "sanboot" command
25 * @v argc Argument count
26 * @v argv Argument list
29 static int sanboot_exec ( int argc
, char **argv
) {
30 static struct option longopts
[] = {
31 { "help", 0, NULL
, 'h' },
34 const char *root_path
= NULL
;
39 while ( ( c
= getopt_long ( argc
, argv
, "h", longopts
, NULL
) ) >= 0 ){
42 /* Display help text */
44 /* Unrecognised/invalid option */
45 sanboot_syntax ( argv
);
50 /* Need exactly one image name remaining after the options */
51 if ( optind
!= ( argc
- 1 ) ) {
52 sanboot_syntax ( argv
);
55 root_path
= argv
[optind
];
57 /* Boot from root path */
58 if ( ( rc
= boot_root_path ( root_path
) ) != 0 ) {
59 printf ( "Could not boot from %s: %s\n",
60 root_path
, strerror ( rc
) );
67 struct command sanboot_command __command
= {