commit d96224299eea385265b405cc59a3b4881e75d69c
parent fb016d2858d1d77359c56f4d67070fc8386879b6
Author: sin <sin@2f30.org>
Date: Sun, 5 May 2019 21:17:32 +0100
Add some comments to snap.c
Diffstat:
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/snap.c b/snap.c
@@ -20,15 +20,15 @@
#define NERRBUF 128
struct mdnode {
- unsigned char md[MDSIZE];
- SLIST_ENTRY(mdnode) e;
+ unsigned char md[MDSIZE]; /* hash of block */
+ SLIST_ENTRY(mdnode) e; /* mdhead link node */
};
struct sctx {
- SLIST_HEAD(mdhead, mdnode) mdhead;
- struct mdnode *mdnext;
- int fd;
- int rdonly;
+ SLIST_HEAD(mdhead, mdnode) mdhead; /* list of hashes contained in snapshot */
+ struct mdnode *mdnext; /* next hash to be returned via sget() */
+ int fd; /* underlying snapshot file descriptor */
+ int rdonly; /* when set to 1, the ssync() operation is a no-op */
};
static char errbuf[NERRBUF];
@@ -45,7 +45,7 @@ loadmd(struct sctx *sctx)
}
if (xread(sctx->fd, mdnode->md, MDSIZE) != MDSIZE) {
free(mdnode);
- sseterr("failed to read message digest: %s", strerror(errno));
+ sseterr("failed to read block hash: %s", strerror(errno));
return -1;
}
SLIST_INSERT_HEAD(&sctx->mdhead, mdnode, e);
@@ -224,7 +224,7 @@ ssync(struct sctx *sctx)
}
SLIST_FOREACH(mdnode, &sctx->mdhead, e) {
if (xwrite(sctx->fd, mdnode->md, MDSIZE) != MDSIZE) {
- sseterr("failed to write message digest: %s",
+ sseterr("failed to write block hash: %s",
strerror(errno));
return -1;
}