diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-06-20 18:26:46 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-06-20 18:26:46 -0400 |
commit | 18edc4ab189b56e1d56db201f6cc73d4b5f58222 (patch) | |
tree | ccf00bf9905484a6b0eebc4f15f1e5be1af71d1a /librazor | |
parent | 1e9df0cb2d4c377b14732441a8ced0d304903722 (diff) |
Add getter to return system set for a razor_root.
Diffstat (limited to 'librazor')
-rw-r--r-- | librazor/razor.h | 19 | ||||
-rw-r--r-- | librazor/root.c | 37 |
2 files changed, 22 insertions, 34 deletions
diff --git a/librazor/razor.h b/librazor/razor.h index b9ecb0e..8e69f1d 100644 --- a/librazor/razor.h +++ b/librazor/razor.h @@ -176,22 +176,17 @@ int razor_rpm_install(struct razor_rpm *rpm, const char *root); int razor_rpm_close(struct razor_rpm *rpm); -/* Razor root functions. The root data struct encapsulates filesystem - * conventions and the locking protocol. */ +/* Razor root functions. The root data structure encapsulates + * filesystem conventions and the locking protocol. */ struct razor_root; -#define RAZOR_ROOT_OPEN_WRITE 0x01 int razor_root_create(const char *root); -struct razor_root *razor_root_open(const char *root, int flags); +struct razor_root *razor_root_open(const char *root); struct razor_set *razor_root_open_read_only(const char *root); -struct razor_transaction * -razor_root_create_transaction(struct razor_root *image, - struct razor_set *upstream); -int razor_root_close(struct razor_root *image); -void razor_root_update(struct razor_root *image, struct razor_set *next); -int razor_root_commit(struct razor_root *image); -void razor_root_diff(struct razor_root *root, - razor_package_callback_t callback, void *data); +struct razor_set *razor_root_get_system_set(struct razor_root *root); +int razor_root_close(struct razor_root *root); +void razor_root_update(struct razor_root *root, struct razor_set *next); +int razor_root_commit(struct razor_root *root); #endif /* _RAZOR_H_ */ diff --git a/librazor/root.c b/librazor/root.c index 8c032ef..9e0ae26 100644 --- a/librazor/root.c +++ b/librazor/root.c @@ -68,7 +68,7 @@ razor_root_create(const char *root) } struct razor_root * -razor_root_open(const char *root, int flags) +razor_root_open(const char *root) { struct razor_root *image; @@ -118,20 +118,19 @@ razor_root_open_read_only(const char *root) return razor_set_open(path); } -struct razor_transaction * -razor_root_create_transaction(struct razor_root *image, - struct razor_set *upstream) +struct razor_set * +razor_root_get_system_set(struct razor_root *root) { - /* FIXME: This should take a number of upstream repos. */ - return razor_transaction_create(image->system, upstream); + return root->system; } int -razor_root_close(struct razor_root *image) +razor_root_close(struct razor_root *root) { - unlink(image->new_path); - close(image->fd); - free(image); + razor_set_destroy(root->system); + unlink(root->new_path); + close(root->fd); + free(root); return 0; } @@ -149,20 +148,14 @@ razor_root_update(struct razor_root *root, struct razor_set *next) } int -razor_root_commit(struct razor_root *image) +razor_root_commit(struct razor_root *root) { /* Make it so. */ - rename(image->new_path, image->path); - printf("renamed %s to %s\n", image->new_path, image->path); - close(image->fd); - free(image); + rename(root->new_path, root->path); + printf("renamed %s to %s\n", root->new_path, root->path); + razor_set_destroy(root->system); + close(root->fd); + free(root); return 0; } - -void -razor_root_diff(struct razor_root *root, - razor_package_callback_t callback, void *data) -{ - return razor_set_diff(root->system, root->next, callback, data); -} |