Merge commit 'mouraf/for-erwan' into disklib
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Sun, 19 Apr 2009 15:31:57 +0000 (08:31 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Sun, 19 Apr 2009 15:31:57 +0000 (08:31 -0700)
Conflicts:
com32/hdt/hdt-cli.c
com32/hdt/hdt-cli.h

1  2 
com32/hdt/hdt-cli.c
com32/hdt/hdt-cli.h
com32/hdt/hdt-common.c
com32/hdt/hdt-common.h
com32/hdt/hdt-menu.c
com32/hdt/hdt-menu.h

@@@ -43,7 -43,8 +43,9 @@@ struct cli_mode_descr *list_modes[] = 
        &cpu_mode,
        &pci_mode,
        &vesa_mode,
 +      &disk_mode,
+       &vpd_mode,
+       NULL,
  };
  
  /*
@@@ -178,17 -179,24 +180,29 @@@ void set_mode(cli_mode_t mode, struct s
                snprintf(hdt_cli.prompt, sizeof(hdt_cli.prompt), "%s> ",
                         CLI_DMI);
                break;
 -
 +      case DISK_MODE:
 +              detect_disks(hardware);
 +              hdt_cli.mode = mode;
 +              snprintf(hdt_cli.prompt, sizeof(hdt_cli.prompt), "%s> ",
 +                       CLI_DISK);
 +              break;
+       case VPD_MODE:
+               detect_vpd(hardware);
+               if (!hardware->is_vpd_valid) {
+                       printf("No valid VPD table found, exiting.\n");
+                       break;
+               }
+               hdt_cli.mode = mode;
+               snprintf(hdt_cli.prompt, sizeof(hdt_cli.prompt), "%s> ",
+                        CLI_VPD);
+               break;
        default:
                /* Invalid mode */
-               more_printf("Unknown mode, please choose among:\n");
-               for (i = 0; i < MAX_MODES; i++)
-                       more_printf("\t%s\n", list_modes[i]->name);
+               printf("Unknown mode, please choose among:\n");
+               while (list_modes[i]) {
+                       printf("\t%s\n", list_modes[i]->name);
+                       i++;
+               }
        }
  
        find_cli_mode_descr(hdt_cli.mode, &current_mode);
@@@ -80,7 -80,7 +81,8 @@@ typedef enum 
        KERNEL_MODE,
        SYSLINUX_MODE,
        VESA_MODE,
 +      DISK_MODE,
+       VPD_MODE,
  } cli_mode_t;
  
  #define PROMPT_SIZE 32
@@@ -140,7 -138,7 +140,8 @@@ struct cli_mode_descr kernel_mode
  struct cli_mode_descr cpu_mode;
  struct cli_mode_descr pci_mode;
  struct cli_mode_descr vesa_mode;
 +struct cli_mode_descr disk_mode;
+ struct cli_mode_descr vpd_mode;
  
  /* cli helpers */
  void find_cli_mode_descr(cli_mode_t mode, struct cli_mode_descr **mode_found);
  #include "../lib/sys/vesa/vesa.h"
  #include "hdt-common.h"
  #include "lib-ansi.h"
 +#include <disk/util.h>
  
+ /* ISOlinux requires a 8.3 format */
+ void convert_isolinux_filename(char *filename, struct s_hardware *hardware) {
+   /* Exit if we are not running ISOLINUX */
+   if (hardware->sv->filesystem != SYSLINUX_FS_ISOLINUX) return;
+   /* Searching the dot */
+   char *dot=strchr(filename,'.');
+   /* Exiting if not dot exists in that string */
+   if (dot==NULL) return;
+   /* Exiting if the extension is 3 char or less */
+   if (strlen(dot)<=4) return;
+   /* We have an extension bigger than .blah
+    * so we have to shorten it to 3*/
+   dot[4]='\0';
+ }
  void detect_parameters(const int argc, const char *argv[],
                         struct s_hardware *hardware)
  {
@@@ -107,8 -95,9 +108,9 @@@ struct s_vesa 
  struct s_hardware {
    s_dmi dmi;                      /* DMI table */
    s_cpu cpu;                      /* CPU information */
+   s_vpd vpd;                      /* VPD information */
    struct pci_domain *pci_domain;  /* PCI Devices */
 -  struct diskinfo disk_info[256]; /* Disk Information */
 +  struct driveinfo disk_info[256]; /* Disk Information */
    int disks_count;              /* Number of detected disks */
    struct s_pxe pxe;
    struct s_vesa vesa;
Simple merge
Simple merge