From 71ab9acfd97cf1f71c1f66f5e1a8b879c0960e40 Mon Sep 17 00:00:00 2001 From: germeier Date: Wed, 18 Sep 2002 22:18:29 +0000 Subject: removed wrong block mapping added progress_callback for mpio_init mpiosh: external memory is only selectable if it is available --- mpiosh/callback.c | 27 ++++++++++++++++++++++----- mpiosh/callback.h | 3 ++- mpiosh/mpiosh.c | 5 +++-- 3 files changed, 27 insertions(+), 8 deletions(-) (limited to 'mpiosh') diff --git a/mpiosh/callback.c b/mpiosh/callback.c index df4a3ab..bdcb345 100644 --- a/mpiosh/callback.c +++ b/mpiosh/callback.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.c,v 1.9 2002/09/18 20:32:22 crunchy Exp $ + * $Id: callback.c,v 1.10 2002/09/18 22:18:29 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -160,13 +160,20 @@ mpiosh_cmd_info(char *args[]) void mpiosh_cmd_mem(char *args[]) { + int free; + MPIOSH_CHECK_CONNECTION_CLOSED; MPIOSH_CHECK_ARG; if (!strcmp(args[0], "e")) { - mpiosh.card = MPIO_EXTERNAL_MEM; - mpiosh.prompt = PROMPT_EXT; - printf("external memory card is selected\n"); + if (mpio_memory_free(mpiosh.dev, mpiosh.card, &free)) { + mpiosh.card = MPIO_EXTERNAL_MEM; + mpiosh.prompt = PROMPT_EXT; + printf("external memory card is selected\n"); + } else { + printf("no external memory card is available\n"); + } + } else if (!strcmp(args[0], "i")) { mpiosh.card = MPIO_INTERNAL_MEM; mpiosh.prompt = PROMPT_INT; @@ -183,7 +190,8 @@ mpiosh_cmd_open(char *args[]) UNUSED(args); - mpiosh.dev = mpio_init(); + mpiosh.dev = mpio_init(mpiosh_callback_init); + printf("\n"); if (mpiosh.dev == NULL) printf("error: could not open connection MPIO player\n"); @@ -217,6 +225,15 @@ mpiosh_cmd_quit(char *args[]) exit(0); } +BYTE +mpiosh_callback_init(int read, int total) +{ + printf("\rinitialized %.2f %%", ((double) read / total) * 100.0 ); + fflush(stdout); + + return mpiosh_cancel; // continue +} + BYTE mpiosh_callback_get(int read, int total) { diff --git a/mpiosh/callback.h b/mpiosh/callback.h index 92642fa..08a756c 100644 --- a/mpiosh/callback.h +++ b/mpiosh/callback.h @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.h,v 1.3 2002/09/15 12:03:23 germeier Exp $ + * $Id: callback.h,v 1.4 2002/09/18 22:18:29 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -55,6 +55,7 @@ void mpiosh_cmd_lcd(char *args[]); void mpiosh_cmd_lmkdir(char *args[]); /* progress callbacks */ +BYTE mpiosh_callback_init(int read, int total); BYTE mpiosh_callback_get(int read, int total); BYTE mpiosh_callback_put(int read, int total); BYTE mpiosh_callback_del(int read, int total); diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 10e518e..aa4ff2d 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.13 2002/09/18 20:32:22 crunchy Exp $ + * $Id: mpiosh.c,v 1.14 2002/09/18 22:18:29 germeier Exp $ * * Author: Andreas Büsching * @@ -418,7 +418,8 @@ main(int argc, char *argv[]) { debug_init(); mpiosh_init(); - mpiosh.dev = mpio_init(); + mpiosh.dev = mpio_init(mpiosh_callback_init); + printf("\n"); if (mpiosh.card == MPIO_INTERNAL_MEM) mpiosh.prompt = PROMPT_INT; -- cgit v1.2.3