]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Explain DL priorities
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Jul 2018 14:26:31 +0000 (10:26 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Jul 2018 14:26:31 +0000 (10:26 -0400)
src/include/dl.h
src/main/dl.c
src/main/mainconfig.c

index cfeca192d02869cd5d44f7997c396c47c1b96079..7c595e61ce77b8f250168cdd7098a9f953e2367d 100644 (file)
@@ -161,10 +161,13 @@ struct dl_instance {
        dl_instance_t const     *parent;        //!< Parent module's instance (if any).
 };
 
-#define DL_DICT_PRIORITY       11              //!< Callback priority for dictionary autoloading
-#define DL_DICT_ATTR_PRIORITY  10              //!< Callback priority for attribute resolution
-#define DL_INSTANTIATE_PRIORITY        5               //!< Callback priority for bootstrap callback
-
+/** Callback priorities
+ *
+ * The higher the priority, the earlier in callback gets called.
+ */
+#define DL_PRIORITY_DICT       30              //!< Callback priority for dictionary autoloading
+#define DL_PRIORITY_DICT_ATTR  20              //!< Callback priority for attribute resolution
+#define DL_PRIORITY_INSTANTIATE        10              //!< Callback priority for bootstrap callback
 
 int                    dl_loader_init(TALLOC_CTX *ctx, char const *lib_dir);
 
index 4360047b2b9e76e5da6f47f58395d3c19dcb5b5d..1fdfad06e36deb4cadf95b7a8c0ac45c43dd84a8 100644 (file)
@@ -979,12 +979,12 @@ int dl_loader_init(TALLOC_CTX *ctx, char const *lib_dir)
                goto error;
        }
 
-       if (dl_symbol_init_cb_register(DL_INSTANTIATE_PRIORITY, NULL, dl_load_func, NULL) < 0) {
+       if (dl_symbol_init_cb_register(DL_PRIORITY_INSTANTIATE, NULL, dl_load_func, NULL) < 0) {
                ERROR("Failed registering load() callback");
                goto error;
        }
 
-       if (dl_symbol_free_cb_register(DL_INSTANTIATE_PRIORITY, NULL, dl_unload_func, NULL) < 0) {
+       if (dl_symbol_free_cb_register(DL_PRIORITY_INSTANTIATE, NULL, dl_unload_func, NULL) < 0) {
                ERROR("Failed registering unload() callback");
                goto error;
        }
index b5510327d32b5d8704b966b5ff4ea72f2495892f..3d7511aac65fdfa69a523073e69e150704b3343e 100644 (file)
@@ -992,9 +992,9 @@ do {\
        /*
         *      Register dictionary autoload callbacks
         */
-       dl_symbol_init_cb_register(DL_DICT_ATTR_PRIORITY, "dict_attr", _module_dict_attr_autoload, NULL);
-       dl_symbol_init_cb_register(DL_DICT_PRIORITY, "dict", _module_dict_autoload, NULL);
-       dl_symbol_free_cb_register(DL_DICT_PRIORITY, "dict", _module_dict_autofree, NULL);
+       dl_symbol_init_cb_register(DL_PRIORITY_DICT_ATTR, "dict_attr", _module_dict_attr_autoload, NULL);
+       dl_symbol_init_cb_register(DL_PRIORITY_DICT, "dict", _module_dict_autoload, NULL);
+       dl_symbol_free_cb_register(DL_PRIORITY_DICT, "dict", _module_dict_autofree, NULL);
 
        /* Read the configuration file */
        snprintf(buffer, sizeof(buffer), "%.200s/%.50s.conf", config->raddb_dir, config->name);