[asterisk-commits] Modules: Make ast module info->self available to auxiliary s... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 7 07:04:43 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Modules: Make ast_module_info->self available to auxiliary sources.
......................................................................


Modules: Make ast_module_info->self available to auxiliary sources.

ast_module_info->self is often needed to register items with the core.  Many
modules have ad-hoc code to make this pointer available to auxiliary sources.
This change updates the module build process to make the needed information
available to all sources in a module.

ASTERISK-25056 #close
Reported by: Corey Farrell

Change-Id: I18c8cd58fbcb1b708425f6757becaeca9fa91815
---
M Makefile.moddir_rules
M channels/chan_dahdi.c
M channels/dahdi/bridge_native_dahdi.c
M channels/dahdi/bridge_native_dahdi.h
M channels/sip/dialplan_functions.c
M codecs/lpc10/lpcini.c
M include/asterisk.h
M include/asterisk/app.h
M include/asterisk/bridge_technology.h
M include/asterisk/bucket.h
M include/asterisk/codec.h
M include/asterisk/data.h
M include/asterisk/format.h
M include/asterisk/manager.h
M include/asterisk/mod_format.h
M include/asterisk/module.h
M include/asterisk/parking.h
M include/asterisk/pbx.h
M include/asterisk/rtp_engine.h
M include/asterisk/sorcery.h
M include/asterisk/timing.h
M include/asterisk/translate.h
M main/Makefile
M main/parking.c
M res/parking/parking_applications.c
M res/parking/parking_bridge_features.c
M res/parking/parking_manager.c
M res/parking/res_parking.h
M res/res_parking.c
M res/res_pjsip.c
M res/res_pjsip/include/res_pjsip_private.h
M res/res_pjsip/pjsip_configuration.c
M res/res_pjsip/pjsip_options.c
M utils/Makefile
34 files changed, 82 insertions(+), 65 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve



diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index d2964e3..e702282 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -60,7 +60,11 @@
 # is used to collect the required flags for a module... which can
 # then be used any place they are required.
 
-MOD_ASTCFLAGS=-DAST_MODULE=\"$(1)\" $(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$(value $(dep)_INCLUDE))
+MOD_ASTCFLAGS=\
+	-DAST_MODULE=\"$(1)\" \
+	-DAST_MODULE_SELF_SYM=__internal_$(1)_self \
+	$(MENUSELECT_OPTS_$(1):%=-D%) \
+	$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$(value $(dep)_INCLUDE))
 
 define MOD_ADD_SOURCE
 $$(if $$(filter $(1),$$(EMBEDDED_MODS)),modules.link,$(1).so): $$(subst $(3),$(5),$(2))
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index b9405d5..0b187dc 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -19519,7 +19519,7 @@
 	ast_format_cap_append(dahdi_tech.capabilities, ast_format_ulaw, 0);
 	ast_format_cap_append(dahdi_tech.capabilities, ast_format_alaw, 0);
 
