summaryrefslogtreecommitdiff
path: root/bcache.h
diff options
context:
space:
mode:
authorRicky Benitez <rickyb@google.com>2011-07-26 10:02:15 -0700
committerRicky Benitez <rickyb@google.com>2011-07-26 10:02:15 -0700
commita02bc8df010a4f9255506ef9840d6efabe46db9d (patch)
treedd6f1afa6f8b2b04aa4248ff8344851e5fd98891 /bcache.h
parent02614b5c8154f1b2f76235202142db7abd8cff91 (diff)
Add checksum to superblock
Add checksum to the superblock to prevent warning messages when registering devices.
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