diff options
Diffstat (limited to 'csum-file.h')
| -rw-r--r-- | csum-file.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/csum-file.h b/csum-file.h index 7c73da0a40..07ae11024a 100644 --- a/csum-file.h +++ b/csum-file.h @@ -11,7 +11,7 @@ struct hashfile { int fd; int check_fd; unsigned int offset; - git_hash_ctx ctx; + struct git_hash_ctx ctx; off_t total; struct progress *tp; const char *name; @@ -20,6 +20,7 @@ struct hashfile { size_t buffer_len; unsigned char *buffer; unsigned char *check_buffer; + const struct git_hash_algo *algop; /** * If non-zero, skip_hash indicates that we should @@ -32,9 +33,10 @@ struct hashfile { /* Checkpoint */ struct hashfile_checkpoint { off_t offset; - git_hash_ctx ctx; + struct git_hash_ctx ctx; }; +void hashfile_checkpoint_init(struct hashfile *, struct hashfile_checkpoint *); void hashfile_checkpoint(struct hashfile *, struct hashfile_checkpoint *); int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *); @@ -43,9 +45,12 @@ int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *); #define CSUM_FSYNC 2 #define CSUM_HASH_IN_STREAM 4 -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); +struct hashfile *hashfd(const struct git_hash_algo *algop, + int fd, const char *name); +struct hashfile *hashfd_check(const struct git_hash_algo *algop, + const char *name); +struct hashfile *hashfd_throughput(const struct git_hash_algo *algop, + int fd, const char *name, struct progress *tp); /* * Free the hashfile without flushing its contents to disk. This only @@ -64,7 +69,8 @@ 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); +int hashfile_checksum_valid(const struct git_hash_algo *algop, + const unsigned char *data, size_t len); /* * Returns the total number of bytes fed to the hashfile so far (including ones |