-	if (dahdi_native_load(ast_module_info->self, &dahdi_tech)) {
+	if (dahdi_native_load(&dahdi_tech)) {
 		ao2_ref(dahdi_tech.capabilities, -1);
 		return AST_MODULE_LOAD_FAILURE;
 	}
diff --git a/channels/dahdi/bridge_native_dahdi.c b/channels/dahdi/bridge_native_dahdi.c
index d67cb5c..234228b 100644
--- a/channels/dahdi/bridge_native_dahdi.c
+++ b/channels/dahdi/bridge_native_dahdi.c
@@ -903,11 +903,11 @@
  * \retval 0 on success.
  * \retval -1 on error.
  */
-int dahdi_native_load(struct ast_module *mod, const struct ast_channel_tech *tech)
+int dahdi_native_load(const struct ast_channel_tech *tech)
 {
 	dahdi_tech = tech;
 
-	if (__ast_bridge_technology_register(&native_bridge, mod)) {
+	if (ast_bridge_technology_register(&native_bridge)) {
 		dahdi_native_unload();
 		return -1;
 	}
diff --git a/channels/dahdi/bridge_native_dahdi.h b/channels/dahdi/bridge_native_dahdi.h
index 91e8d16..6362a6f 100644
--- a/channels/dahdi/bridge_native_dahdi.h
+++ b/channels/dahdi/bridge_native_dahdi.h
@@ -36,7 +36,7 @@
 /* ------------------------------------------------------------------- */
 
 void dahdi_native_unload(void);
-int dahdi_native_load(struct ast_module *mod, const struct ast_channel_tech *tech);
+int dahdi_native_load(const struct ast_channel_tech *tech);
 
 /* ------------------------------------------------------------------- */
 
diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c
index 91a4678..33ba71c 100644
--- a/channels/sip/dialplan_functions.c
+++ b/channels/sip/dialplan_functions.c
@@ -338,7 +338,7 @@
 		break;
 	}
 
-	ast_rtp_engine_register2(&test_engine, NULL);
+	ast_rtp_engine_register(&test_engine);
 	/* Have to associate this with a SIP pvt and an ast_channel */
 	if (!(p = sip_alloc(0, NULL, 0, SIP_NOTIFY, NULL, 0))) {
 		res = AST_TEST_NOT_RUN;
diff --git a/codecs/lpc10/lpcini.c b/codecs/lpc10/lpcini.c
index 42c2331..ebe229a 100644
--- a/codecs/lpc10/lpcini.c
+++ b/codecs/lpc10/lpcini.c
@@ -34,7 +34,7 @@
 	-lf2c -lm   (in that order)
 */
 
-#include "asterisk.h"
+#include <stdlib.h>
 #include "f2c.h"
 
 #ifdef P_R_O_T_O_T_Y_P_E_S
diff --git a/include/asterisk.h b/include/asterisk.h
index 14e88e6..ab2a3dd 100644
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -271,4 +271,21 @@
 #define __stringify_1(x)	#x
 #define __stringify(x)		__stringify_1(x)
 
+#if defined(AST_IN_CORE) \
+	|| (!defined(AST_MODULE_SELF_SYM) \
+		&& (defined(STANDALONE) || defined(STANDALONE2) || defined(AST_NOT_MODULE)))
+
+#define AST_MODULE_SELF NULL
+
+#elif defined(AST_MODULE_SELF_SYM)
+
+/*! Retreive the 'struct ast_module *' for the current module. */
+#define AST_MODULE_SELF AST_MODULE_SELF_SYM()
+
+struct ast_module;
+/* Internal/forward declaration, AST_MODULE_SELF should be used instead. */
+struct ast_module *AST_MODULE_SELF_SYM(void);
+
+#endif
+
 #endif /* _ASTERISK_H */
diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index 6171dd4..3975fda 100644
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -584,7 +584,7 @@
 int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module);
 
 /*! \brief See \ref __ast_vm_register() */
-#define ast_vm_register(vm_table) __ast_vm_register(vm_table, ast_module_info ? ast_module_info->self : NULL)
+#define ast_vm_register(vm_table) __ast_vm_register(vm_table, AST_MODULE_SELF)
 
 /*!
  * \brief Unregister the specified voicemail provider
@@ -652,7 +652,7 @@
 int __ast_vm_greeter_register(const struct ast_vm_greeter_functions *vm_table, struct ast_module *module);
 
 /*! \brief See \ref __ast_vm_greeter_register() */
-#define ast_vm_greeter_register(vm_table) __ast_vm_greeter_register(vm_table, ast_module_info ? ast_module_info->self : NULL)
+#define ast_vm_greeter_register(vm_table) __ast_vm_greeter_register(vm_table, AST_MODULE_SELF)
 
 /*!
  * \brief Unregister the specified voicemail greeter provider
diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h
index 01031e3..b83a51b 100644
--- a/include/asterisk/bridge_technology.h
+++ b/include/asterisk/bridge_technology.h
@@ -182,7 +182,7 @@
 int __ast_bridge_technology_register(struct ast_bridge_technology *technology, struct ast_module *mod);
 
 /*! \brief See \ref __ast_bridge_technology_register() */
-#define ast_bridge_technology_register(technology) __ast_bridge_technology_register(technology, ast_module_info->self)
+#define ast_bridge_technology_register(technology) __ast_bridge_technology_register(technology, AST_MODULE_SELF)
 
 /*!
  * \brief Unregister a bridge technology from use
diff --git a/include/asterisk/bucket.h b/include/asterisk/bucket.h
index c07fb0c..da83759 100644
--- a/include/asterisk/bucket.h
+++ b/include/asterisk/bucket.h
@@ -134,7 +134,7 @@
  *
  * \note Once a scheme has been registered it can not be unregistered
  */
-#define ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb) __ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb, ast_module_info ? ast_module_info->self : NULL)
+#define ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb) __ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb, AST_MODULE_SELF)
 
 /*!
  * \brief Register support for a specific scheme
diff --git a/include/asterisk/codec.h b/include/asterisk/codec.h
index 28befec..3873324 100644
--- a/include/asterisk/codec.h
+++ b/include/asterisk/codec.h
@@ -116,7 +116,7 @@
  * \retval 0 success
  * \retval -1 failure
  */
-#define ast_codec_register(codec) __ast_codec_register(codec, ast_module_info->self)
+#define ast_codec_register(codec) __ast_codec_register(codec, AST_MODULE_SELF)
 
 /*!
  * \brief Retrieve a codec given a name, type, and sample rate
diff --git a/include/asterisk/data.h b/include/asterisk/data.h
index 3676b8d..d6da1f7 100644
--- a/include/asterisk/data.h
+++ b/include/asterisk/data.h
@@ -360,7 +360,7 @@
  */
 int __ast_data_register(const char *path, const struct ast_data_handler *handler,
 	const char *registrar, struct ast_module *mod);
-#define ast_data_register(path, handler) __ast_data_register(path, handler, __FILE__, ast_module_info->self)
+#define ast_data_register(path, handler) __ast_data_register(path, handler, __FILE__, AST_MODULE_SELF)
 #define ast_data_register_core(path, handler) __ast_data_register(path, handler, __FILE__, NULL)
 
 /*!
@@ -376,7 +376,7 @@
 int __ast_data_register_multiple(const struct ast_data_entry *data_entries,
 	size_t entries, const char *registrar, struct ast_module *mod);
 #define ast_data_register_multiple(data_entries, entries) \
-	__ast_data_register_multiple(data_entries, entries, __FILE__, ast_module_info->self)
+	__ast_data_register_multiple(data_entries, entries, __FILE__, AST_MODULE_SELF)
 #define ast_data_register_multiple_core(data_entries, entries) \
 	__ast_data_register_multiple(data_entries, entries, __FILE__, NULL)
 
diff --git a/include/asterisk/format.h b/include/asterisk/format.h
index 3da2d82..c99c8f3 100644
--- a/include/asterisk/format.h
+++ b/include/asterisk/format.h
@@ -247,7 +247,7 @@
  * \retval 0 success
  * \retval -1 failure
  */
-#define ast_format_interface_register(codec, interface) __ast_format_interface_register(codec, interface, ast_module_info->self)
+#define ast_format_interface_register(codec, interface) __ast_format_interface_register(codec, interface, AST_MODULE_SELF)
 
 /*!
  * \brief Get the attribute data on a format
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index b5ede54..1ec1cba 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -180,10 +180,10 @@
 
 /*! \brief External routines may register/unregister manager callbacks this way 
  * \note  Use ast_manager_register2() to register with help text for new manager commands */
-#define ast_manager_register(action, authority, func, synopsis) ast_manager_register2(action, authority, func, ast_module_info->self, synopsis, NULL)
+#define ast_manager_register(action, authority, func, synopsis) ast_manager_register2(action, authority, func, AST_MODULE_SELF, synopsis, NULL)
 
 /*! \brief Register a manager callback using XML documentation to describe the manager. */
-#define ast_manager_register_xml(action, authority, func) ast_manager_register2(action, authority, func, ast_module_info->self, NULL, NULL)
+#define ast_manager_register_xml(action, authority, func) ast_manager_register2(action, authority, func, AST_MODULE_SELF, NULL, NULL)
 
 /*!
  * \brief Register a manager callback using XML documentation to describe the manager.
diff --git a/include/asterisk/mod_format.h b/include/asterisk/mod_format.h
index 7f17741..bcd31de 100644
--- a/include/asterisk/mod_format.h
+++ b/include/asterisk/mod_format.h
@@ -128,7 +128,7 @@
  * \retval -1 on failure
  */
 int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod);
-#define ast_format_def_register(f) __ast_format_def_register(f, ast_module_info->self)
+#define ast_format_def_register(f) __ast_format_def_register(f, AST_MODULE_SELF)
 
 /*! 
  * \brief Unregisters a file format 
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index 6d5e04d..f427491 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -312,9 +312,9 @@
 void __ast_module_user_remove(struct ast_module *, struct ast_module_user *);
 void __ast_module_user_hangup_all(struct ast_module *);
 
-#define ast_module_user_add(chan) __ast_module_user_add(ast_module_info->self, chan)
-#define ast_module_user_remove(user) __ast_module_user_remove(ast_module_info->self, user)
-#define ast_module_user_hangup_all() __ast_module_user_hangup_all(ast_module_info->self)
+#define ast_module_user_add(chan) __ast_module_user_add(AST_MODULE_SELF, chan)
+#define ast_module_user_remove(user) __ast_module_user_remove(AST_MODULE_SELF, user)
+#define ast_module_user_hangup_all() __ast_module_user_hangup_all(AST_MODULE_SELF)
 
 struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func);
 void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func);
@@ -368,7 +368,12 @@
 	{                                                                  \
 		ast_module_unregister(&__mod_info);                            \
 	}                                                                  \
+	struct ast_module *AST_MODULE_SELF_SYM(void)                       \
+	{                                                                  \
+		return __mod_info.self;                                        \
+	}                                                                  \
 	static const __attribute__((unused)) struct ast_module_info *ast_module_info = &__mod_info
+
 
 #define AST_MODULE_INFO_STANDARD(keystr, desc)              \
 	AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
@@ -401,7 +406,9 @@
 /* forward declare this pointer in modules, so that macro/function
    calls that need it can get it, since it will actually be declared
    and populated at the end of the module's source file... */
+#if !defined(AST_IN_CORE)
 static const __attribute__((unused)) struct ast_module_info *ast_module_info;
+#endif
 
 #if !defined(EMBEDDED_MODULE)
 #define __MODULE_INFO_SECTION
@@ -482,6 +489,10 @@
 	{ \
 		ast_module_unregister(&__mod_info); \
 	} \
+	struct ast_module *AST_MODULE_SELF_SYM(void)                       \
+	{                                                                  \
+		return __mod_info.self;                                        \
+	}                                                                  \
 	static const struct ast_module_info *ast_module_info = &__mod_info
 
 #define AST_MODULE_INFO_STANDARD(keystr, desc)              \
@@ -527,7 +538,7 @@
  * \retval 0 success 
  * \retval -1 failure.
  */
-#define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, ast_module_info->self)
+#define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, AST_MODULE_SELF)
 
 /*! 
  * \brief Register an application using XML documentation.
diff --git a/include/asterisk/parking.h b/include/asterisk/parking.h
index a8832cd..4c93c3b 100644
--- a/include/asterisk/parking.h
+++ b/include/asterisk/parking.h
@@ -196,7 +196,7 @@
 	int (* parking_park_bridge_channel)(struct ast_bridge_channel *parkee, const char *parkee_uuid, const char *parker_uuid, const char *app_data);
 
 	/*! \brief The module info for the module registering this parking provider */
-	const struct ast_module_info *module_info;
+	struct ast_module *module;
 };
 
 /*!
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 795af05..c09de98 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -1406,7 +1406,7 @@
 /*!
  * \brief Register a custom function
  */
