tImplement srewind() to rewind the snapshot entry offset - dedup - deduplicating backup program
 (HTM) git clone git://git.z3bra.org/dedup.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ec866bc6c38a907bd94f3954119217c36eac50f3
 (DIR) parent be0f2c397e37e4c59132931c4b3d522a9ed493ff
 (HTM) Author: sin <sin@2f30.org>
       Date:   Thu, 25 Apr 2019 14:06:35 +0100
       
       Implement srewind() to rewind the snapshot entry offset
       
       Diffstat:
         M snap.c                              |      10 ++++++++++
         M snap.h                              |       1 +
       
       2 files changed, 11 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/snap.c b/snap.c
       t@@ -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;
       t@@ -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;
 (DIR) diff --git a/snap.h b/snap.h
       t@@ -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);