/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
+ Copyright (C) 2000-2015 Kern Sibbald
Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
You may use this file and others of this release according to the
license defined in the LICENSE file, which includes the Affero General
Public License, v3.0 ("AGPLv3") and some additional permissions and
terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
*/
/*
* Main program to test loading and running Bacula plugins.
bpContext *plugin_ctx;
bDirEvent event;
Plugin *plugin;
- int i;
+ int i = 0;
bRC rc = bRC_OK;
- if (!bplugin_list || !jcr || !jcr->plugin_ctx_list) {
+ if (!b_plugin_list || !jcr || !jcr->plugin_ctx_list) {
return bRC_OK; /* Return if no plugins loaded */
}
if (jcr->is_job_canceled()) {
Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist_index(i, plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, b_plugin_list) {
plugin_ctx = &plugin_ctx_list[i];
if (is_plugin_disabled(plugin_ctx)) {
continue;
Plugin *plugin;
int i;
- Dmsg0(dbglvl, "Load dir plugins\n");
+ Dmsg0(dbglvl, "Load Director plugins\n");
if (!plugin_dir) {
- Dmsg0(dbglvl, "No dir plugin dir!\n");
+ Dmsg0(dbglvl, "No Director plugin directory!\n");
return;
}
- bplugin_list = New(alist(10, not_owned_by_alist));
+ b_plugin_list = New(alist(10, not_owned_by_alist));
if (!load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type,
is_plugin_compatible)) {
/* Either none found, or some error */
- if (bplugin_list->size() == 0) {
- delete bplugin_list;
- bplugin_list = NULL;
+ if (b_plugin_list->size() == 0) {
+ delete b_plugin_list;
+ b_plugin_list = NULL;
Dmsg0(dbglvl, "No plugins loaded\n");
return;
}
* Verify that the plugin is acceptable, and print information
* about it.
*/
- foreach_alist_index(i, plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, b_plugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
}
- Dmsg1(dbglvl, "num plugins=%d\n", bplugin_list->size());
+ Dmsg1(dbglvl, "num plugins=%d\n", b_plugin_list->size());
dbg_plugin_add_hook(dump_dir_plugin);
}
void new_plugins(JCR *jcr)
{
Plugin *plugin;
- int i;
+ int i = 0;
Dmsg0(dbglvl, "=== enter new_plugins ===\n");
- if (!bplugin_list) {
- Dmsg0(dbglvl, "No dir plugin list!\n");
+ if (!b_plugin_list) {
+ Dmsg0(dbglvl, "No Director plugin list!\n");
return;
}
if (jcr->is_job_canceled()) {
return;
}
- int num = bplugin_list->size();
+ int num = b_plugin_list->size();
Dmsg1(dbglvl, "dir-plugin-list size=%d\n", num);
if (num == 0) {
bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Instantiate dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist_index(i, plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, b_plugin_list) {
/* Start a new instance of each plugin */
bacula_ctx *b_ctx = (bacula_ctx *)malloc(sizeof(bacula_ctx));
memset(b_ctx, 0, sizeof(bacula_ctx));
void free_plugins(JCR *jcr)
{
Plugin *plugin;
- int i;
+ int i = 0;
- if (!bplugin_list || !jcr->plugin_ctx_list) {
+ if (!b_plugin_list || !jcr->plugin_ctx_list) {
return;
}
bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Free instance dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist_index(i, plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, b_plugin_list) {
/* Free the plugin instance */
dirplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
free(plugin_ctx_list[i].bContext); /* free Bacula private context */