-#define ast_custom_function_register(acf) __ast_custom_function_register(acf, ast_module_info->self)
+#define ast_custom_function_register(acf) __ast_custom_function_register(acf, AST_MODULE_SELF)
 
 /*!
  * \brief Register a custom function which requires escalated privileges.
@@ -1415,7 +1415,7 @@
  * arbitrary code) or FILE() (for which write needs permission to change files
  * on the filesystem).
  */
-#define ast_custom_function_register_escalating(acf, escalation) __ast_custom_function_register_escalating(acf, escalation, ast_module_info->self)
+#define ast_custom_function_register_escalating(acf, escalation) __ast_custom_function_register_escalating(acf, escalation, AST_MODULE_SELF)
 
 /*!
  * \brief Register a custom function
diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h
index a1a17da..a94cb42 100644
--- a/include/asterisk/rtp_engine.h
+++ b/include/asterisk/rtp_engine.h
@@ -643,7 +643,7 @@
  */
 struct ast_rtp_payload_type *ast_rtp_engine_alloc_payload_type(void);
 
-#define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, ast_module_info->self)
+#define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, AST_MODULE_SELF)
 
 /*!
  * \brief Register an RTP engine
@@ -696,7 +696,7 @@
 void ast_rtp_engine_unregister_srtp(void);
 int ast_rtp_engine_srtp_is_registered(void);
 
-#define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, ast_module_info->self)
+#define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, AST_MODULE_SELF)
 
 /*!
  * \brief Register RTP glue
diff --git a/include/asterisk/sorcery.h b/include/asterisk/sorcery.h
index 874dac2..a5061c6 100644
--- a/include/asterisk/sorcery.h
+++ b/include/asterisk/sorcery.h
@@ -366,7 +366,7 @@
 /*!
  * \brief See \ref __ast_sorcery_wizard_register()
  */
