Blame


1 68823f7f 2018-01-19 stsp /*
2 68823f7f 2018-01-19 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 68823f7f 2018-01-19 stsp *
4 68823f7f 2018-01-19 stsp * Permission to use, copy, modify, and distribute this software for any
5 68823f7f 2018-01-19 stsp * purpose with or without fee is hereby granted, provided that the above
6 68823f7f 2018-01-19 stsp * copyright notice and this permission notice appear in all copies.
7 68823f7f 2018-01-19 stsp *
8 68823f7f 2018-01-19 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 68823f7f 2018-01-19 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 68823f7f 2018-01-19 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 68823f7f 2018-01-19 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 68823f7f 2018-01-19 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 68823f7f 2018-01-19 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 68823f7f 2018-01-19 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 68823f7f 2018-01-19 stsp */
16 68823f7f 2018-01-19 stsp
17 59ece79d 2018-02-12 stsp struct got_object_id {
18 59ece79d 2018-02-12 stsp u_int8_t sha1[SHA1_DIGEST_LENGTH];
19 59ece79d 2018-02-12 stsp };
20 59ece79d 2018-02-12 stsp
21 68823f7f 2018-01-19 stsp struct got_object {
22 68823f7f 2018-01-19 stsp int type;
23 68823f7f 2018-01-19 stsp int flags;
24 68823f7f 2018-01-19 stsp #define GOT_OBJ_FLAG_PACKED 0x01
25 96f5e8b3 2018-01-23 stsp #define GOT_OBJ_FLAG_DELTIFIED 0x02
26 68823f7f 2018-01-19 stsp
27 68823f7f 2018-01-19 stsp size_t hdrlen;
28 68823f7f 2018-01-19 stsp size_t size;
29 68823f7f 2018-01-19 stsp struct got_object_id id;
30 68823f7f 2018-01-19 stsp
31 68823f7f 2018-01-19 stsp char *path_packfile; /* if packed */
32 68823f7f 2018-01-19 stsp off_t pack_offset; /* if packed */
33 96f5e8b3 2018-01-23 stsp struct got_delta_chain deltas; /* if deltified */
34 68823f7f 2018-01-19 stsp };
35 f934cf2c 2018-02-12 stsp
36 f934cf2c 2018-02-12 stsp struct got_blob_object {
37 f934cf2c 2018-02-12 stsp FILE *f;
38 f934cf2c 2018-02-12 stsp struct got_zstream_buf zb;
39 f934cf2c 2018-02-12 stsp size_t hdrlen;
40 f934cf2c 2018-02-12 stsp size_t blocksize;
41 f934cf2c 2018-02-12 stsp uint8_t *read_buf;
42 f934cf2c 2018-02-12 stsp int flags;
43 f934cf2c 2018-02-12 stsp #define GOT_BLOB_F_COMPRESSED 0x01
44 f934cf2c 2018-02-12 stsp struct got_object_id id;
45 f934cf2c 2018-02-12 stsp };