diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-02-22 16:23:52 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-02-22 16:23:52 +0000 |
commit | ebc3e0991986c8cf300312fff557b9670835cdb4 (patch) | |
tree | b1e7e0924c237557ddcf47d2a36d60e8a6b81451 /src/recover.c | |
parent | 319f923c57c640dd35679817924d063e6741b623 (diff) | |
download | 2011-ddhardrescue-ebc3e0991986c8cf300312fff557b9670835cdb4.tar.gz 2011-ddhardrescue-ebc3e0991986c8cf300312fff557b9670835cdb4.tar.bz2 2011-ddhardrescue-ebc3e0991986c8cf300312fff557b9670835cdb4.zip |
Fonction slicesFindLargestFast() et semble bien marcher.
Passage au 64 bits (long long int), correction de quelques cast implicites détruisant de l'information utile.
Peaufinnage de la fonction slicesDump(), mais c'est pas encore terminé. En tout cas le calcul du blockSize à l'air d'être meilleur à présent, disons qu'on voit la fin des informations.
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@4 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/recover.c')
-rwxr-xr-x | src/recover.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/recover.c b/src/recover.c index 0f305a1..5e9e187 100755 --- a/src/recover.c +++ b/src/recover.c @@ -4,10 +4,10 @@ extern unsigned long c; -slices_t *recover(char *src, char *dst, char*ddOpts, address_t beginSector, address_t endSector/*, int depth*/) { +slices_t *recover(char *src, char *dst, char *ddOpts, address_t beginSector, address_t endSector/*, int depth*/) { slices_t *slices; slice_t *sliceToRead; - address_t firstError=0, median; + address_t firstError=0, median, foundMax=0; int res; // Initialization : we want to try to recover the beginning of the whole zone @@ -41,7 +41,8 @@ slices_t *recover(char *src, char *dst, char*ddOpts, address_t beginSector, addr /* Now, search the largest S_UNKNOWN zone split it in two parts */ - sliceToRead=slicesFindLargest(slices, S_UNKNOWN); + //sliceToRead=slicesFindLargest(slices, S_UNKNOWN); + sliceToRead=slicesFindLargestFast(slices, &foundMax, S_UNKNOWN, foundMax, sliceToRead->next); if ( sliceToRead == NULL ) { // There is nothing more to recover, bailout end=1; @@ -92,14 +93,20 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, seek=sliceToRead->begin; count=sliceToRead->end - seek + 1; - res=snprintf(ddinvocation, 255, "dd %s %s %s seek=%ld skip=%ld count=%ld", src, dst, ddOpts, seek, seek, count); + res=snprintf(ddinvocation, 255, "dd %s %s %s seek=%lld skip=%lld count=%lld", src, dst, ddOpts, seek, seek, count); puts(ddinvocation); +/* // Simulate that we have systematically a read error at first sector *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 if ( sliceToRead->begin == sliceToRead->end ) { res=0; @@ -108,7 +115,6 @@ 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; |