-#define ast_sorcery_wizard_register(interface) __ast_sorcery_wizard_register(interface, ast_module_info ? ast_module_info->self : NULL)
+#define ast_sorcery_wizard_register(interface) __ast_sorcery_wizard_register(interface, AST_MODULE_SELF)
 
 /*!
  * \brief Unregister a sorcery wizard
diff --git a/include/asterisk/timing.h b/include/asterisk/timing.h
index ff4947a..2682003 100644
--- a/include/asterisk/timing.h
+++ b/include/asterisk/timing.h
@@ -92,7 +92,7 @@
  * \retval non-Null handle to be passed to ast_unregister_timing_interface() on success
  * \since 1.6.1
  */
-#define ast_register_timing_interface(i) _ast_register_timing_interface(i, ast_module_info->self)
+#define ast_register_timing_interface(i) _ast_register_timing_interface(i, AST_MODULE_SELF)
 void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
 						 struct ast_module *mod);
 
diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h
index e8e4c02..87e9a2c 100644
--- a/include/asterisk/translate.h
+++ b/include/asterisk/translate.h
@@ -241,7 +241,7 @@
 int __ast_register_translator(struct ast_translator *t, struct ast_module *module);
 
 /*! \brief See \ref __ast_register_translator() */
-#define ast_register_translator(t) __ast_register_translator(t, ast_module_info->self)
+#define ast_register_translator(t) __ast_register_translator(t, AST_MODULE_SELF)
 
 /*!
  * \brief Unregister a translator
diff --git a/main/Makefile b/main/Makefile
index c0c0aff..08496e6 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -201,7 +201,7 @@
 ASTSSL_LIB:=libasteriskssl.so
 
 $(ASTSSL_LIB).$(ASTSSL_SO_VERSION): _ASTLDFLAGS+=-Wl,-soname=$(ASTSSL_LIB).$(ASTSSL_SO_VERSION)
-$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskssl\"
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskssl\" -DAST_NOT_MODULE
 $(ASTSSL_LIB).$(ASTSSL_SO_VERSION): LIBS+=$(ASTSSL_LIBS)
 ifeq ($(GNU_LD),1)
     $(ASTSSL_LIB).$(ASTSSL_SO_VERSION): SO_SUPPRESS_SYMBOLS=-Wl,--version-script,libasteriskssl.exports,--warn-common
diff --git a/main/parking.c b/main/parking.c
index 25fdfe8..61a4896 100644
--- a/main/parking.c
+++ b/main/parking.c
@@ -134,8 +134,8 @@
 		return -1;
 	}
 
-	if (table->module_info) {
-		SCOPED_MODULE_USE(table->module_info->self);
+	if (table->module) {
+		SCOPED_MODULE_USE(table->module);
 		return table->parking_park_bridge_channel(parkee, parkee_uuid, parker_uuid, app_data);
 	}
 
@@ -153,8 +153,8 @@
 		return -1;
 	}
 
-	if (table->module_info) {
-		SCOPED_MODULE_USE(table->module_info->self);
+	if (table->module) {
+		SCOPED_MODULE_USE(table->module);
 		return table->parking_blind_transfer_park(parker, context, exten, parked_channel_cb, parked_channel_data);
 	}
 
@@ -170,8 +170,8 @@
 		return -1;
 	}
 
-	if (table->module_info) {
-		SCOPED_MODULE_USE(table->module_info->self);
+	if (table->module) {
+		SCOPED_MODULE_USE(table->module);
 		return table->parking_park_call(parker, exten, length);
 	}
 
@@ -187,8 +187,8 @@
 		return -1;
 	}
 
-	if (table->module_info) {
-		SCOPED_MODULE_USE(table->module_info->self);
+	if (table->module) {
+		SCOPED_MODULE_USE(table->module);
 		return table->parking_is_exten_park(context, exten);
 	}
 
diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c
index 762bf55..5077474 100644
--- a/res/parking/parking_applications.c
+++ b/res/parking/parking_applications.c
@@ -868,8 +868,6 @@
 
 int load_parking_applications(void)
 {
-	const struct ast_module_info *ast_module_info = parking_get_module_info();
-
 	if (ast_register_application_xml(PARK_APPLICATION, park_app_exec)) {
 		return -1;
 	}
diff --git a/res/parking/parking_bridge_features.c b/res/parking/parking_bridge_features.c
index 4a01e4c..4cb87c8 100644
--- a/res/parking/parking_bridge_features.c
+++ b/res/parking/parking_bridge_features.c
@@ -502,7 +502,7 @@
 
 static int feature_park_call(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
-	SCOPED_MODULE_USE(parking_get_module_info()->self);
+	SCOPED_MODULE_USE(AST_MODULE_SELF);
 
 	return parking_park_call(bridge_channel, NULL, 0);
 }
@@ -726,7 +726,7 @@
 
 int load_parking_bridge_features(void)
 {
-	parking_provider.module_info = parking_get_module_info();
+	parking_provider.module = AST_MODULE_SELF;
 
 	if (ast_parking_register_bridge_features(&parking_provider)) {
 		return -1;
diff --git a/res/parking/parking_manager.c b/res/parking/parking_manager.c
index ffa4bc7..175ae5f 100644
--- a/res/parking/parking_manager.c
+++ b/res/parking/parking_manager.c
@@ -678,11 +678,10 @@
 int load_parking_manager(void)
 {
 	int res;
-	const struct ast_module_info *module = parking_get_module_info();
 
-	res = ast_manager_register2("Parkinglots", EVENT_FLAG_CALL, manager_parking_lot_list, module->self, NULL, NULL);
-	res |= ast_manager_register2("ParkedCalls", EVENT_FLAG_CALL, manager_parking_status, module->self, NULL, NULL);
-	res |= ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park, module->self, NULL, NULL);
+	res = ast_manager_register_xml("Parkinglots", EVENT_FLAG_CALL, manager_parking_lot_list);
+	res |= ast_manager_register_xml("ParkedCalls", EVENT_FLAG_CALL, manager_parking_status);
+	res |= ast_manager_register_xml("Park", EVENT_FLAG_CALL, manager_park);
 	parking_manager_enable_stasis();
 	return res ? -1 : 0;
 }
diff --git a/res/parking/res_parking.h b/res/parking/res_parking.h
index 3d77e51..2c4a180 100644
--- a/res/parking/res_parking.h
+++ b/res/parking/res_parking.h
@@ -560,12 +560,3 @@
  * \return Nothing
  */
 void unload_parking_tests(void);
