summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-04-09 11:16:37 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-04-09 11:16:37 +0300
commit72a36aed42ed1facc0ffaccb4f91d4ae30d7a33d (patch)
treec7f557bbb830e2c9e47abfe032453b962a01ff6f /lib
parent6a22fb6e3033468201ec405a482887581debea36 (diff)
downloadrpm-72a36aed42ed1facc0ffaccb4f91d4ae30d7a33d.tar.gz
rpm-72a36aed42ed1facc0ffaccb4f91d4ae30d7a33d.tar.bz2
rpm-72a36aed42ed1facc0ffaccb4f91d4ae30d7a33d.zip
Move dbi_use_dbenv from dbi to rpmdb, this is a per-rpmdb setting
Diffstat (limited to 'lib')
-rw-r--r--lib/backend/db3.c16
-rw-r--r--lib/backend/dbconfig.c1
-rw-r--r--lib/backend/dbi.h2
-rw-r--r--lib/rpmdb.c1
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 133c11e37..7d49708e4 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -371,7 +371,7 @@ int dbiClose(dbiIndex dbi, unsigned int flags)
}
- if (rpmdb->db_dbenv != NULL && dbi->dbi_use_dbenv) {
+ if (rpmdb->db_dbenv != NULL && rpmdb->db_use_env) {
if (rpmdb->db_opens == 1) {
xx = db_fini(dbi, (dbhome ? dbhome : ""));
rpmdb->db_dbenv = NULL;
@@ -478,7 +478,7 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
} else {
dbi->dbi_oeflags &= ~DB_CREATE;
/* ... but, unless DB_PRIVATE is used, skip DBENV. */
- dbi->dbi_use_dbenv = 0;
+ rpmdb->db_use_env = 0;
}
/* ... DB_RDONLY maps dbhome perms across files ... */
@@ -533,7 +533,7 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
if (oflags & DB_RDONLY)
dbi->dbi_verify_on_close = 0;
- if (dbi->dbi_use_dbenv) {
+ if (rpmdb->db_use_env) {
if (rpmdb->db_dbenv == NULL) {
rc = db_init(dbi, dbhome, &dbenv);
if (rc == 0) {
@@ -558,12 +558,12 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
rc = db_create(&db, dbenv, 0);
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (rc == 0 && db != NULL) {
- if (rc == 0 && !dbi->dbi_use_dbenv) {
+ if (rc == 0 && !rpmdb->db_use_env) {
rc = db->set_alloc(db, rmalloc, rrealloc, NULL);
rc = cvtdberr(dbi, "db->set_alloc", rc, _debug);
}
- if (rc == 0 && !dbi->dbi_use_dbenv && dbi->dbi_cachesize) {
+ if (rc == 0 && !rpmdb->db_use_env && dbi->dbi_cachesize) {
rc = db->set_cachesize(db, 0, dbi->dbi_cachesize, 0);
rc = cvtdberr(dbi, "db->set_cachesize", rc, _debug);
}
@@ -577,7 +577,7 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
const char *dbpath = dbi->dbi_file;
char *fullpath = NULL;
/* When not in environment, absolute path is needed */
- if (!dbi->dbi_use_dbenv) {
+ if (!rpmdb->db_use_env) {
fullpath = rpmGetPath(dbhome, "/", dbi->dbi_file, NULL);
dbpath = fullpath;
}
@@ -616,7 +616,7 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
* glibc/kernel combinations.
*/
if (rc == 0 && dbi->dbi_lockdbfd &&
- (!dbi->dbi_use_dbenv || _lockdbfd++ == 0))
+ (!rpmdb->db_use_env || _lockdbfd++ == 0))
{
int fdno = -1;
@@ -635,7 +635,7 @@ int dbiOpen(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
rc = fcntl(fdno, F_SETLK, (void *) &l);
if (rc) {
/* Warning iff using non-private CDB locking. */
- rc = ((dbi->dbi_use_dbenv &&
+ rc = ((rpmdb->db_use_env &&
(dbi->dbi_eflags & DB_INIT_CDB) &&
!(dbi->dbi_eflags & DB_PRIVATE))
? 0 : 1);
diff --git a/lib/backend/dbconfig.c b/lib/backend/dbconfig.c
index 7667e53e8..e7bafed84 100644
--- a/lib/backend/dbconfig.c
+++ b/lib/backend/dbconfig.c
@@ -241,7 +241,6 @@ dbiIndex dbiNew(rpmdb rpmdb, rpmTag rpmtag)
dbi->dbi_byteswapped = -1; /* -1 unknown, 0 native order, 1 alien order */
/* XXX FIXME: These all are environment, not per-dbi configuration */
- dbi->dbi_use_dbenv = 1;
dbi->dbi_eflags |= (DB_INIT_MPOOL);
/* Throw in some defaults if configuration didn't set any */
if (!dbi->dbi_mmapsize) dbi->dbi_mmapsize = 16 * 1024 * 1024;
diff --git a/lib/backend/dbi.h b/lib/backend/dbi.h
index 1695a3b2b..34bbd07e4 100644
--- a/lib/backend/dbi.h
+++ b/lib/backend/dbi.h
@@ -14,6 +14,7 @@ struct rpmdb_s {
int db_mode; /*!< open mode */
int db_perms; /*!< open permissions */
int db_api; /*!< Berkeley API type */
+ int db_use_env; /*!< use db environment? */
int db_remove_env;
int db_chrootDone; /*!< If chroot(2) done, ignore db_root. */
unsigned char * db_bits; /*!< package instance bit mask. */
@@ -50,7 +51,6 @@ struct _dbiIndex {
DBTYPE dbi_dbtype; /*!< db index type */
int dbi_verify_on_close;
- int dbi_use_dbenv; /*!< use db environment? */
int dbi_permit_dups; /*!< permit duplicate entries? */
int dbi_no_fsync; /*!< no-op fsync for db */
int dbi_no_dbsync; /*!< don't call dbiSync */
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index d299e9c9d..49da5b22a 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -685,6 +685,7 @@ static rpmdb newRpmdb(const char * root, const char * home,
}
db->db_root = rpmGetPath((root && *root) ? root : "/", NULL);
db->db_fullpath = rpmGenPath(db->db_root, db->db_home, NULL);
+ db->db_use_env = 1;
/* XXX remove environment after chrooted operations, for now... */
db->db_remove_env = (!rstreq(db->db_root, "/") ? 1 : 0);
db->_dbi = xcalloc(dbiTagsMax, sizeof(*db->_dbi));