summaryrefslogtreecommitdiff
path: root/src/apk_database.h
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-17 11:07:56 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-17 11:08:48 +0200
commita98b57b1ae6f9fb04ddcc6876451632d519a0081 (patch)
treeacafb1cf2dd44fbbab363fc714582da5b9e21c62 /src/apk_database.h
parent24b424a4580555579b11ab1d66ee3dab7751dfb5 (diff)
downloadapk-tools-a98b57b1ae6f9fb04ddcc6876451632d519a0081.tar.gz
apk-tools-a98b57b1ae6f9fb04ddcc6876451632d519a0081.tar.bz2
apk-tools-a98b57b1ae6f9fb04ddcc6876451632d519a0081.tar.xz
apk-tools-a98b57b1ae6f9fb04ddcc6876451632d519a0081.zip
db: database locking and creation to part of opening it
Add flags field to db open call. Also make error reporting quite a bit more detailed.
Diffstat (limited to 'src/apk_database.h')
-rw-r--r--src/apk_database.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 9710939..0306997 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -63,7 +63,7 @@ struct apk_repository {
struct apk_database {
char *root;
- int root_fd;
+ int root_fd, lock_fd;
unsigned pkg_id, num_repos;
struct apk_dependency_array *world;
@@ -100,8 +100,11 @@ struct apk_db_file *apk_db_file_query(struct apk_database *db,
apk_blob_t dir,
apk_blob_t name);
-int apk_db_create(const char *root);
-int apk_db_open(struct apk_database *db, const char *root);
+#define APK_OPENF_READ 0x0000
+#define APK_OPENF_WRITE 0x0001
+#define APK_OPENF_CREATE 0x0002
+
+int apk_db_open(struct apk_database *db, const char *root, unsigned int flags);
void apk_db_close(struct apk_database *db);
struct apk_package *apk_db_pkg_add_file(struct apk_database *db, const char *file);