-
-struct ast_module_info;
-/*!
- * \since 12.0.0
- * \brief Get res_parking's module info
- *
- * \retval res_parking's ast_module
- */
-const struct ast_module_info *parking_get_module_info(void);
diff --git a/res/res_parking.c b/res/res_parking.c
index a40990e..02740da 100644
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -1159,11 +1159,6 @@
 	disable_marked_lots();
 }
 
-const struct ast_module_info *parking_get_module_info(void)
-{
-	return ast_module_info;
-}
-
 static int unload_module(void)
 {
 	unload_parking_bridge_features();
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 8be019f..a263809 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3650,7 +3650,7 @@
 
 	ast_sip_initialize_global_headers();
 
-	if (ast_res_pjsip_initialize_configuration(ast_module_info)) {
+	if (ast_res_pjsip_initialize_configuration()) {
 		ast_log(LOG_ERROR, "Failed to initialize SIP configuration. Aborting load\n");
 		ast_sip_destroy_global_headers();
 		stop_monitor_thread();
diff --git a/res/res_pjsip/include/res_pjsip_private.h b/res/res_pjsip/include/res_pjsip_private.h
index 5120fc6..a53e0c4 100644
--- a/res/res_pjsip/include/res_pjsip_private.h
+++ b/res/res_pjsip/include/res_pjsip_private.h
@@ -25,7 +25,7 @@
  * \internal
  * \brief Initialize the configuration for res_pjsip
  */
-int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_module_info);
+int ast_res_pjsip_initialize_configuration(void);
 
 /*!
  * \internal
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 54fdb65..f147b34 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1742,7 +1742,7 @@
 struct ast_sip_cli_formatter_entry *channel_formatter;
 struct ast_sip_cli_formatter_entry *endpoint_formatter;
 
-int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_module_info)
+int ast_res_pjsip_initialize_configuration(void)
 {
 	if (ast_manager_register_xml(AMI_SHOW_ENDPOINTS, EVENT_FLAG_SYSTEM, ami_show_endpoints) ||
 	    ast_manager_register_xml(AMI_SHOW_ENDPOINT, EVENT_FLAG_SYSTEM, ami_show_endpoint)) {
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index 8ffb88c..87c67fa 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -1181,7 +1181,7 @@
 	}
 
 	internal_sip_register_endpoint_formatter(&contact_status_formatter);
-	ast_manager_register2("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify, NULL, NULL, NULL);
+	ast_manager_register_xml("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify);
 	ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
 
 	qualify_and_schedule_all();
diff --git a/utils/Makefile b/utils/Makefile
index af21673..97b0e2f 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -150,6 +150,8 @@
 	$(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
 	$(CMD_PREFIX) mv "$@.new" "$@"
 
+pbx_ael.o: _ASTCFLAGS+=-DAST_MODULE_SELF_SYM=__internal_pbx_ael_self
+
 aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
 	$(ECHO_PREFIX) echo "   [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
 	$(CMD_PREFIX) cp "$<" "$@"

-- 
To view, visit https://gerrit.asterisk.org/355
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18c8cd58fbcb1b708425f6757becaeca9fa91815
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list