]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-hwdb/hwdb-internal.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / libsystemd / sd-hwdb / hwdb-internal.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
0ef6f454
LP
2#pragma once
3
23fbe14f
TG
4/***
5 This file is part of systemd.
6
7 Copyright 2012 Kay Sievers <kay@vrfy.org>
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
23fbe14f
TG
22
23#include "sparse-endian.h"
3f6fd1ba 24#include "util.h"
23fbe14f
TG
25
26#define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' }
27
28/* on-disk trie objects */
29struct trie_header_f {
30 uint8_t signature[8];
31
32 /* version of tool which created the file */
33 le64_t tool_version;
34 le64_t file_size;
35
36 /* size of structures to allow them to grow */
37 le64_t header_size;
38 le64_t node_size;
39 le64_t child_entry_size;
40 le64_t value_entry_size;
41
42 /* offset of the root trie node */
43 le64_t nodes_root_off;
44
45 /* size of the nodes and string section */
46 le64_t nodes_len;
47 le64_t strings_len;
48} _packed_;
49
50struct trie_node_f {
51 /* prefix of lookup string, shared by all children */
52 le64_t prefix_off;
53 /* size of children entry array appended to the node */
54 uint8_t children_count;
55 uint8_t padding[7];
56 /* size of value entry array appended to the node */
57 le64_t values_count;
58} _packed_;
59
60/* array of child entries, follows directly the node record */
61struct trie_child_entry_f {
62 /* index of the child node */
63 uint8_t c;
64 uint8_t padding[7];
65 /* offset of the child node */
66 le64_t child_off;
67} _packed_;
68
69/* array of value entries, follows directly the node record/child array */
70struct trie_value_entry_f {
71 le64_t key_off;
72 le64_t value_off;
73} _packed_;
698c5a17
DH
74
75/* v2 extends v1 with filename and line-number */
76struct trie_value_entry2_f {
77 le64_t key_off;
78 le64_t value_off;
79 le64_t filename_off;
d8646d05
ZJS
80 le32_t line_number;
81 le16_t file_priority;
82 le16_t padding;
698c5a17 83} _packed_;