summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/recover.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/recover.c b/src/recover.c
index 9b1719b..8d47853 100644
--- a/src/recover.c
+++ b/src/recover.c
@@ -2,15 +2,13 @@
#include <stdio.h>
#include "recover.h"
-
-extern unsigned long c;
-
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=slicesEvt->data->first;
+ //sliceToRead=slicesEvt->data->first;
+ sliceToRead=slicesFindLargest(slicesEvt->data, S_UNKNOWN);
while (!end) {
// try to recover sliceToRead and split it if read error
switch ( tryRecoverUntilError(sliceToRead, &firstError, src, dst, ddOpts) ) {
@@ -20,10 +18,10 @@ void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) {
break;
case EIO:
// slice recovery has encountered a readerror
- res=sliceSplitEvt(slicesEvt, sliceToRead, firstError, S_RECOVERED, S_UNREADABLE, S_UNKNOWN);
+ res=sliceEvtSplit(slicesEvt, sliceToRead, firstError, S_RECOVERED, S_UNREADABLE, S_UNKNOWN);
if (res<1) {
//TODO
- printf("sliceSplit return %d\n", res);
+ printf("sliceEvtSplit return %d\n", res);
exit(5);
}
break;
@@ -43,7 +41,7 @@ void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) {
median=(sliceToRead->begin+sliceToRead->end)/2;
- res=sliceSplitEvt(slicesEvt, sliceToRead, median, S_UNKNOWN, S_UNKNOWN, S_UNKNOWN);
+ res=sliceEvtSplit(slicesEvt, sliceToRead, median, S_UNKNOWN, S_UNKNOWN, S_UNKNOWN);
switch (res) {
case 1:
// No split, try analyse this zone
@@ -80,8 +78,6 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src,
int res;
address_t seek, count;
- c++; //XXX This is a debug counter
-
seek=sliceToRead->begin;
count=sliceToRead->end - seek + 1;
// res=snprintf(ddinvocation, 255, "dd %s %s %s seek=%lld skip=%lld count=%lld", src, dst, ddOpts, seek, seek, count);