summaryrefslogtreecommitdiff
path: root/src/slices.h
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2011-02-18 17:06:00 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2011-02-18 17:06:00 +0000
commit78725557a028004d6e03a6ce82856eae282a1a8f (patch)
tree784e507f65b4e9984e952e76a4e66ad228d9f261 /src/slices.h
parent4dc52777eb3e950f8758037f3e10f1b7e55957ba (diff)
download2011-ddhardrescue-78725557a028004d6e03a6ce82856eae282a1a8f.tar.gz
2011-ddhardrescue-78725557a028004d6e03a6ce82856eae282a1a8f.tar.bz2
2011-ddhardrescue-78725557a028004d6e03a6ce82856eae282a1a8f.zip
Iport initial du projet. Compile presque, reste beaucoup de fonctions utilisataires pour les slices à coder (notamment slicesDump()) et manque une gestion multi-thread pour aficher pendant le recovery.
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@2 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/slices.h')
-rwxr-xr-xsrc/slices.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/slices.h b/src/slices.h
new file mode 100755
index 0000000..062c4f4
--- /dev/null
+++ b/src/slices.h
@@ -0,0 +1,29 @@
+#ifndef SLICES_H
+#define SLICES_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum { S_UNKNOWN, S_RECOVERED, S_UNREADABLE } sliceStatus_t;
+typedef uint32_t address_t;
+
+typedef struct _slice {
+ uint32_t begin, end;
+ sliceStatus_t status;
+ struct _slice *next;
+} slice_t;
+
+typedef struct {
+ int count;
+ slice_t *first, *last;
+} slices_t;
+
+slice_t *sliceNew(address_t begin, address_t end, sliceStatus_t status, slice_t *next);
+int sliceSplit(slice_t *slice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter);
+
+slices_t *slicesNew();
+void slicesAppend(slices_t *slices, slice_t *slice);
+slice_t *slicesFindLargest(slices_t *slices, sliceStatus_t status);
+char *slicesDump(slices_t *slices, int charCount, address_t begin, address_t end);
+
+#endif /*SLICES_H*/