From e18088451d92fbf83bfb57fd48201eda117f8103 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 26 Jun 2005 22:01:46 -0700 Subject: csum-file interface updates: return resulting SHA1 Also, make the writing of the SHA1 as a end-header be conditional: not every user will necessarily want to write the SHA1 to the file itself, even though current users do (but we migh end up using the same helper functions for the object files themselves, that don't do this). This also makes the packed index file contain the SHA1 of the packed data file at the end (just before its own SHA1). That way you can validate the pairing of the two if you want to. --- csum-file.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'csum-file.h') diff --git a/csum-file.h b/csum-file.h index 1086f04caa..2b6c8dcad2 100644 --- a/csum-file.h +++ b/csum-file.h @@ -4,13 +4,14 @@ /* A SHA1-protected file */ struct sha1file { int fd, error; - unsigned long offset; + unsigned int offset, namelen; SHA_CTX ctx; + char name[PATH_MAX]; unsigned char buffer[8192]; }; extern struct sha1file *sha1create(const char *fmt, ...); -extern int sha1close(struct sha1file *); +extern int sha1close(struct sha1file *, unsigned char *, int); extern int sha1write(struct sha1file *, void *, unsigned int); extern int sha1write_compressed(struct sha1file *, void *, unsigned int); -- cgit v1.2.3