From ebc3e0991986c8cf300312fff557b9670835cdb4 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Tue, 22 Feb 2011 16:23:52 +0000 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@4 d3078510-dda0-49f1-841c-895ef4b7ec81 --- src/recover.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/recover.c') 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; -- cgit v1.2.3