#ifndef CSUM_FILE_H
#define CSUM_FILE_H
#include "hash.h"
#include "write-or-die.h"
struct progress;
struct hashfile { … };
struct hashfile_checkpoint { … };
void hashfile_checkpoint(struct hashfile *, struct hashfile_checkpoint *);
int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *);
#define CSUM_CLOSE …
#define CSUM_FSYNC …
#define CSUM_HASH_IN_STREAM …
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);
void free_hashfile(struct hashfile *f);
int finalize_hashfile(struct hashfile *, unsigned char *, enum fsync_component, unsigned int);
void discard_hashfile(struct hashfile *);
void hashwrite(struct hashfile *, const void *, unsigned int);
void hashflush(struct hashfile *f);
void crc32_begin(struct hashfile *);
uint32_t crc32_end(struct hashfile *);
int hashfile_checksum_valid(const unsigned char *data, size_t len);
static inline off_t hashfile_total(struct hashfile *f)
{ … }
static inline void hashwrite_u8(struct hashfile *f, uint8_t data)
{ … }
static inline void hashwrite_be32(struct hashfile *f, uint32_t data)
{ … }
static inline size_t hashwrite_be64(struct hashfile *f, uint64_t data)
{ … }
#endif