[Asterisk-code-review] optional api: Remove unused nonoptreq fields (asterisk[16])

George Joseph asteriskteam at digium.com
Thu Sep 13 13:09:17 CDT 2018


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10080 )

Change subject: optional_api: Remove unused nonoptreq fields
......................................................................

optional_api: Remove unused nonoptreq fields

As they're not actively used, they only grow stale. The moduleinfo field itself
is kept in Asterisk 13/15 for ABI compatibility.

ASTERISK-28046 #close

Change-Id: I8df66a7007f807840414bb348511a8c14c05a9fc
---
M res/ari/ari_model_validators.h
M res/res_stasis_test.c
M rest-api-templates/ari_model_validators.h.mustache
M tests/test_ari_model.c
4 files changed, 15 insertions(+), 30 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h
index 328349b..3c501cf 100644
--- a/res/ari/ari_model_validators.h
+++ b/res/ari/ari_model_validators.h
@@ -23,11 +23,10 @@
  * the validator's function pointer.
  *
  * The reason for this seamingly useless indirection is the way function
- * pointers interfere with module loading. Asterisk attempts to dlopen() each
- * module using \c RTLD_LAZY in order to read some metadata from the module.
- * Unfortunately, if you take the address of a function, the function has to be
- * resolvable at load time, even if \c RTLD_LAZY is specified. By moving the
- * function-address-taking into this module, we can once again be lazy.
+ * pointers used to interfere with module loading. Previously, Asterisk
+ * attempted to dlopen() each module using \c RTLD_LAZY in order to read some
+ * metadata from the module. Using functions to get the function pointer
+ * allowed us to be lazy.
  */
 
  /*
diff --git a/res/res_stasis_test.c b/res/res_stasis_test.c
index 19d2a42..416a963 100644
--- a/res/res_stasis_test.c
+++ b/res/res_stasis_test.c
@@ -100,23 +100,10 @@
  * \brief Implementation of the stasis_message_sink_cb() callback.
  *
  * Why the roundabout way of exposing this via stasis_message_sink_cb()? Well,
- * it has to do with how we load modules.
+ * it has to do with how we previously loaded modules, using \c RTLD_LAZY.
  *
- * Modules have their own metadata compiled into them in the module info block
- * at the end of the file.  This includes dependency information in the
- * \c nonoptreq field.
- *
- * Asterisk loads the module, inspects the field, then loads any needed
- * dependencies. This works because Asterisk passes \c RTLD_LAZY to the initial
- * dlopen(), which defers binding function references until they are called.
- *
- * But when you take the address of a function, that function needs to be
- * available at load time. So if some module used the address of
- * message_sink_cb() directly, and \c res_stasis_test.so wasn't loaded yet, then
- * that module would fail to load.
- *
- * The stasis_message_sink_cb() function gives us a layer of indirection so that
- * the initial lazy binding will still work as expected.
+ * The stasis_message_sink_cb() function gave us a layer of indirection so that
+ * the initial lazy binding would still work as expected.
  */
 static void message_sink_cb(void *data, struct stasis_subscription *sub,
 	struct stasis_message *message)
diff --git a/rest-api-templates/ari_model_validators.h.mustache b/rest-api-templates/ari_model_validators.h.mustache
index 0223a68..0b055db 100644
--- a/rest-api-templates/ari_model_validators.h.mustache
+++ b/rest-api-templates/ari_model_validators.h.mustache
@@ -23,11 +23,10 @@
  * the validator's function pointer.
  *
  * The reason for this seamingly useless indirection is the way function
- * pointers interfere with module loading. Asterisk attempts to dlopen() each
- * module using \c RTLD_LAZY in order to read some metadata from the module.
- * Unfortunately, if you take the address of a function, the function has to be
- * resolvable at load time, even if \c RTLD_LAZY is specified. By moving the
- * function-address-taking into this module, we can once again be lazy.
+ * pointers used to interfere with module loading. Previously, Asterisk
+ * attempted to dlopen() each module using \c RTLD_LAZY in order to read some
+ * metadata from the module. Using functions to get the function pointer
+ * allowed us to be lazy.
  */
 
  /*
diff --git a/tests/test_ari_model.c b/tests/test_ari_model.c
index e5a96cd..1ab42dd 100644
--- a/tests/test_ari_model.c
+++ b/tests/test_ari_model.c
@@ -40,8 +40,8 @@
 /*!
  * Wrapper of ast_test_validate_int() so an external function pointer is not used.
  *
- * \note Must do this because using an external function pointer
- * does not play nicely when loading with RTLD_LAZY.
+ * \note We do this because using an external function pointer
+ * did not play nicely when we loaded with RTLD_LAZY.
  */
 static int wrap_ast_ari_validate_int(struct ast_json *json)
 {
@@ -53,8 +53,8 @@
 /*!
  * Wrapper of ast_ari_validate_string() so an external function pointer is not used.
  *
- * \note Must do this because using an external function pointer
- * does not play nicely when loading with RTLD_LAZY.
+ * \note We do this because using an external function pointer
+ * did not play nicely when we loaded with RTLD_LAZY.
  */
 static int wrap_ast_ari_validate_string(struct ast_json *json)
 {

-- 
To view, visit https://gerrit.asterisk.org/10080
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: I8df66a7007f807840414bb348511a8c14c05a9fc
Gerrit-Change-Number: 10080
Gerrit-PatchSet: 2
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Walter Doekes <walter+asterisk at wjd.nu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180913/18fbc49b/attachment.html>


More information about the asterisk-code-review mailing list