aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
authorgermeier <germeier>2003-04-11 21:42:57 +0000
committergermeier <germeier>2003-04-11 21:42:57 +0000
commit17225c6d8fe3c925c5863f736f6572720c95c5d7 (patch)
treeab43eddfdb58eb47ad05bff98ae3a7639eb07335 /mpiosh
parent50c439ffa36fed9e1cce65b211ec05bf50925cc2 (diff)
downloadmpiosh-17225c6d8fe3c925c5863f736f6572720c95c5d7.tar.gz
mpiosh-17225c6d8fe3c925c5863f736f6572720c95c5d7.tar.bz2
mpiosh-17225c6d8fe3c925c5863f736f6572720c95c5d7.zip
timestamp generation fixes as suggested by Sebastian
8.3 generation fixes for "MPIO RECORD" directory
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index c3e82d4..8006e5f 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Bsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.35 2003/04/06 23:09:20 germeier Exp $
+ * $Id: callback.c,v 1.36 2003/04/11 21:42:58 germeier Exp $
*
* Copyright (C) 2001 Andreas Bsching <crunchy@tzi.de>
*
@@ -518,9 +518,10 @@ void
mpiosh_cmd_mdel(char *args[])
{
BYTE * p;
- int size, i = 0;
+ int i = 0;
int error;
regex_t regex;
+ int r;
BYTE fname[100];
BYTE errortext[100];
BYTE month, day, hour, minute, type;
@@ -543,19 +544,27 @@ mpiosh_cmd_mdel(char *args[])
mpio_dentry_get(mpiosh.dev, mpiosh.card, p, fname, 100,
&year, &month, &day, &hour, &minute, &fsize, &type);
- if (!(error = regexec(&regex, fname, 0, NULL, 0))) {
+ if ((!(error = regexec(&regex, fname, 0, NULL, 0))) &&
+ (strcmp(fname, "..")) && (strcmp(fname, ".")))
+ {
/* this line has to be above the del, or we won't write
* the FAT and directory in case of an abort!!!
*/
deleted=1;
printf("deleting '%s' ... \n", fname);
- size = mpio_file_del(mpiosh.dev, mpiosh.card,
+ r = mpio_file_del(mpiosh.dev, mpiosh.card,
fname, mpiosh_callback_del);
printf("\n");
if (mpiosh_cancel) break;
/* if we delete a file, start again from the beginning,
because the directory has changed !! */
- p = mpio_directory_open(mpiosh.dev, mpiosh.card);
+ if (r != MPIO_OK)
+ {
+ printf("ERROR: %s\n", mpio_strerror(r));
+ p = mpio_dentry_next(mpiosh.dev, mpiosh.card, p);
+ break;
+ }
+ p = mpio_directory_open(mpiosh.dev, mpiosh.card);
} else {
regerror(error, &regex, errortext, 100);
debugn (2, "file does not match: %s (%s)\n", fname, errortext);
@@ -630,8 +639,8 @@ void
mpiosh_cmd_format(char *args[])
{
char answer[512];
- BYTE *config, *fmconfig;
- int csize, fmsize;
+ BYTE *config, *fmconfig, *rconfig;
+ int csize, fmsize, rsize;
MPIOSH_CHECK_CONNECTION_CLOSED;
@@ -647,11 +656,14 @@ mpiosh_cmd_format(char *args[])
/* save config files and write them back after formatting */
config = NULL;
fmconfig = NULL;
+ rconfig = NULL;
csize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_CONFIG_FILE, NULL, &config);
fmsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_CHANNEL_FILE, NULL, &fmconfig);
+ rsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_MPIO_RECORD, NULL, &rconfig);
}
if (mpio_memory_format(mpiosh.dev, mpiosh.card,
@@ -672,13 +684,19 @@ mpiosh_cmd_format(char *args[])
MPIO_CHANNEL_FILE, FTYPE_CHAN,
NULL, fmconfig, fmsize)==-1)
mpio_perror("error");
+ if (rconfig)
+ if (mpio_directory_make(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_MPIO_RECORD)!=MPIO_OK)
+ mpio_perror("error");
- if (config || fmconfig)
+ if (config || fmconfig || rconfig)
mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM);
if (config)
free(config);
if (fmconfig)
free(fmconfig);
+ if (rconfig)
+ free(rconfig);
}
}