dedup

data deduplication program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit ec866bc6c38a907bd94f3954119217c36eac50f3
parent be0f2c397e37e4c59132931c4b3d522a9ed493ff
Author: sin <sin@2f30.org>
Date:   Thu, 25 Apr 2019 14:06:35 +0100

Implement srewind() to rewind the snapshot entry offset

Diffstat:
Msnap.c | 10++++++++++
Msnap.h | 1+
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/snap.c b/snap.c @@ -128,6 +128,7 @@ screat(char *path, int mode, struct sctx **sctx) close(fd); return -1; } + SLIST_INIT(&(*sctx)->mdhead); (*sctx)->mdnext = NULL; (*sctx)->fd = fd; @@ -203,6 +204,15 @@ sput(struct sctx *sctx, unsigned char *md) } int +srewind(struct sctx *sctx) +{ + if (sctx == NULL) + return -1; + sctx->mdnext = NULL; + return 0; +} + +int ssync(struct sctx *sctx) { struct mdnode *mdnode; diff --git a/snap.h b/snap.h @@ -4,5 +4,6 @@ extern int screat(char *path, int mode, struct sctx **sctx); extern int sopen(char *path, int flags, int mode, struct sctx **sctx); extern int sget(struct sctx *sctx, unsigned char *md); extern int sput(struct sctx *sctx, unsigned char *md); +extern int srewind(struct sctx *sctx); extern int ssync(struct sctx *sctx); extern int sclose(struct sctx *sctx);