Parcourir la source

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
Jan Janak il y a 16 ans
Parent
commit
7f4d732711

+ 4 - 1
modules/db_berkeley/bdb_mod.c

@@ -46,6 +46,7 @@
 #include "bdb_fld.h"
 #include "bdb_fld.h"
 #include "bdb_res.h"
 #include "bdb_res.h"
 #include "bdb_cmd.h"
 #include "bdb_cmd.h"
+#include "km_db_berkeley.h"
 
 
 MODULE_VERSION
 MODULE_VERSION
 
 
@@ -73,6 +74,7 @@ static cmd_export_t cmds[] = {
 	{"db_next",   (cmd_function)bdb_cmd_next,  0, 0, 0},
 	{"db_next",   (cmd_function)bdb_cmd_next,  0, 0, 0},
 	{"db_res",    (cmd_function)bdb_res,       0, 0, 0},
 	{"db_res",    (cmd_function)bdb_res,       0, 0, 0},
 	{"db_fld",    (cmd_function)bdb_fld,       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}
 	{0, 0, 0, 0, 0}
 };
 };
 
 
@@ -111,11 +113,12 @@ static int bdb_mod_init(void)
 	if(bdblib_init(&p))
 	if(bdblib_init(&p))
 		return -1;
 		return -1;
 
 
-	return 0;
+	return km_mod_init();
 }
 }
 
 
 static void bdb_mod_destroy(void)
 static void bdb_mod_destroy(void)
 {
 {
+	km_destroy();
 	bdblib_destroy();
 	bdblib_destroy();
 }
 }
 
 

+ 4 - 8
modules/db_berkeley/km_db_berkeley.c

@@ -58,9 +58,6 @@
 
 
 /*MODULE_VERSION*/
 /*MODULE_VERSION*/
 
 
-static int mod_init(void);
-static void destroy(void);
-
 int bdb_bind_api(db_func_t *dbb);
 int bdb_bind_api(db_func_t *dbb);
 
 
 /*
 /*
@@ -99,14 +96,13 @@ struct kam_module_exports kam_exports = {
 	mi_cmds,  /* exported MI functions */
 	mi_cmds,  /* exported MI functions */
 	0,        /* exported pseudo-variables */
 	0,        /* exported pseudo-variables */
 	0,        /* extra processes */
 	0,        /* extra processes */
-	mod_init, /* module initialization function */
+	km_mod_init, /* module initialization function */
 	0,        /* response function*/
 	0,        /* response function*/
-	destroy,  /* destroy function */
+	km_destroy,  /* destroy function */
 	0         /* per-child init function */
 	0         /* per-child init function */
 };
 };
 
 
-
-static int mod_init(void)
+int km_mod_init(void)
 {
 {
 	db_parms_t p;
 	db_parms_t p;
 	
 	
@@ -121,7 +117,7 @@ static int mod_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-static void destroy(void)
+void km_destroy(void)
 {
 {
 	km_bdblib_destroy();
 	km_bdblib_destroy();
 }
 }

+ 6 - 0
modules/db_berkeley/km_db_berkeley.h

@@ -36,6 +36,7 @@
 #include "../../lib/srdb1/db_key.h"
 #include "../../lib/srdb1/db_key.h"
 #include "../../lib/srdb1/db_op.h"
 #include "../../lib/srdb1/db_op.h"
 #include "../../lib/srdb1/db_val.h"
 #include "../../lib/srdb1/db_val.h"
+#include "../../lib/srdb1/db.h"
 
 
 /* reloads the berkeley db */
 /* reloads the berkeley db */
 int bdb_reload(char* _n);
 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,
 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);
 	      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
 #endif