git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob b026ec776675dee81aa275d8b79477b7dc8a8763 1703 bytes (raw)
name: csum-file.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 
#ifndef CSUM_FILE_H
#define CSUM_FILE_H

#include "hash.h"

struct progress;

/* A SHA1-protected file */
struct hashfile {
	int fd;
	int check_fd;
	unsigned int offset;
	git_hash_ctx ctx;
	off_t total;
	struct progress *tp;
	const char *name;
	int do_crc;
	uint32_t crc32;
	unsigned char buffer[8192];
};

/* Checkpoint */
struct hashfile_checkpoint {
	off_t offset;
	git_hash_ctx ctx;
};

void hashfile_checkpoint(struct hashfile *, struct hashfile_checkpoint *);
int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *);

/* finalize_hashfile flags */
#define CSUM_CLOSE		1
#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);
int finalize_hashfile(struct hashfile *, unsigned char *, 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 *);

/*
 * Returns the total number of bytes fed to the hashfile so far (including ones
 * that have not been written out to the descriptor yet).
 */
static inline off_t hashfile_total(struct hashfile *f)
{
	return f->total + f->offset;
}

static inline void hashwrite_u8(struct hashfile *f, uint8_t data)
{
	hashwrite(f, &data, sizeof(data));
}

static inline void hashwrite_be32(struct hashfile *f, uint32_t data)
{
	data = htonl(data);
	hashwrite(f, &data, sizeof(data));
}

static inline void hashwrite_be64(struct hashfile *f, uint64_t data)
{
	hashwrite_be32(f, data >> 32);
	hashwrite_be32(f, data & 0xffffffffUL);
}

#endif

debug log:

solving b026ec7766 ...
found b026ec7766 in https://public-inbox.org/git/c42d678714c16271fc02bc4e80c7c5a942930322.1596646576.git.me@ttaylorr.com/ ||
	https://public-inbox.org/git/d7cbd4ca1a5dd63fb1d19ef97fac9765daa5ae03.1599172908.git.me@ttaylorr.com/ ||
	https://public-inbox.org/git/4800cd373eefb8d71094254d90fd0304067e464f.1597178915.git.me@ttaylorr.com/
found f9cbd317fb in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 f9cbd317fbbce89547a405783fb5cc69e7815efa	csum-file.h

applying [1/1] https://public-inbox.org/git/c42d678714c16271fc02bc4e80c7c5a942930322.1596646576.git.me@ttaylorr.com/
diff --git a/csum-file.h b/csum-file.h
index f9cbd317fb..b026ec7766 100644

Checking patch csum-file.h...
Applied patch csum-file.h cleanly.

skipping https://public-inbox.org/git/d7cbd4ca1a5dd63fb1d19ef97fac9765daa5ae03.1599172908.git.me@ttaylorr.com/ for b026ec7766
skipping https://public-inbox.org/git/4800cd373eefb8d71094254d90fd0304067e464f.1597178915.git.me@ttaylorr.com/ for b026ec7766
index at:
100644 b026ec776675dee81aa275d8b79477b7dc8a8763	csum-file.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).