From bc00f99cb0c6bc367bd198b3b0fdc7cd445737c5 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 21 Oct 2019 13:37:22 +0300
Subject: [PATCH] Add backend name and path of main database file to db_ops
 struct

URL:https://github.com/rpm-software-management/rpm/commit/bc00f99cb0c6bc367bd198b3b0fdc7cd445737c5
Conflict:delete the contents of lib/backend/sqlite.c, because we have no sqlite database.
---
 lib/backend/db3.c      | 3 +++
 lib/backend/dbi.h      | 5 ++++-
 lib/backend/dummydb.c  | 3 +++
 lib/backend/lmdb.c     | 3 +++
 lib/backend/ndb/glue.c | 3 +++
 5 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index ff1fc26..ab2f11f 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -1365,6 +1365,9 @@ static unsigned int db3_pkgdbKey(dbiIndex dbi, dbiCursor dbc)
 }
 
 struct rpmdbOps_s db3_dbops = {
+    .name   = "bdb",
+    .path   = "Packages",
+
     .open   = db3_dbiOpen,
     .close  = db3_dbiClose,
     .verify = db3_dbiVerify,
diff --git a/lib/backend/dbi.h b/lib/backend/dbi.h
index e9e42d8..a618ea2 100644
--- a/lib/backend/dbi.h
+++ b/lib/backend/dbi.h
@@ -59,7 +59,7 @@ struct rpmdb_s {
     dbiIndex 	* db_indexes;	/*!< Tag indices. */
     int		db_buildindex;	/*!< Index rebuild indicator */
 
-    struct rpmdbOps_s * db_ops;	/*!< backend ops */
+    const struct rpmdbOps_s * db_ops;	/*!< backend ops */
 
     /* dbenv and related parameters */
     void * db_dbenv;		/*!< Backend private handle */
@@ -245,6 +245,9 @@ RPM_GNUC_INTERNAL
 const void * idxdbKey(dbiIndex dbi, dbiCursor dbc, unsigned int *keylen);
 
 struct rpmdbOps_s {
+    const char *name; /* backend name */
+    const char *path; /* main database name */
+
     int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags);
     int (*close)(dbiIndex dbi, unsigned int flags);
     int (*verify)(dbiIndex dbi, unsigned int flags);
diff --git a/lib/backend/dummydb.c b/lib/backend/dummydb.c
index 6137675..631b635 100644
--- a/lib/backend/dummydb.c
+++ b/lib/backend/dummydb.c
@@ -88,6 +88,9 @@ static const void * dummydb_idxdbKey(dbiIndex dbi, dbiCursor dbc, unsigned int *
 
 
 struct rpmdbOps_s dummydb_dbops = {
+    .name	= "dummy",
+    .path	= NULL,
+
     .open	= dummydb_Open,
     .close	= dummydb_Close,
     .verify	= dummydb_Verify,
diff --git a/lib/backend/lmdb.c b/lib/backend/lmdb.c
index f63fcb7..801f50e 100644
--- a/lib/backend/lmdb.c
+++ b/lib/backend/lmdb.c
@@ -922,6 +922,9 @@ static unsigned int lmdb_pkgdbKey(dbiIndex dbi, dbiCursor dbc)
 }
 
 struct rpmdbOps_s lmdb_dbops = {
+    .name   = "lmdb",
+    .path   = "data.mdb",
+
     .open   = lmdb_dbiOpen,
     .close  = lmdb_dbiClose,
     .verify = lmdb_dbiVerify,
diff --git a/lib/backend/ndb/glue.c b/lib/backend/ndb/glue.c
index b088a0b..d679ed1 100644
--- a/lib/backend/ndb/glue.c
+++ b/lib/backend/ndb/glue.c
@@ -496,6 +496,9 @@ static const void * ndb_idxdbKey(dbiIndex dbi, dbiCursor dbc, unsigned int *keyl
 
 
 struct rpmdbOps_s ndb_dbops = {
+    .name	= "ndb",
+    .path	= "Packages.db",
+
     .open	= ndb_Open,
     .close	= ndb_Close,
     .verify	= ndb_Verify,
-- 
1.8.3.1

