summaryrefslogtreecommitdiff
path: root/bcache.h
diff options
context:
space:
mode:
Diffstat (limited to 'bcache.h')
-rw-r--r--bcache.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/bcache.h b/bcache.h
index eab2195..e3c10ca 100644
--- a/bcache.h
+++ b/bcache.h
@@ -41,4 +41,12 @@ struct cache_sb {
uint64_t d[512]; /* journal buckets */
};
+inline uint64_t crc64(const void *_data, size_t len);
+
+#define node(i, j) ((void *) ((i)->d + (j)))
+#define end(i) node(i, (i)->keys)
+
+#define csum_set(i) \
+ crc64(((void *) (i)) + 8, ((void *) end(i)) - (((void *) (i)) + 8))
+
#endif