aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
authorgermeier <germeier>2003-04-18 13:53:00 +0000
committergermeier <germeier>2003-04-18 13:53:00 +0000
commit477d356ffb4f510fb91e9ee1656bf63906d79830 (patch)
tree8e68a4213c27079a36e33199a0fb986b57af5487 /mpiosh
parent7a5c797c9f6ba1b967b078a7392f19c044463564 (diff)
downloadmpiosh-477d356ffb4f510fb91e9ee1656bf63906d79830.tar.gz
mpiosh-477d356ffb4f510fb91e9ee1656bf63906d79830.tar.bz2
mpiosh-477d356ffb4f510fb91e9ee1656bf63906d79830.zip
implemented "health" function. this is UNTESTED!
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c54
-rw-r--r--mpiosh/callback.h3
-rw-r--r--mpiosh/global.c5
3 files changed, 59 insertions, 3 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index 28c0284..b252f24 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.37 2003/04/11 22:53:10 germeier Exp $
+ * $Id: callback.c,v 1.38 2003/04/18 13:53:01 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -709,6 +709,7 @@ mpiosh_cmd_format(char *args[])
}
}
+ mpiosh_cmd_health(NULL);
}
}
@@ -745,6 +746,57 @@ mpiosh_cmd_dump_mem(char *args[])
}
void
+mpiosh_cmd_health(char *args[])
+{
+ mpio_health_t health;
+ int i, lost;
+
+ UNUSED(args);
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ mpio_health(mpiosh.dev, mpiosh.card, &health);
+
+ if (mpiosh.card == MPIO_INTERNAL_MEM) {
+ lost=0;
+ printf("health status of internal memory:\n");
+ printf("=================================\n");
+ printf("%d chip%c (total/spare/broken)\n",
+ health.num, ((health.num==1)?' ':'s'));
+ for(i=0; i<health.num; i++) {
+ printf("chip #%d (%5d/%5d/%6d)\n", (i+1),
+ health.data[i].total,
+ health.data[i].spare,
+ health.data[i].broken);
+ lost+=health.data[i].broken;
+ }
+ if (lost)
+ printf("You have lost %d KB due to bad blocks.\n", lost*16);
+ }
+
+ if (mpiosh.card == MPIO_EXTERNAL_MEM) {
+ lost=0;
+ printf("health status of external memory:\n");
+ printf("=================================\n");
+ printf("%d zone%c (total/spare/broken)\n",
+ health.num, ((health.num==1)?' ':'s'));
+ for(i=0; i<health.num; i++) {
+ printf("zone #%d (%5d/%5d/%6d)\n", (i+1),
+ health.data[i].total,
+ health.data[i].spare,
+ health.data[i].broken);
+ if (health.data[i].spare<health.data[i].broken)
+ lost++;
+ }
+ if (lost)
+ printf("%d zone%s to many broken blocks, expect trouble! :-(\n", lost,
+ ((lost==1)?" has":"s have"));
+ }
+
+
+}
+
+void
mpiosh_cmd_config(char *args[])
{
BYTE *config_data;
diff --git a/mpiosh/callback.h b/mpiosh/callback.h
index ac9862c..b480105 100644
--- a/mpiosh/callback.h
+++ b/mpiosh/callback.h
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.h,v 1.8 2003/04/06 23:09:20 germeier Exp $
+ * $Id: callback.h,v 1.9 2003/04/18 13:53:02 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -50,6 +50,7 @@ void mpiosh_cmd_free(char *args[]);
void mpiosh_cmd_format(char *args[]);
void mpiosh_cmd_switch(char *args[]);
void mpiosh_cmd_dump_mem(char *args[]);
+void mpiosh_cmd_health(char *args[]);
void mpiosh_cmd_config(char *args[]);
void mpiosh_cmd_channel(char *args[]);
diff --git a/mpiosh/global.c b/mpiosh/global.c
index 4bfe7b5..7910eff 100644
--- a/mpiosh/global.c
+++ b/mpiosh/global.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Buesching <crunchy@tzi.de>
*
- * $Id: global.c,v 1.8 2003/04/06 23:09:20 germeier Exp $
+ * $Id: global.c,v 1.9 2003/04/18 13:53:02 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -117,6 +117,9 @@ struct mpiosh_cmd_t commands[] = {
{ "lmkdir", NULL, NULL,
" create a local directory",
mpiosh_cmd_lmkdir, NULL },
+ { "health", NULL, NULL,
+ " show the health status from the selected memory",
+ mpiosh_cmd_health, NULL },
{ "dump_memory", NULL, NULL,
" dump FAT, directory, spare area and the first 0x100 of the\n"
" selected memory card",