From 78725557a028004d6e03a6ce82856eae282a1a8f Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Fri, 18 Feb 2011 17:06:00 +0000 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@2 d3078510-dda0-49f1-841c-895ef4b7ec81 --- src/slices.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 src/slices.h (limited to 'src/slices.h') 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 +#include + +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*/ -- cgit v1.2.3