summaryrefslogtreecommitdiff
path: root/src/ddhardrescue.c
blob: a99b9d83cf283977a43139605ef74b5595e8f8e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include "slices.h"
#include "recover.h"

int end=0;
unsigned long c=0;

void sigHookAbrt() {
	end=1;
}

int main() {
	char *src, *dst, *ddOpts, *dump;
	address_t beginSector, endSector, blockSize;
	int /*depth,*/i;
	slices_t *slices;
	slice_t *curr, *toFree;
	
	//TODO Parse args
	src="/dev/sdb";
	dst="./test.img";
	ddOpts="";
	beginSector=0;
	endSector=19999;
//	depth=1;
/*
	endSector=1999999999;
	depth=100000;
*/
	//TODO signal...

	slices=recover(src,dst,ddOpts,beginSector,endSector/*,depth*/);
	
	blockSize=0;
	dump=slicesDump(slices, &blockSize, 1000, beginSector, endSector);
	puts(dump);
	free(dump);
	printf("blockSize==%ld\n", blockSize);
	printf("c==%ld\n", c);
	printf("slices->count==%d\n", slices->count);

	curr=slices->first;
	i=0;
	while (curr!=NULL) {
		i++;
		toFree=curr;
		curr=curr->next;
		free(toFree);
	}
	free(slices);

	printf("i==%d\n", i);

	return 0;
}