[asterisk-commits] nadi: branch nadi/trunk-cm r43992 - in
/team/nadi/trunk-cm: main/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Sep 29 07:06:30 MST 2006
Author: nadi
Date: Fri Sep 29 09:06:29 2006
New Revision: 43992
URL: http://svn.digium.com/view/asterisk?rev=43992&view=rev
Log:
configman now is a loadable module.
Added:
team/nadi/trunk-cm/res/res_configman.c
- copied, changed from r43976, team/nadi/trunk-cm/main/configman.c
Removed:
team/nadi/trunk-cm/main/configman.c
Modified:
team/nadi/trunk-cm/main/Makefile
team/nadi/trunk-cm/main/asterisk.c
Modified: team/nadi/trunk-cm/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/nadi/trunk-cm/main/Makefile?rev=43992&r1=43991&r2=43992&view=diff
==============================================================================
--- team/nadi/trunk-cm/main/Makefile (original)
+++ team/nadi/trunk-cm/main/Makefile Fri Sep 29 09:06:29 2006
@@ -26,7 +26,7 @@
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
- strcompat.o hash.o configman.o
+ strcompat.o hash.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Modified: team/nadi/trunk-cm/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/nadi/trunk-cm/main/asterisk.c?rev=43992&r1=43991&r2=43992&view=diff
==============================================================================
--- team/nadi/trunk-cm/main/asterisk.c (original)
+++ team/nadi/trunk-cm/main/asterisk.c Fri Sep 29 09:06:29 2006
@@ -118,7 +118,6 @@
#include "asterisk/lock.h"
#include "editline/histedit.h"
#include "asterisk/config.h"
-#include "asterisk/configman.h"
#include "asterisk/version.h"
#include "asterisk/linkedlists.h"
#include "asterisk/devicestate.h"
@@ -2358,7 +2357,6 @@
callerid_init();
ast_builtins_init();
ast_utils_init();
- ast_configman_init();
tdd_init();
/* When Asterisk restarts after it has dropped the root privileges,
* it can't issue setuid(), setgid(), setgroups() or set_priority()
Copied: team/nadi/trunk-cm/res/res_configman.c (from r43976, team/nadi/trunk-cm/main/configman.c)
URL: http://svn.digium.com/view/asterisk/team/nadi/trunk-cm/res/res_configman.c?p2=team/nadi/trunk-cm/res/res_configman.c&p1=team/nadi/trunk-cm/main/configman.c&r1=43976&r2=43992&rev=43992&view=diff
==============================================================================
--- team/nadi/trunk-cm/main/configman.c (original)
+++ team/nadi/trunk-cm/res/res_configman.c Fri Sep 29 09:06:29 2006
@@ -16,7 +16,7 @@
* at the top of the source tree.
*/
-/*! \file configman.c
+/*! \file res_configman.c
*
* \brief Configuration Management
*
@@ -36,21 +36,22 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision: $")
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
#include <string.h>
-#include <errno.h>
#include "asterisk/configman.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
+#include "asterisk/hash.h"
#include "asterisk/logger.h"
#include "asterisk/lock.h"
+#include "asterisk/module.h"
#include "asterisk/strings.h"
+#include "asterisk/term.h"
#include "asterisk/utils.h"
-#include "asterisk/term.h"
-#include "asterisk/hash.h"
static inline char * notdir (char *str)
{
@@ -1069,6 +1070,8 @@
ast_mutex_destroy(&cm->lock);
free(cm);
+
+ ast_module_unref(ast_module_info->self);
}
cm_t * cm_create (const char *modname, const cm_section_t *sections, int num)
@@ -1128,6 +1131,7 @@
cm->clis[1].generator = cli_show_config_descriptions_completer;
ast_cli_register(&cm->clis[1]);
+ ast_module_ref(ast_module_info->self);
cm->state = CM_CREATED;
return cm;
@@ -1172,18 +1176,29 @@
"Usage: configman show usage\n" },
};
-static void ast_configman_exit (void)
+static int load_module (void)
+{
+ AST_HASH_INIT_STR(&cm_obj_hash, HASHSIZE);
+ ast_cli_register_multiple(configman_clis, sizeof(configman_clis) / sizeof(struct ast_cli_entry));
+
+ return 0;
+}
+
+static int unload_module (void)
{
ast_cli_unregister_multiple(configman_clis, sizeof(configman_clis) / sizeof(struct ast_cli_entry));
AST_HASH_DESTROY(&cm_obj_hash);
-}
-
-int ast_configman_init (void)
-{
- AST_HASH_INIT_STR(&cm_obj_hash, HASHSIZE);
- ast_cli_register_multiple(configman_clis, sizeof(configman_clis) / sizeof(struct ast_cli_entry));
-
- ast_register_atexit(ast_configman_exit);
return 0;
}
+
+static int reload (void)
+{
+ return -1;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Configuration Management Resource",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
More information about the asterisk-commits
mailing list