diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-10-09 12:33:48 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-10-09 12:33:48 +0000 |
commit | 0f2c685db3d3790ce9bdc9598df8dae7d6b67eae (patch) | |
tree | a2c2a7f8941e87368ee46163e028c553d1b6bcdf /src/slices_evt.c | |
download | 2011-ddhardrescue-origin/0.x.tar.gz 2011-ddhardrescue-origin/0.x.tar.bz2 2011-ddhardrescue-origin/0.x.zip |
On range tout le code actuel du trunk dans une branche nommée "0.x" et on crée une branche 1.x qui contiendra une nouvelle mouture (re-conception, méta info de packaging...).origin/0.x
git-svn-id: file:///var/svn/2011-ddhardrescue/branches/0.x@29 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/slices_evt.c')
-rw-r--r-- | src/slices_evt.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/slices_evt.c b/src/slices_evt.c new file mode 100644 index 0000000..4ed07c6 --- /dev/null +++ b/src/slices_evt.c @@ -0,0 +1,29 @@ +#include "slices_evt.h" + +#include <stdio.h> +#include <pthread.h> + +// Event-aware version of sliceSplit (reusing it, of course) +int sliceEvtSplit(slices_evt_t *slicesEvt, slice_t *initialSlice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter) { + int res; + res=sliceSplit(slicesEvt->data, initialSlice, splitAt, statusBefore, statusAt, statusAfter); + + pthread_mutex_lock(&(slicesEvt->eventListenerMutex)); + if ( slicesEvt->eventListener != NULL ) { + switch(res) { + case 3: + slicesEvt->eventListener(slicesEvt, initialSlice->next->next); + case 2: + slicesEvt->eventListener(slicesEvt, initialSlice->next); + case 1: + slicesEvt->eventListener(slicesEvt, initialSlice); + break; + default: + // No events on split errors + break; + } + } + pthread_mutex_unlock(&(slicesEvt->eventListenerMutex)); + return res; +} + |