hdt: dmi> show memory must show the free banks
authorErwan Velu <erwan.velu@free.fr>
Sun, 1 Mar 2009 12:27:48 +0000 (13:27 +0100)
committerErwan Velu <erwan.velu@free.fr>
Sun, 1 Mar 2009 12:27:48 +0000 (13:27 +0100)
Show memory have to display the free banks

com32/hdt/hdt-cli-dmi.c
com32/hdt/hdt-cli.c
com32/hdt/hdt-cli.h

index 3981a8d..287786f 100644 (file)
@@ -57,7 +57,7 @@ void dmi_show(char *item, struct s_hardware *hardware) {
    return;
  }
  if ( !strncmp(item, CLI_DMI_MEMORY, sizeof(CLI_DMI_MEMORY) - 1) ) {
-   show_dmi_memory_modules(hardware,true);
+   show_dmi_memory_modules(hardware,true,true);
    return;
  }
  if ( !strncmp(item, CLI_DMI_MEMORY_BANK, sizeof(CLI_DMI_MEMORY_BANK) - 1) ) {
@@ -288,7 +288,7 @@ void show_dmi_cpu(struct s_hardware *hardware) {
 
 }
 
-void show_dmi_memory_modules(struct s_hardware *hardware, bool clear) {
+void show_dmi_memory_modules(struct s_hardware *hardware, bool clear, bool show_free_banks) {
  char bank_number[10];
  char available_dmi_commands[1024];
  memset(available_dmi_commands,0,sizeof(available_dmi_commands));
@@ -307,8 +307,12 @@ void show_dmi_memory_modules(struct s_hardware *hardware, bool clear) {
        memset(bank_number,0,sizeof(bank_number));
        snprintf(bank_number,sizeof(bank_number),"%d ",i);
         strncat(available_dmi_commands,bank_number,sizeof(bank_number));
+       if (show_free_banks==false) {
        if (strncmp(hardware->dmi.memory[i].size,"Free",4))
         printf(" bank %02d      : %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
+       } else {
+        printf(" bank %02d      : %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
+       }
     }
  }
  //printf("Type 'show bank<bank_number>' for more details.\n");
index 2565880..6819471 100644 (file)
@@ -197,7 +197,7 @@ void main_show_summary(struct s_hardware *hardware, struct s_cli_mode *cli_mode)
     more_printf("Bios\n");
     more_printf(" Version      : %s\n",hardware->dmi.bios.version);
     more_printf(" Release      : %s\n",hardware->dmi.bios.release_date);
-    show_dmi_memory_modules(hardware,false);
+    show_dmi_memory_modules(hardware,false,false);
    }
    main_show_pci(hardware);
    if (hardware->is_pxe_valid)
index 31a5c0d..2dcabb5 100644 (file)
@@ -84,7 +84,7 @@ void show_dmi_bios(struct s_hardware *hardware);
 void show_dmi_chassis(struct s_hardware *hardware);
 void show_dmi_cpu(struct s_hardware *hardware);
 void show_dmi_modules(struct s_hardware *hardware);
-void show_dmi_memory_modules(struct s_hardware *hardware,bool clearscreen);
+void show_dmi_memory_modules(struct s_hardware *hardware,bool clearscreen, bool show_free_banks);
 void show_dmi_memory_bank(struct s_hardware *hardware, const char *item);
 void show_dmi_battery(struct s_hardware *hardware);