Reorder bhdr field - dedup - deduplicating backup program
HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 14a97f465c31b9e0c707730ca8798dfd4140cb03
DIR parent d7e3a0358ece64c1d797e149c61c16472664b909
HTML Author: sin <sin@2f30.org>
Date: Tue, 7 May 2019 20:56:23 +0100
Reorder bhdr field
Diffstat:
M bstorage.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
DIR diff --git a/bstorage.c b/bstorage.c
@@ -103,9 +103,9 @@ RB_HEAD(bdcache, bd);
struct sctx {
struct bdcache bdcache; /* cache of block descriptors */
SLIST_HEAD(gchead, bd) gchead; /* list of all blocks with a zero refcount */
- struct bhdr bhdr; /* block header entry */
int fd; /* underlying storage file descriptor */
int rdonly; /* when set to 1, the bssync() operation is a no-op */
+ struct bhdr bhdr; /* block header entry */
};
static int
@@ -330,6 +330,8 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar)
sctx = bctx->sctx;
RB_INIT(&sctx->bdcache);
SLIST_INIT(&sctx->gchead);
+ sctx->fd = fd;
+
bhdr = &sctx->bhdr;
memcpy(bhdr->magic, BHDRMAGIC, NBHDRMAGIC);
bhdr->flags = (VMAJ << VMAJSHIFT) | VMIN;
@@ -359,9 +361,7 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar)
bseterr("invalid encryption type: %s", bpar->ealgo);
return -1;
}
-
bhdr->nbd = 0;
- sctx->fd = fd;
if (packbhdr(fd, bhdr) < 0) {
free(sctx);