razor.h
author Kristian H?gsberg <krh@redhat.com>
Wed Sep 19 14:34:11 2007 -0400 (2007-09-19)
changeset 29 28a13008d80b
parent 27 5dbd81809d26
child 30 702c01e59497
permissions -rw-r--r--
Fix swapping of map entries in __qsort_with_data.
krh@27
     1
#ifndef _RAZOR_H_
krh@27
     2
#define _RAZOR_H_
krh@27
     3
krh@27
     4
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
krh@27
     5
krh@27
     6
struct array {
krh@27
     7
	void *data;
krh@27
     8
	int size, alloc;
krh@27
     9
};
krh@27
    10
krh@27
    11
struct razor_set_section {
krh@27
    12
	unsigned int type;
krh@27
    13
	unsigned int offset;
krh@27
    14
	unsigned int size;
krh@27
    15
};
krh@27
    16
krh@27
    17
struct razor_set_header {
krh@27
    18
	unsigned int magic;
krh@27
    19
	unsigned int version;
krh@27
    20
	struct razor_set_section sections[0];
krh@27
    21
};
krh@27
    22
krh@27
    23
#define RAZOR_MAGIC 0x7a7a7a7a
krh@27
    24
#define RAZOR_VERSION 1
krh@27
    25
krh@27
    26
#define RAZOR_PACKAGES 0
krh@27
    27
#define RAZOR_REQUIRES 1
krh@27
    28
#define RAZOR_PROVIDES 2
krh@27
    29
#define RAZOR_STRING_POOL 3
krh@27
    30
#define RAZOR_PROPERTY_POOL 4
krh@27
    31
krh@27
    32
struct razor_package {
krh@27
    33
	unsigned long name;
krh@27
    34
	unsigned long version;
krh@27
    35
	unsigned long requires;
krh@27
    36
	unsigned long provides;
krh@27
    37
};
krh@27
    38
krh@27
    39
struct razor_property {
krh@27
    40
	unsigned long name;
krh@27
    41
	unsigned long version;
krh@27
    42
	unsigned long packages;
krh@27
    43
};
krh@27
    44
krh@27
    45
struct razor_set {
krh@27
    46
	struct array buckets;
krh@27
    47
	struct array string_pool;
krh@27
    48
	struct array property_pool;
krh@27
    49
 	struct array packages;
krh@27
    50
 	struct array requires;
krh@27
    51
 	struct array provides;
krh@27
    52
	struct razor_set_header *header;
krh@27
    53
};
krh@27
    54
krh@27
    55
struct import_property_context {
krh@27
    56
	struct array *all;
krh@27
    57
	struct array package;
krh@27
    58
};
krh@27
    59
krh@27
    60
struct import_context {
krh@27
    61
	struct razor_set *set;
krh@27
    62
	struct import_property_context requires;
krh@27
    63
	struct import_property_context provides;
krh@27
    64
	struct razor_package *package;
krh@27
    65
	unsigned long *requires_map;
krh@27
    66
	unsigned long *provides_map;
krh@27
    67
};
krh@27
    68
krh@27
    69
void import_context_add_package(struct import_context *ctx,
krh@27
    70
				const char *name, const char *version);
krh@27
    71
void import_context_add_property(struct import_context *ctx,
krh@27
    72
				 struct import_property_context *pctx,
krh@27
    73
				 const char *name, const char *version);
krh@27
    74
void import_context_finish_package(struct import_context *ctx);
krh@27
    75
krh@27
    76
unsigned long razor_set_tokenize(struct razor_set *set, const char *string);
krh@27
    77
void razor_prepare_import(struct import_context *ctx);
krh@27
    78
struct razor_set *razor_finish_import(struct import_context *ctx);
krh@27
    79
krh@27
    80
struct razor_set *razor_import_rzr_files(int count, const char **files);
krh@27
    81
struct razor_set *razor_set_create_from_yum_filelist(int fd);
krh@28
    82
struct razor_set *razor_set_create_from_rpmdb(void);
krh@27
    83
krh@27
    84
#endif /* _RAZOR_H_ */