1 #ifndef _RAZOR_INTERNAL_H_
2 #define _RAZOR_INTERNAL_H_
7 void *zalloc(size_t size);
14 void array_init(struct array *array);
15 void array_release(struct array *array);
16 void *array_add(struct array *array, int size);
20 uint32_t list_ptr : 24;
29 void list_set_empty(struct list_head *head);
30 void list_set_ptr(struct list_head *head, uint32_t ptr);
31 void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
33 struct list *list_first(struct list_head *head, struct array *pool);
34 struct list *list_next(struct list *list);
36 void list_remap_pool(struct array *pool, uint32_t *map);
37 void list_remap_head(struct list_head *list, uint32_t *map);
45 void hashtable_init(struct hashtable *table, struct array *pool);
46 void hashtable_release(struct hashtable *table);
47 uint32_t hashtable_insert(struct hashtable *table, const char *key);
48 uint32_t hashtable_lookup(struct hashtable *table, const char *key);
49 uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
52 struct razor_set_section {
58 struct razor_set_header {
61 struct razor_set_section sections[0];
64 #define RAZOR_MAGIC 0x7a7a7a7a
65 #define RAZOR_DETAILS_MAGIC 0x7a7a7a7b
66 #define RAZOR_FILES_MAGIC 0x7a7a7a7c
67 #define RAZOR_VERSION 1
69 #define RAZOR_STRING_POOL 0
70 #define RAZOR_PACKAGES 1
71 #define RAZOR_PROPERTIES 2
72 #define RAZOR_PACKAGE_POOL 3
73 #define RAZOR_PROPERTY_POOL 4
75 #define RAZOR_DETAILS_STRING_POOL 0
78 #define RAZOR_FILE_POOL 1
79 #define RAZOR_FILE_STRING_POOL 2
81 struct razor_package {
90 struct list_head properties;
91 struct list_head files;
95 struct razor_property {
99 struct list_head packages;
106 struct list_head packages;
109 #define RAZOR_ENTRY_LAST 0x80
112 struct array string_pool;
113 struct array packages;
114 struct array properties;
116 struct array package_pool;
117 struct array property_pool;
118 struct array file_pool;
119 struct array file_string_pool;
120 struct array details_string_pool;
121 struct razor_set_header *header;
122 struct razor_set_header *details_header;
123 struct razor_set_header *files_header;
126 struct import_entry {
131 struct import_directory {
132 uint32_t name, count;
134 struct array packages;
135 struct import_directory *last;
138 struct razor_importer {
139 struct razor_set *set;
140 struct hashtable table;
141 struct hashtable file_table;
142 struct hashtable details_table;
143 struct razor_package *package;
144 struct array properties;
146 struct array file_requires;
149 struct razor_package_iterator {
150 struct razor_set *set;
151 struct razor_package *package, *end;
157 razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
158 struct razor_set *set,
159 struct razor_property *property);
161 struct razor_property_iterator {
162 struct razor_set *set;
163 struct razor_property *property, *end;
167 #define ALIGN(value, base) (((value) + (base - 1)) & ~((base) - 1))
170 razor_set_find_entry(struct razor_set *set,
171 struct razor_entry *dir, const char *pattern);
173 struct razor_merger *
174 razor_merger_create(struct razor_set *set1, struct razor_set *set2);
176 razor_merger_add_package(struct razor_merger *merger,
177 struct razor_package *package);
179 razor_merger_finish(struct razor_merger *merger);
181 /* Utility functions */
183 int razor_create_dir(const char *root, const char *path);
184 int razor_write(int fd, const void *data, size_t size);
187 typedef int (*razor_compare_with_data_func_t)(const void *p1,
191 razor_qsort_with_data(void *base, size_t nelem, size_t size,
192 razor_compare_with_data_func_t compare, void *data);
194 #endif /* _RAZOR_INTERNAL_H_ */