aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-cli-disk.c
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-07 16:12:59 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-07 16:22:36 -0700
commite9069caefc1460ec7f4d058796005474c125fc61 (patch)
tree25cd847439fb004798251a63fa8886073134009f /com32/hdt/hdt-cli-disk.c
parentc93e27af183de1cdf591706448d42887d0fbc0eb (diff)
parent03b2384b6e9f54d9697e87d2a19c321e6fd96ed5 (diff)
downloadhdt-e9069caefc1460ec7f4d058796005474c125fc61.tar.gz
hdt-e9069caefc1460ec7f4d058796005474c125fc61.tar.xz
hdt-e9069caefc1460ec7f4d058796005474c125fc61.zip
Merge branch 'bootloader-detection' into hdt-next
Conflicts: com32/hdt/hdt-cli-disk.c com32/hdt/hdt-common.h com32/hdt/hdt-menu-disk.c Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt/hdt-cli-disk.c')
-rw-r--r--com32/hdt/hdt-cli-disk.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c
index bcd4400c..48f19012 100644
--- a/com32/hdt/hdt-cli-disk.c
+++ b/com32/hdt/hdt-cli-disk.c
@@ -56,6 +56,7 @@ static void show_partition_information(struct driveinfo *drive_info,
int nb_partitions_seen)
{
char size[9];
+ char bootloader_name[9];
char *parttype;
unsigned int start, end;
@@ -70,10 +71,10 @@ static void show_partition_information(struct driveinfo *drive_info,
memset(size, 0, sizeof size);
if (i == 1)
- more_printf(" # B Start End Size Id Type\n");
+ more_printf(" # B Start End Size Id Type\n");
get_label(ptab->ostype, &parttype);
- more_printf(" %2d %s %11d %11d %s %02X %s",
+ more_printf("%2d %s %11d %11d %s %02X %s",
i, (ptab->active_flag == 0x80) ? "x" : " ",
start,
end,
@@ -84,6 +85,9 @@ static void show_partition_information(struct driveinfo *drive_info,
if (ptab->ostype == 0x82 && swsusp_check(drive_info, ptab))
more_printf("%s", " (Swsusp sig. detected)");
+ if (get_bootloader_string(drive_info, ptab, bootloader_name, 9) == 0)
+ more_printf("%-46s %s %s", " ", "Bootloader:", bootloader_name);
+
more_printf("\n");
free(parttype);
@@ -107,11 +111,14 @@ void main_show_disk(int argc, char **argv,
int i = drive - 0x80;
struct driveinfo *d = &hardware->disk_info[i];
char disk_size[9];
+ char mbr_name[50];
detect_disks(hardware);
if (!hardware->disk_info[i].cbios)
return; /* Invalid geometry */
+ get_mbr_string(hardware->mbr_ids[i], &mbr_name, 50);
+
if ((int) d->edd_params.sectors > 0)
sectors_to_size((int) d->edd_params.sectors, disk_size);
else
@@ -119,14 +126,17 @@ void main_show_disk(int argc, char **argv,
more_printf("DISK 0x%X:\n"
" C/H/S: %d cylinders, %d heads, %d sectors/track\n"
- " EDD: Version: %X\n"
+ " EDD: Version: %X\n"
" Size: %s, %d bytes/sector, %d sectors/track\n"
- " Host bus: %s, Interface type: %s\n\n",
+ " Host bus: %s, Interface type: %s\n"
+ " MBR: %s (id 0x%X)\n\n",
d->disk,
d->legacy_max_cylinder + 1, d->legacy_max_head + 1, d->legacy_sectors_per_track,
d->edd_version,
disk_size, (int) d->edd_params.bytes_per_sector, (int) d->edd_params.sectors_per_track,
- remove_spaces((char *) d->edd_params.host_bus_type), remove_spaces((char*) d->edd_params.interface_type));
+ remove_spaces((char *) d->edd_params.host_bus_type), remove_spaces((char*) d->edd_params.interface_type),
+ mbr_name, hardware->mbr_ids[i]);
+ display_line_nb += 6;
if (parse_partition_table(d, &show_partition_information)) {
if (errno_disk) {
@@ -147,11 +157,19 @@ void main_show_disks(int argc __unused, char **argv __unused,
reset_more_printf();
detect_disks(hardware);
+ int first_one = 0;
for (int drive = 0x80; drive < 0xff; drive++) {
- char buf[5] = "";
- sprintf(buf, "0x%x", drive);
- char *argv[1] = { buf };
- main_show_disk(1, argv, hardware);
+ if (hardware->disk_info[drive - 0x80].cbios) {
+ if (!first_one) {
+ first_one = 1;
+ } else {
+ pause_printf();
+ }
+ char buf[5] = "";
+ sprintf(buf, "0x%x", drive);
+ char *argv[1] = { buf };
+ main_show_disk(1, argv, hardware);
+ }
}
}