From 8d663918601896f6f5759a0f0b86a0131201dcfb Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 6 Mar 2011 11:59:33 +0000 Subject: Le thread recover utilise à present les bonnes datas. Reste à faire : - un module utilise slices.h pour faire la gestion évènementielle - la gestion de laccès aux slices de manireè concourrante - le thread d'affichage ncurses (1 module aussi sûrement) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@10 d3078510-dda0-49f1-841c-895ef4b7ec81 --- inc/recover.h | 2 +- src/ddhardrescue.c | 7 +++---- src/recover.c | 17 +++-------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/inc/recover.h b/inc/recover.h index 85f1738..2af7f3f 100755 --- a/inc/recover.h +++ b/inc/recover.h @@ -5,7 +5,7 @@ extern int end; -slices_t *recover(char *src, char *dst, char*ddOpts, address_t beginSector, address_t endSector/*, int depth*/); +void recover(slices_t *slices, char *src, char *dst, char*ddOpts); int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, char *dst, char *ddOpts); #endif /*RECOVER_H*/ diff --git a/src/ddhardrescue.c b/src/ddhardrescue.c index 9f0f0f8..afad903 100755 --- a/src/ddhardrescue.c +++ b/src/ddhardrescue.c @@ -124,12 +124,11 @@ int main(int argc, char **argv) { void * procWorker(void *a) { struct threadArgs *tArgs = (struct threadArgs *)a; - (void) recover( + recover( + tArgs->slices->data, tArgs->progArgs->src, tArgs->progArgs->dst, - tArgs->progArgs->ddOpts, - tArgs->progArgs->beginSector, - tArgs->progArgs->endSector + tArgs->progArgs->ddOpts ); return a; diff --git a/src/recover.c b/src/recover.c index ce098c2..309ebfb 100755 --- a/src/recover.c +++ b/src/recover.c @@ -5,23 +5,13 @@ extern unsigned long c; -slices_t *recover(char *src, char *dst, char *ddOpts, address_t beginSector, address_t endSector/*, int depth*/) { - slices_t *slices; +void recover(slices_t *slices, char *src, char *dst, char *ddOpts) { slice_t *sliceToRead; address_t firstError=0, median, foundMax=0; int res; - // Initialization : we want to try to recover the beginning of the whole zone - //FIXME : already done in main - slices=slicesNewEmpty(); - sliceToRead=sliceNew(beginSector, endSector, S_UNKNOWN, NULL); - if (sliceToRead==NULL) { - exit(1);//TODO - } - slicesAppend(slices, sliceToRead); - - // Main loop - while (!end) { // && slices->count < (endSector-beginSector)/depth) { + sliceToRead=slices->first; + while (!end) { // try to recover sliceToRead and split it if read error switch ( tryRecoverUntilError(sliceToRead, &firstError, src, dst, ddOpts) ) { case 0: @@ -82,7 +72,6 @@ slices_t *recover(char *src, char *dst, char *ddOpts, address_t beginSector, add exit(6); // TODO } } - return slices; } int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, char *dst, char*ddOpts) { -- cgit v1.2.3