Blob


1 /*
2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 /*
18 * Meta data about a tracked on-disk file.
19 *
20 * Note that some fields are results from stat(2). These are only used in
21 * order to detect modifications made to on-disk files, they are never
22 * applied back to the filesystem.
23 */
24 struct got_index_entry {
25 struct timespec ctime;
26 struct timespec mtime;
27 uint32_t mode;
28 #define GOT_INDEX_ENTRY_MODE_OBJ_TYPE 0x0000000f
29 #define GOT_INDEX_ENTRY_MODE_PERMS 0x0000ff10
30 uint32_t uid;
31 uint32_t gid;
32 uint32_t size;
34 uint8_t obj_sha1[SHA1_DIGEST_LENGTH];
35 uint32_t flags;
36 #define GOT_INDEX_ENTRY_F_NAME_LEN 0x00000fff
37 #define GOT_INDEX_ENTRY_F_STAGE 0x00003000
38 #define GOT_INDEX_ENTRY_F_EXTENDED 0x00004000
39 #define GOT_INDEX_ENTRY_F_ASSUME_VALID 0x00008000
41 /* This is a unix-style path relative to top level directory. */
42 const char *path;
43 };
45 struct got_index {
46 uint32_t signature;
47 uint32_t version;
48 uint32_t nentries;
49 struct got_index_entry *entries;
50 /* extensions go here */
51 uint8_t sha1[SHA1_DIGEST_LENGTH];
52 };