diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-03-06 20:46:29 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-03-06 20:46:29 +0000 |
commit | 6c701b58a24d96e37c323412f3d2aa334cd2ded1 (patch) | |
tree | a959865f001c94ce70bd94b5cd0f09c725f28fc4 /src/recover.c | |
parent | 8d663918601896f6f5759a0f0b86a0131201dcfb (diff) | |
download | 2011-ddhardrescue-6c701b58a24d96e37c323412f3d2aa334cd2ded1.tar.gz 2011-ddhardrescue-6c701b58a24d96e37c323412f3d2aa334cd2ded1.tar.bz2 2011-ddhardrescue-6c701b58a24d96e37c323412f3d2aa334cd2ded1.zip |
La gestion minimaliste des évènements de modification des slices est faite.
Un dump à chaque event a été codé dans le main pour tester cet aspect. C'est ok.
Go go go ncurses :D
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@11 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/recover.c')
-rwxr-xr-x | src/recover.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/recover.c b/src/recover.c index 309ebfb..b4f0da7 100755 --- a/src/recover.c +++ b/src/recover.c @@ -5,12 +5,12 @@ extern unsigned long c; -void recover(slices_t *slices, char *src, char *dst, char *ddOpts) { +void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) { slice_t *sliceToRead; address_t firstError=0, median, foundMax=0; int res; - sliceToRead=slices->first; + sliceToRead=slicesEvt->data->first; while (!end) { // try to recover sliceToRead and split it if read error switch ( tryRecoverUntilError(sliceToRead, &firstError, src, dst, ddOpts) ) { @@ -20,7 +20,7 @@ void recover(slices_t *slices, char *src, char *dst, char *ddOpts) { break; case EIO: // slice recovery has encountered a readerror - res=sliceSplit(slices, sliceToRead, firstError, S_RECOVERED, S_UNREADABLE, S_UNKNOWN); + res=sliceSplitEvt(slicesEvt, sliceToRead, firstError, S_RECOVERED, S_UNREADABLE, S_UNKNOWN); if (res<1) { //TODO printf("sliceSplit return %d\n", res); @@ -34,7 +34,7 @@ void recover(slices_t *slices, char *src, char *dst, char *ddOpts) { /* Now, search the largest S_UNKNOWN zone split it in two parts */ //sliceToRead=slicesFindLargest(slices, S_UNKNOWN); - sliceToRead=slicesFindLargestFast(slices, &foundMax, S_UNKNOWN, foundMax, sliceToRead->next); + sliceToRead=slicesFindLargestFast(slicesEvt->data, &foundMax, S_UNKNOWN, foundMax, sliceToRead->next); if ( sliceToRead == NULL ) { // There is nothing more to recover, bailout end=1; @@ -43,7 +43,7 @@ void recover(slices_t *slices, char *src, char *dst, char *ddOpts) { median=(sliceToRead->begin+sliceToRead->end)/2; - res=sliceSplit(slices, sliceToRead, median, S_UNKNOWN, S_UNKNOWN, S_UNKNOWN); + res=sliceSplitEvt(slicesEvt, sliceToRead, median, S_UNKNOWN, S_UNKNOWN, S_UNKNOWN); switch (res) { case 1: // No split, try analyse this zone @@ -92,10 +92,11 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, *firstError=sliceToRead->begin; res=EIO; */ +/* // Simulate that we have systematically a read error at last sector *firstError=sliceToRead->end; res=EIO; - +*/ /* // Simulate that we have systematically a read error at first sector // Simulate for each read, tha we have an error just in the middle if read for mor than one sector @@ -106,16 +107,16 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, res=EIO; } */ -/* + // Simulate for each read a pseudo random error position and generate some cases of full read without error - int error=sliceToRead->begin + rand()%count; + address_t error=sliceToRead->begin + rand()%count; if ( error % 42 == 0 ) { res=0; } else { res=EIO; *firstError=error; } -*/ + return res; } |