]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
0ef6f454 LP |
2 | #pragma once |
3 | ||
23fbe14f | 4 | /*** |
96b2fb93 | 5 | Copyright © 2012 Kay Sievers <kay@vrfy.org> |
23fbe14f | 6 | ***/ |
23fbe14f TG |
7 | |
8 | #include "sparse-endian.h" | |
3f6fd1ba | 9 | #include "util.h" |
23fbe14f TG |
10 | |
11 | #define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' } | |
12 | ||
13 | /* on-disk trie objects */ | |
14 | struct trie_header_f { | |
15 | uint8_t signature[8]; | |
16 | ||
17 | /* version of tool which created the file */ | |
18 | le64_t tool_version; | |
19 | le64_t file_size; | |
20 | ||
21 | /* size of structures to allow them to grow */ | |
22 | le64_t header_size; | |
23 | le64_t node_size; | |
24 | le64_t child_entry_size; | |
25 | le64_t value_entry_size; | |
26 | ||
27 | /* offset of the root trie node */ | |
28 | le64_t nodes_root_off; | |
29 | ||
30 | /* size of the nodes and string section */ | |
31 | le64_t nodes_len; | |
32 | le64_t strings_len; | |
33 | } _packed_; | |
34 | ||
35 | struct trie_node_f { | |
36 | /* prefix of lookup string, shared by all children */ | |
37 | le64_t prefix_off; | |
38 | /* size of children entry array appended to the node */ | |
39 | uint8_t children_count; | |
40 | uint8_t padding[7]; | |
41 | /* size of value entry array appended to the node */ | |
42 | le64_t values_count; | |
43 | } _packed_; | |
44 | ||
45 | /* array of child entries, follows directly the node record */ | |
46 | struct trie_child_entry_f { | |
47 | /* index of the child node */ | |
48 | uint8_t c; | |
49 | uint8_t padding[7]; | |
50 | /* offset of the child node */ | |
51 | le64_t child_off; | |
52 | } _packed_; | |
53 | ||
54 | /* array of value entries, follows directly the node record/child array */ | |
55 | struct trie_value_entry_f { | |
56 | le64_t key_off; | |
57 | le64_t value_off; | |
58 | } _packed_; | |
698c5a17 DH |
59 | |
60 | /* v2 extends v1 with filename and line-number */ | |
61 | struct trie_value_entry2_f { | |
62 | le64_t key_off; | |
63 | le64_t value_off; | |
64 | le64_t filename_off; | |
d8646d05 ZJS |
65 | le32_t line_number; |
66 | le16_t file_priority; | |
67 | le16_t padding; | |
698c5a17 | 68 | } _packed_; |