summaryrefslogtreecommitdiff
path: root/src/recover.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recover.c')
-rwxr-xr-xsrc/recover.c17
1 files changed, 3 insertions, 14 deletions
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) {