summaryrefslogtreecommitdiff
path: root/src/recover.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recover.c')
-rw-r--r--src/recover.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/recover.c b/src/recover.c
index e6e574a..2131542 100644
--- a/src/recover.c
+++ b/src/recover.c
@@ -1,10 +1,10 @@
-#include <errno.h>
-#include <stdio.h>
#include "recover.h"
-// Just for sleep
-#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h> /* for usleep - to be removed */
+// Main algorithm for recover datas
void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) {
slice_t *sliceToRead;
address_t firstError=0, median, foundMax=0;
@@ -62,21 +62,24 @@ void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) {
break;
case 3:
// Internal error of sliceSlpit because this set of parameters prevent split by 3
- exit(5); // TODO
+ exit(6); // TODO
break;
case -1:
// Memory error
- exit(4); //TODO
+ exit(5); //TODO
break;
default:
// API error, all necessary cases are already listed
- exit(6); // TODO
+ exit(7); // TODO
}
}
}
+// Method tha read source (and clone to dest) until the first read error
int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src, char *dst, char*ddOpts) {
//TODO : implement realy that
+ //TODO : bail out hardly if WRITE error (on dest)
+
// char ddinvocation[256];
int res;
address_t seek, count;
@@ -117,7 +120,8 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src,
*firstError=error;
}
- usleep(10000);
+ // Keep things humanly understandable (to be removed when real reads will be done)
+ //usleep(10000);
return res;
}