Go back to having all info in one rzdb file.
We can still split the rzdb file into a main file and a file data and a details file, but that's only for optimizing the required download size. On the system we always combine the parts back into one rzdb file once downloaded.
committer: J. Ali Harlow <ali@juiblex.co.uk>
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
4 <chapter id="file-format">
5 <title>Package Set File Format</title>
7 <sect2 id="file-header">
8 <title>File header</title>
11 The rzdb file starts with a header, containing some number of
12 sections, terminated by a section with type 0:
15 <programlisting><![CDATA[
16 struct razor_set_header {
19 struct razor_set_section sections[0];
22 struct razor_set_section {
30 razor_set_open() mmaps the rzdb file, and creates a struct razor_set:
33 <programlisting><![CDATA[
35 struct array string_pool;
36 struct array packages;
37 struct array properties;
39 struct array package_pool;
40 struct array property_pool;
41 struct array file_pool;
42 struct razor_set_header *header;
47 by finding the sections with those IDs and creating struct
48 array's pointing to the right places in the mmapped data. (This
49 is the only processing needed when reading in the file;
50 everything else is used exactly as-is.)
56 <title>The sections</title>
61 <emphasis>RAZOR_STRING_POOL</emphasis> Stores one copy of
62 each string that appears in the rzdb file. (At the moment,
63 this is: package names, package versions, property names,
64 property versions, and (basenames of) filenames.) The
65 strings are arbitrarily-sized, 0-terminated, and not in any
66 particular order (although the empty string always ends up
73 <emphasis>RAZOR_PACKAGES</emphasis> Array of struct
74 razor_package; one for each package in the set, sorted by
81 <emphasis>RAZOR_PROPERTIES</emphasis> Array of struct
82 razor_property; one for each unique property in the set,
83 sorted by type, then name, then relation type (eg, "<" or
84 ">="), then version. (Properties with no version have
85 relation type RAZOR_VERSION_EQUAL, and version "".)
91 <emphasis>RAZOR_FILES</emphasis> Array of struct
92 razor_entry; one for each file owned by any package in the
93 set. The current sort order (which is subject to change)
94 is breadth-first, sorted by basename. So eg: /, /bin,
95 /dev, /etc, /bin/false, /bin/true, /dev/null, /etc/passwd.
101 <emphasis>RAZOR_PACKAGE_POOL</emphasis> Array of struct
102 list, with each list item containing the index of a struct
103 razor_package in the packages section. See the discussion
110 <emphasis>RAZOR_PROPERTY_POOL</emphasis> Array of struct
111 list, with each list item containing the index of a struct
112 razor_property in the properties section. See the
113 discussion of lists below.
119 <emphasis>RAZOR_FILE_POOL</emphasis> Array of struct list,
120 with each list item containing the index of a struct
121 razor_entry in the files section. See the discussion of
128 <sect2 id="data-types">
129 <title>Data types</title>
132 Note that the exact layout of bits involves some historical
133 accidents. (Particularly the fact that the "name" field in most
134 structs loses its high bits to a flags field.)
137 <programlisting><![CDATA[
148 Used to store lists of package, property, or file IDs. "struct
149 list_head" stores the head of the list, which points to one or
150 more "struct list"s in the appropriate "pool" section. ("struct
151 list" should probably be called "struct list_item".)
155 "list_first(&head, &pool)" returns a "struct list *"
156 pointing to the first element of the list (or NULL for an empty
157 list), and "list_next(list)" will return successive elements,
158 until NULL is returned. Each "list->data" contains the index of
159 a package, property, or file in the corresponding section of the
164 Peeking underneath the abstraction, a list_head's "flags" is
165 0xff if the list is empty, 0x80 if it contains a single element,
166 or 0x00 if it contains more than one element. In the
167 single-element case, that element is actually stored in the
168 list_head directly rather than being stored in a pool (and so
169 list_first() just casts the list_head* to a list* and returns
170 it). For multi-element lists, list_ptr is the index in the pool
171 of the first element of this list; the list continues through
172 successive elements of the pool until one with non-zero flags is
173 reached, indicating the end of the list.
176 <programlisting><![CDATA[
181 struct list_head properties;
182 struct list_head files;
186 name and version are indexes into string_pool. properties is a
187 list of all of the package's properties, and files is a list of
188 its files. flags is currently only used during razor_set
189 merging, to keep track of which set a package came from.
192 <programlisting><![CDATA[
193 struct razor_property
199 struct list_head packages;
203 name and version are indexes into string_pool. type is an enum
204 razor_property_type (eg, RAZOR_PROPERTY_REQUIRES), and relation
205 is an enum razor_version_relation (eg,
206 RAZOR_VERSION_GREATER_OR_EQUAL). packages is a list of the
207 packages that have this property. flags is currently unused.
210 <programlisting><![CDATA[
215 struct list_head packages;
219 name is an index into string_pool, giving the basename of the
220 file. start is either 0, or an index pointing to another
221 razor_entry that is the first child of this entry (for a
222 non-empty directory). (Entry 0 is always the root of the tree,
223 so no entry could have entry 0 as a child.) flags is 0x80
224 (RAZOR_ENTRY_LAST) if an entry is the last entry in its
225 directory. Otherwise it is 0.
229 Note that given a pointer to a struct_razor_entry (eg, from a
230 package's "files" list), there is no way to reconstruct its full
231 name without walking the entire files array up to that
232 point. Because of this and other problems (fix_file_map()), it
233 seems like razor_entry should be modified to include a pointer
234 to its parent. (Storing full paths instead of just basenames
235 would also fix this problem, but that would use much more