2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
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.
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.
18 * Meta data about a tracked on-disk file.
20 * Note that some fields are truncated results from stat(2). These are only
21 * used in order to detect modifications made to on-disk files, they are
22 * never written back to the filesystem.
24 struct got_index_entry {
32 #define GOT_INDEX_ENTRY_MODE_OBJ_TYPE 0x0000000f
33 #define GOT_INDEX_ENTRY_MODE_PERMS 0x0000ff10
37 uint8_t obj_sha1[SHA1_DIGEST_LENGTH];
39 #define GOT_INDEX_ENTRY_F_NAME_LEN 0x0fff
40 #define GOT_INDEX_ENTRY_F_STAGE 0x3000
41 #define GOT_INDEX_ENTRY_F_EXTENDED 0x4000
42 #define GOT_INDEX_ENTRY_F_ASSUME_VALID 0x8000
44 /* This is a unix-style path relative to top level directory. */
52 struct got_index_entry *entries;
53 /* extensions go here */
54 uint8_t sha1[SHA1_DIGEST_LENGTH];