2 69aa0e90 2021-03-10 stsp * Copyright (c) 2020 Ori Bernstein
3 69aa0e90 2021-03-10 stsp * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
5 69aa0e90 2021-03-10 stsp * Permission to use, copy, modify, and distribute this software for any
6 69aa0e90 2021-03-10 stsp * purpose with or without fee is hereby granted, provided that the above
7 69aa0e90 2021-03-10 stsp * copyright notice and this permission notice appear in all copies.
9 69aa0e90 2021-03-10 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 69aa0e90 2021-03-10 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 69aa0e90 2021-03-10 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 69aa0e90 2021-03-10 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 69aa0e90 2021-03-10 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 69aa0e90 2021-03-10 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 69aa0e90 2021-03-10 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 69aa0e90 2021-03-10 stsp struct got_delta_block {
20 69aa0e90 2021-03-10 stsp off_t offset;
21 69aa0e90 2021-03-10 stsp uint64_t hash;
24 69aa0e90 2021-03-10 stsp struct got_delta_table {
25 69aa0e90 2021-03-10 stsp struct got_delta_block *blocks;
26 69aa0e90 2021-03-10 stsp int nblocks;
30 69aa0e90 2021-03-10 stsp struct got_delta_instruction {
32 69aa0e90 2021-03-10 stsp off_t offset;
37 69aa0e90 2021-03-10 stsp GOT_DELTIFY_MINCHUNK = 128,
38 69aa0e90 2021-03-10 stsp GOT_DELTIFY_MAXCHUNK = 8192,
39 69aa0e90 2021-03-10 stsp GOT_DELTIFY_SPLITMASK = (1 << 8) - 1,
43 69aa0e90 2021-03-10 stsp const struct got_error *got_deltify_init(struct got_delta_table **dt, FILE *f,
44 69aa0e90 2021-03-10 stsp off_t fileoffset, off_t filesize);
45 69aa0e90 2021-03-10 stsp const struct got_error *got_deltify(struct got_delta_instruction **deltas,
46 69aa0e90 2021-03-10 stsp int *ndeltas, FILE *f, off_t fileoffset, off_t filesize,
47 f34b169e 2021-06-18 stsp struct got_delta_table *dt, FILE *basefile, off_t basefile_offset0,
48 f34b169e 2021-06-18 stsp off_t basefile_size);
49 69aa0e90 2021-03-10 stsp void got_deltify_free(struct got_delta_table *dt);