summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinc/recover.h2
-rwxr-xr-xsrc/ddhardrescue.c7
-rwxr-xr-xsrc/recover.c17
3 files changed, 7 insertions, 19 deletions
diff --git a/inc/recover.h b/inc/recover.h
index 85f1738..2af7f3f 100755
--- a/inc/recover.h
+++ b/inc/recover.h
@@ -5,7 +5,7 @@
extern int end;
-slices_t *recover(char *src, char *dst, char*ddOpts, address_t beginSector, address_t endSector/*, int depth*/);
+void recover(slices_t *slices, char *src, char *dst, char*ddOpts);
int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, char *dst, char *ddOpts);
#endif /*RECOVER_H*/
diff --git a/src/ddhardrescue.c b/src/ddhardrescue.c
index 9f0f0f8..afad903 100755
--- a/src/ddhardrescue.c
+++ b/src/ddhardrescue.c
@@ -124,12 +124,11 @@ int main(int argc, char **argv) {
void * procWorker(void *a) {
struct threadArgs *tArgs = (struct threadArgs *)a;
- (void) recover(
+ recover(
+ tArgs->slices->data,
tArgs->progArgs->src,
tArgs->progArgs->dst,
- tArgs->progArgs->ddOpts,
- tArgs->progArgs->beginSector,
- tArgs->progArgs->endSector
+ tArgs->progArgs->ddOpts
);
return a;
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) {