summaryrefslogtreecommitdiff
path: root/csum-file.h
diff options
context:
space:
mode:
Diffstat (limited to 'csum-file.h')
-rw-r--r--csum-file.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/csum-file.h b/csum-file.h
index e54d53d..bc5bec2 100644
--- a/csum-file.h
+++ b/csum-file.h
@@ -1,7 +1,8 @@
#ifndef CSUM_FILE_H
#define CSUM_FILE_H
-#include "hash.h"
+#include "hash-ll.h"
+#include "write-or-die.h"
struct progress;
@@ -16,7 +17,16 @@ struct hashfile {
const char *name;
int do_crc;
uint32_t crc32;
- unsigned char buffer[8192];
+ size_t buffer_len;
+ unsigned char *buffer;
+ unsigned char *check_buffer;
+
+ /**
+ * If non-zero, skip_hash indicates that we should
+ * not actually compute the hash for this hashfile and
+ * instead only use it as a buffered write.
+ */
+ int skip_hash;
};
/* Checkpoint */
@@ -36,12 +46,15 @@ int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *);
struct hashfile *hashfd(int fd, const char *name);
struct hashfile *hashfd_check(const char *name);
struct hashfile *hashfd_throughput(int fd, const char *name, struct progress *tp);
-int finalize_hashfile(struct hashfile *, unsigned char *, unsigned int);
+int finalize_hashfile(struct hashfile *, unsigned char *, enum fsync_component, unsigned int);
void hashwrite(struct hashfile *, const void *, unsigned int);
void hashflush(struct hashfile *f);
void crc32_begin(struct hashfile *);
uint32_t crc32_end(struct hashfile *);
+/* Verify checksum validity while reading. Returns non-zero on success. */
+int hashfile_checksum_valid(const unsigned char *data, size_t len);
+
/*
* Returns the total number of bytes fed to the hashfile so far (including ones
* that have not been written out to the descriptor yet).