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