diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-05 15:11:01 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-05 15:11:01 -0700 |
commit | d9347453718a27439b33b6020b996621439cebb7 (patch) | |
tree | 9e6eadbce7319b6627ec05dbfea1a635784959d9 /com32/hdt/hdt-cli-disk.c | |
parent | 2acba746d510b460fffd29ec5538962fec3cebda (diff) | |
download | hdt-d9347453718a27439b33b6020b996621439cebb7.tar.gz hdt-d9347453718a27439b33b6020b996621439cebb7.tar.xz hdt-d9347453718a27439b33b6020b996621439cebb7.zip |
hdt: Make the menu and cli use the new disk interfaces
The disklib interfaces have changed (errno_disk introduced). Update
these changes in hdt (nobody else use them).
Misc: fix get_error declaration.
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.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c index 8e07ed08..197d1703 100644 --- a/com32/hdt/hdt-cli-disk.c +++ b/com32/hdt/hdt-cli-disk.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include <errno.h> +#include <disk/errno_disk.h> #include <disk/geom.h> #include <disk/read.h> #include <disk/error.h> @@ -64,7 +65,7 @@ static void show_partition_information(struct driveinfo *drive_info, char size[8]; char *parttype; int error = 0; - char *error_buffer; + char error_buffer[MAX_DISK_ERRNO]; unsigned int start, end; int i = nb_partitions_seen; @@ -86,10 +87,10 @@ static void show_partition_information(struct driveinfo *drive_info, ptab->ostype, parttype); /* Extra info */ - if (ptab->ostype == 0x82 && swsusp_check(drive_info, ptab, &error)) { + if (ptab->ostype == 0x82 && swsusp_check(drive_info, ptab)) { more_printf("%s", " (Swsusp sig. detected)"); } else if (error) { - get_error(error, &error_buffer); + get_error(&error_buffer); more_printf("%s\n", error_buffer); free(error_buffer); } @@ -117,8 +118,7 @@ void main_show_disk(int argc, char **argv, int i = drive - 0x80; struct driveinfo *d = &hardware->disk_info[i]; - int error; - char *error_buffer; + char error_buffer[MAX_DISK_ERRNO]; char disk_size[8]; detect_disks(hardware); @@ -144,16 +144,10 @@ void main_show_disk(int argc, char **argv, remove_spaces(d->edd_params.interface_type)); more_printf(" # B Start End Size Id Type\n"); - error = 0; - if (parse_partition_table(d, &show_partition_information, &error)) { - if (error) { - more_printf("I/O error: "); - get_error(error, &error_buffer); - more_printf("%s\n", error_buffer); - free(error_buffer); - } else - more_printf("An unknown error occured.\n"); - return; + if (parse_partition_table(d, &show_partition_information) == -1) { + get_error(&error_buffer); + more_printf("%s\n", error_buffer); + free(error_buffer); } } |