Permalink
Browse files

Use strings to identify section types in the on-disk repo format.

Previously, a given razor file type had a fixed number of sections in a
fixed order, identified by an integer type. Now, sections are identified
by a named string (stored in a string pool after the section lists).

This will allow for razor files to contain arbitrary sections.

For bonus points, also drop the 4k section alignment and change the
magic byte string to "RZDB".
  • Loading branch information...
1 parent 4804724 commit bad9d8fd033c8f2bf5c08436a16442783a3d8549 James Bowes committed with Kristian Høgsberg Jul 9, 2008
Showing with 116 additions and 140 deletions.
  1. +1 −8 TODO
  2. +19 −15 librazor/razor-internal.h
  3. +96 −117 librazor/razor.c
View
9 TODO
@@ -118,14 +118,7 @@ Towards replacing rpm + yum (0.1):
Package set file format items:
-- drop the 4k section alignment
-
-- just use strings for header identifiers, make the string pool
- section have a fixed string (maybe make "strings" always the first
- string so its index is 0), or maybe just require that it's the first
- section in the file.
-
-- nail down byte-order of rzdb file.
+- nail down byte-order of repo file.
- version the sections in the file, put the element size in the header
so we can add stuff to elements in a backwards compatible way.
View
@@ -82,33 +82,31 @@ uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
struct razor_set_section {
- uint32_t type;
+ uint32_t name;
uint32_t offset;
uint32_t size;
};
struct razor_set_header {
uint32_t magic;
uint32_t version;
- struct razor_set_section sections[0];
+ uint32_t num_sections;
};
-#define RAZOR_MAGIC 0x7a7a7a7a
-#define RAZOR_DETAILS_MAGIC 0x7a7a7a7b
-#define RAZOR_FILES_MAGIC 0x7a7a7a7c
-#define RAZOR_VERSION 1
+#define RAZOR_MAGIC 0x525a4442
+#define RAZOR_VERSION 1
-#define RAZOR_STRING_POOL 0
-#define RAZOR_PACKAGES 1
-#define RAZOR_PROPERTIES 2
-#define RAZOR_PACKAGE_POOL 3
-#define RAZOR_PROPERTY_POOL 4
+#define RAZOR_STRING_POOL "string_pool"
+#define RAZOR_PACKAGES "packages"
+#define RAZOR_PROPERTIES "properties"
+#define RAZOR_PACKAGE_POOL "package_pool"
+#define RAZOR_PROPERTY_POOL "property_pool"
-#define RAZOR_DETAILS_STRING_POOL 0
+#define RAZOR_DETAILS_STRING_POOL "details_string_pool"
-#define RAZOR_FILES 0
-#define RAZOR_FILE_POOL 1
-#define RAZOR_FILE_STRING_POOL 2
+#define RAZOR_FILES "files"
+#define RAZOR_FILE_POOL "file_pool"
+#define RAZOR_FILE_STRING_POOL "file_string_pool"
struct razor_package {
uint name : 24;
@@ -150,9 +148,15 @@ struct razor_set {
struct array file_pool;
struct array file_string_pool;
struct array details_string_pool;
+
struct razor_set_header *header;
+ size_t header_size;
+
struct razor_set_header *details_header;
+ size_t details_header_size;
+
struct razor_set_header *files_header;
+ size_t files_header_size;
};
struct import_entry {
Oops, something went wrong.

0 comments on commit bad9d8f

Please sign in to comment.