diff options
author | germeier <germeier> | 2002-09-13 17:01:32 +0000 |
---|---|---|
committer | germeier <germeier> | 2002-09-13 17:01:32 +0000 |
commit | 0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf (patch) | |
tree | ced72ea2bddc140a20cef04d861e93219cae5aeb | |
parent | b10e3b7730109f824575b45ba38b8f95520add02 (diff) | |
download | mpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.tar.gz mpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.tar.bz2 mpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.zip |
fixed abort handling in mpio_file_put
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libmpio/mpio.c | 24 |
2 files changed, 23 insertions, 7 deletions
@@ -1,3 +1,7 @@ +2002-09-13 Markus Germeier <mager@tzi.e> + + * libmpio/mpio.c (mpio_file_put): fixed abort handling + 2002-09-13 Andreas Buesching <crunchy@tzi.de> * mpiosh/callback.c (mpiosh_callback_get, mpiosh_callback_put) @@ -11,7 +15,7 @@ * mpiosh/mpiosh.c: add new command lpwd -2002-09-13 Markus Germeier <mager@informatik.uni-bremen.de> +2002-09-13 Markus Germeier <mager@tzi.de> * mpiosh/callback.c (mpiosh_cmd_put, mpiosh_cmd_del) (mpiosh_cmd_mdel, mpiosh_cmd_mput): use mpio_sync diff --git a/libmpio/mpio.c b/libmpio/mpio.c index e61c782..b32dee6 100644 --- a/libmpio/mpio.c +++ b/libmpio/mpio.c @@ -1,6 +1,6 @@ /* * - * $Id: mpio.c,v 1.13 2002/09/13 13:07:05 germeier Exp $ + * $Id: mpio.c,v 1.14 2002/09/13 17:01:34 germeier Exp $ * * Library for USB MPIO-* * @@ -307,6 +307,8 @@ mpio_file_get(mpio_t *m, mpio_mem_t mem, BYTE *filename, if (progress_callback) abort=(*progress_callback)((fsize-filesize), fsize); + if (abort) + debug("aborting operation\n"); } while ((mpio_fatentry_next_entry(m, mem, f) && (filesize>0)) && (!abort)); @@ -459,26 +461,36 @@ mpio_file_put(mpio_t *m, mpio_mem_t mem, BYTE *filename, close(fd); - if (progress_callback) - abort=(*progress_callback)((fsize-filesize), fsize); - if (abort) { /* delete the just written blocks, because the user * aborted the operation */ + debug("aborting operation\n"); + debug("removing already written blocks\n"); + + filesize=fsize; memcpy(¤t, &firstblock, sizeof(mpio_fatentry_t)); memcpy(&backup, &firstblock, sizeof(mpio_fatentry_t)); - + while (mpio_fatentry_next_entry(m, mem, ¤t)) { mpio_io_block_delete(m, mem, &backup); mpio_fatentry_set_free(m, mem, &backup); memcpy(&backup, ¤t, sizeof(mpio_fatentry_t)); + + if (filesize > BLOCK_SIZE) + { + filesize -= BLOCK_SIZE; + } else { + filesize -= filesize; + } + + if (progress_callback) + (*progress_callback)((fsize-filesize), fsize); } mpio_io_block_delete(m, mem, &backup); mpio_fatentry_set_free(m, mem, &backup); - } else { mpio_dentry_put(m, mem, filename, strlen(filename), |