aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 15:11:01 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 15:11:01 -0700
commitd9347453718a27439b33b6020b996621439cebb7 (patch)
tree9e6eadbce7319b6627ec05dbfea1a635784959d9
parent2acba746d510b460fffd29ec5538962fec3cebda (diff)
downloadlwip-d9347453718a27439b33b6020b996621439cebb7.tar.gz
lwip-d9347453718a27439b33b6020b996621439cebb7.tar.xz
lwip-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>
-rw-r--r--com32/gplinclude/disk/error.h2
-rw-r--r--com32/hdt/hdt-cli-disk.c24
-rw-r--r--com32/hdt/hdt-menu-disk.c36
3 files changed, 23 insertions, 39 deletions
diff --git a/com32/gplinclude/disk/error.h b/com32/gplinclude/disk/error.h
index 5eb54e01..f9e319c4 100644
--- a/com32/gplinclude/disk/error.h
+++ b/com32/gplinclude/disk/error.h
@@ -9,5 +9,5 @@
#ifndef _ERROR_H_
#define _ERROR_H_
-void get_error(const int, char**);
+void get_error(void*);
#endif /* _UTIL_H_ */
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);
}
}
diff --git a/com32/hdt/hdt-menu-disk.c b/com32/hdt/hdt-menu-disk.c
index 7e60b06e..4915050d 100644
--- a/com32/hdt/hdt-menu-disk.c
+++ b/com32/hdt/hdt-menu-disk.c
@@ -27,6 +27,7 @@
*/
#include <stdlib.h>
+#include <disk/errno_disk.h>
#include <disk/geom.h>
#include <disk/read.h>
#include <disk/partition.h>
@@ -85,8 +86,7 @@ static void compute_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;
char buffer[SUBMENULEN+1];
char statbuffer[STATLEN+1];
@@ -155,16 +155,15 @@ static void compute_partition_information(struct driveinfo *drive_info,
free(parttype);
/* Extra info */
- if (ptab->ostype == 0x82 && swsusp_check(drive_info, ptab, &error)) {
+ if (ptab->ostype == 0x82 && swsusp_check(drive_info, ptab) != -1) {
snprintf(buffer, sizeof buffer, "%s","Swsusp sig : detected");
snprintf(statbuffer, sizeof statbuffer, "%s","Swsusp sig : detected");
add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- } else if (error) {
- get_error(error, &error_buffer);
+ } else {
+ get_error(&error_buffer);
snprintf(buffer, sizeof buffer, "%s",error_buffer);
snprintf(statbuffer, sizeof statbuffer, "%s",error_buffer);
add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- free(error_buffer);
}
}
@@ -224,23 +223,14 @@ static int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
add_sep();
dn=disk_number;
- int error;
- parse_partition_table(&d[disk_number], &show_partition_information, &error);
- if (parse_partition_table(&d[disk_number], &compute_partition_information, &error)) {
- if (error) {
- char *error_buffer;
- get_error(error, &error_buffer);
- snprintf(buffer, sizeof buffer, "I/O error : %s", error_buffer);
- snprintf(statbuffer, sizeof statbuffer, "I/O error : %s", error_buffer);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu[nb_sub_disk_menu].items_count++;
- free(error_buffer);
- } else {
- snprintf(buffer, sizeof buffer, "An unknown error occured");
- snprintf(statbuffer, sizeof statbuffer, "An unknown error occured");
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu[nb_sub_disk_menu].items_count++;
- }
+ parse_partition_table(&d[disk_number], &show_partition_information);
+ if (parse_partition_table(&d[disk_number], &compute_partition_information) == -1) {
+ char error_buffer[MAX_DISK_ERRNO];
+ get_error(&error_buffer);
+ snprintf(buffer, sizeof buffer, "I/O error : %s", error_buffer);
+ snprintf(statbuffer, sizeof statbuffer, "I/O error : %s", error_buffer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu[nb_sub_disk_menu].items_count++;
}
return 0;