From fb4b422fc4567238332050b9a6c8c1cac2a8f091 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 3 Jun 2011 15:24:01 -0500 Subject: New signatures for alpm initialize and release These new method signatures return and take handle objects to operate on so we can move away from the idea of one global handle in the API. There is also another important change and that deals with the setting of root and dbpaths. These are now done at initialization time instead of using setter methods. This allows the library to operate more safely knowing that paths won't change underneath it. Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index bc06cc09..ee55d0b9 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -85,14 +85,6 @@ typedef struct __pmdepmissing_t pmdepmissing_t; typedef struct __pmconflict_t pmconflict_t; typedef struct __pmfileconflict_t pmfileconflict_t; -/* - * Library - */ - -int alpm_initialize(void); -int alpm_release(void); -const char *alpm_version(void); - /* * Logging facilities */ @@ -165,15 +157,14 @@ alpm_cb_totaldl alpm_option_get_totaldlcb(void); /** Sets the callback used to report total download size. */ int alpm_option_set_totaldlcb(alpm_cb_totaldl cb); -/** Returns the root of the destination filesystem. */ +/** Returns the root of the destination filesystem. Read-only. */ const char *alpm_option_get_root(void); -/** Sets the root of the destination filesystem. */ -int alpm_option_set_root(const char *root); -/** Returns the path to the database directory. */ +/** Returns the path to the database directory. Read-only. */ const char *alpm_option_get_dbpath(void); -/** Sets the path to the database directory. */ -int alpm_option_set_dbpath(const char *dbpath); + +/** Get the name of the database lock file. Read-only. */ +const char *alpm_option_get_lockfile(void); /** @name Accessors to the list of package cache directories. * @{ @@ -189,15 +180,6 @@ const char *alpm_option_get_logfile(void); /** Sets the logfile name. */ int alpm_option_set_logfile(const char *logfile); -/** Get the name of the database lock file. - * - * This properly is read-only, and determined from - * the database path. - * - * @sa alpm_option_set_dbpath(const char*) - */ -const char *alpm_option_get_lockfile(void); - /** Returns the signature directory path. */ const char *alpm_option_get_signaturedir(void); /** Sets the signature directory path. */ @@ -302,9 +284,10 @@ pmdb_t *alpm_db_register_sync(const char *treename); int alpm_db_unregister(pmdb_t *db); /** Unregister all package databases. + * @param handle the context handle * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_db_unregister_all(void); +int alpm_db_unregister_all(pmhandle_t *handle); /** Get the name of a package database. * @param db pointer to the package database @@ -1054,6 +1037,11 @@ const char *alpm_strerrorlast(void); /* End of alpm_api_errors */ /** @} */ +pmhandle_t *alpm_initialize(const char *root, const char *dbpath, + enum _pmerrno_t *err); +int alpm_release(pmhandle_t *handle); +const char *alpm_version(void); + /* End of alpm_api */ /** @} */ -- cgit v1.2.3-70-g09d2