diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-03-06 11:59:33 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-03-06 11:59:33 +0000 |
commit | 8d663918601896f6f5759a0f0b86a0131201dcfb (patch) | |
tree | ddad8fd7d79482c75c8d3c00e8534a2905455850 | |
parent | c5f58f1bc59707660112f21d91f38468be60f7a5 (diff) | |
download | 2011-ddhardrescue-8d663918601896f6f5759a0f0b86a0131201dcfb.tar.gz 2011-ddhardrescue-8d663918601896f6f5759a0f0b86a0131201dcfb.tar.bz2 2011-ddhardrescue-8d663918601896f6f5759a0f0b86a0131201dcfb.zip |
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)
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@10 d3078510-dda0-49f1-841c-895ef4b7ec81
-rwxr-xr-x | inc/recover.h | 2 | ||||
-rwxr-xr-x | src/ddhardrescue.c | 7 | ||||
-rwxr-xr-x | 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) { |