[SR-Dev] git:janakj/bdb: Integrate module interfaces.

Jan Janak jan at iptel.org
Thu Feb 19 15:06:00 CET 2009


Module: sip-router
Branch: janakj/bdb
Commit: 7f4d7327118d2bd5850bf0d9a9015f8eed322cd4
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7f4d7327118d2bd5850bf0d9a9015f8eed322cd4

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Thu Feb 19 15:03:30 2009 +0100

Integrate module interfaces.

List of changes:
 * Export db_bind_api through the module interface
 * Rename mod_init to km_mod_init
 * Rename destroy to km_destroy
 * Make the two functions non-static
 * Call km_mod_init from bdb_mod_init
 * Call km_destroy from bdb_mod_destroy

---

 modules/db_berkeley/bdb_mod.c        |    5 ++++-
 modules/db_berkeley/km_db_berkeley.c |   12 ++++--------
 modules/db_berkeley/km_db_berkeley.h |    6 ++++++
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/modules/db_berkeley/bdb_mod.c b/modules/db_berkeley/bdb_mod.c
index 7da25b3..268527e 100644
--- a/modules/db_berkeley/bdb_mod.c
+++ b/modules/db_berkeley/bdb_mod.c
@@ -46,6 +46,7 @@
 #include "bdb_fld.h"
 #include "bdb_res.h"
 #include "bdb_cmd.h"
+#include "km_db_berkeley.h"
 
 MODULE_VERSION
 
@@ -73,6 +74,7 @@ static cmd_export_t cmds[] = {
 	{"db_next",   (cmd_function)bdb_cmd_next,  0, 0, 0},
 	{"db_res",    (cmd_function)bdb_res,       0, 0, 0},
 	{"db_fld",    (cmd_function)bdb_fld,       0, 0, 0},
+	{"db_bind_api", (cmd_function)bdb_bind_api, 0, 0, 0},
 	{0, 0, 0, 0, 0}
 };
 
@@ -111,11 +113,12 @@ static int bdb_mod_init(void)
 	if(bdblib_init(&p))
 		return -1;
 
-	return 0;
+	return km_mod_init();
 }
 
 static void bdb_mod_destroy(void)
 {
+	km_destroy();
 	bdblib_destroy();
 }
 
diff --git a/modules/db_berkeley/km_db_berkeley.c b/modules/db_berkeley/km_db_berkeley.c
index dbd2f17..dba09bd 100644
--- a/modules/db_berkeley/km_db_berkeley.c
+++ b/modules/db_berkeley/km_db_berkeley.c
@@ -58,9 +58,6 @@
 
 /*MODULE_VERSION*/
 
-static int mod_init(void);
-static void destroy(void);
-
 int bdb_bind_api(db_func_t *dbb);
 
 /*
@@ -99,14 +96,13 @@ struct kam_module_exports kam_exports = {
 	mi_cmds,  /* exported MI functions */
 	0,        /* exported pseudo-variables */
 	0,        /* extra processes */
-	mod_init, /* module initialization function */
+	km_mod_init, /* module initialization function */
 	0,        /* response function*/
-	destroy,  /* destroy function */
+	km_destroy,  /* destroy function */
 	0         /* per-child init function */
 };
 
-
-static int mod_init(void)
+int km_mod_init(void)
 {
 	db_parms_t p;
 	
@@ -121,7 +117,7 @@ static int mod_init(void)
 	return 0;
 }
 
-static void destroy(void)
+void km_destroy(void)
 {
 	km_bdblib_destroy();
 }
diff --git a/modules/db_berkeley/km_db_berkeley.h b/modules/db_berkeley/km_db_berkeley.h
index aaa800c..7376671 100644
--- a/modules/db_berkeley/km_db_berkeley.h
+++ b/modules/db_berkeley/km_db_berkeley.h
@@ -36,6 +36,7 @@
 #include "../../lib/srdb1/db_key.h"
 #include "../../lib/srdb1/db_op.h"
 #include "../../lib/srdb1/db_val.h"
+#include "../../lib/srdb1/db.h"
 
 /* reloads the berkeley db */
 int bdb_reload(char* _n);
@@ -92,5 +93,10 @@ int _bdb_delete_cursor(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
 int bdb_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v,
 	      db_key_t* _uk, db_val_t* _uv, int _n, int _un);
 
+int bdb_bind_api(db_func_t *dbb);
+
+int km_mod_init(void);
+void km_destroy(void);
+
 #endif
 




More information about the sr-dev mailing list