Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
- plugin_ctx = &plugin_ctx_list[i++];
+ foreach_alist_index(i, plugin, bplugin_list) {
+ plugin_ctx = &plugin_ctx_list[i];
if (is_plugin_disabled(plugin_ctx)) {
continue;
}
void load_dir_plugins(const char *plugin_dir)
{
Plugin *plugin;
+ int i;
Dmsg0(dbglvl, "Load dir plugins\n");
if (!plugin_dir) {
* Verify that the plugin is acceptable, and print information
* about it.
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
}
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(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_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));
b_ctx->jcr = jcr;
plugin_ctx_list[i].bContext = (void *)b_ctx;
plugin_ctx_list[i].pContext = NULL;
- if (dirplug_func(plugin)->newPlugin(&plugin_ctx_list[i++]) != bRC_OK) {
+ if (dirplug_func(plugin)->newPlugin(&plugin_ctx_list[i]) != bRC_OK) {
b_ctx->disabled = true;
}
}
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(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
/* Free the plugin instance */
dirplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
- free(plugin_ctx_list[i++].bContext); /* free Bacula private context */
+ free(plugin_ctx_list[i].bContext); /* free Bacula private context */
}
free(plugin_ctx_list);
jcr->plugin_ctx_list = NULL;
bpContext *plugin_ctx;
bEvent event;
Plugin *plugin;
- int i = 0;
+ int i;
char *name = NULL;
int len = 0;
bool call_if_canceled = false;
call_if_canceled = true;
break;
case bEventStartRestoreJob:
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
plugin->restoreFileStarted = false;
plugin->createFileCalled = false;
}
* Pass event to every plugin (except if name is set). If name
* is set, we pass it only to the plugin with that name.
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
if (name && !for_this_plug(plugin, name, len)) {
- i++;
continue;
}
- plugin_ctx = &plugin_ctx_list[i++];
+ plugin_ctx = &plugin_ctx_list[i];
if (is_plugin_disabled(plugin_ctx)) {
continue;
}
{
Plugin *plugin;
int rc = bRC_OK;
- int i = 0;
+ int i;
if (!bplugin_list || !jcr || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
return false; /* Return if no plugins loaded */
Dmsg2(dbglvl, "plugin_ctx=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
/* Pass event to every plugin */
- foreach_alist(plugin, bplugin_list) {
- jcr->plugin_ctx = &plugin_ctx_list[i++];
+ foreach_alist_index(i, plugin, bplugin_list) {
+ jcr->plugin_ctx = &plugin_ctx_list[i];
jcr->plugin = plugin;
if (is_plugin_disabled(jcr)) {
continue;
}
/* Note, we stop the loop on the first plugin that matches the name */
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
if (!for_this_plug(plugin, cmd, len)) {
- i++;
continue;
}
jcr->opt_plugin = true;
jcr->plugin = plugin;
jcr->plugin_sp = sp; /* Unset sp in save_file */
- jcr->plugin_ctx = &plugin_ctx_list[i++];
+ jcr->plugin_ctx = &plugin_ctx_list[i];
update_ff_pkt(ff_pkt, sp);
}
int plugin_save(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
{
Plugin *plugin;
- int i = 0;
+ int i;
int len;
char *cmd = ff_pkt->top_fname;
struct save_pkt sp;
}
/* Note, we stop the loop on the first plugin that matches the name */
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
if (!for_this_plug(plugin, cmd, len)) {
- i++;
continue;
}
/*
int plugin_estimate(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
{
Plugin *plugin;
- int i = 0;
int len;
+ int i;
char *cmd = ff_pkt->top_fname;
struct save_pkt sp;
bEvent event;
}
/* Note, we stop the loop on the first plugin that matches the name */
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
if (!for_this_plug(plugin, cmd, len)) {
- i++;
continue;
}
/*
bool start;
Plugin *plugin;
int len;
- int i = 0;
+ int i;
bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
Dmsg1(dbglvl, "Read plugin stream string=%s\n", name);
/*
* Search for correct plugin as specified on the command
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
bEvent event;
Dmsg3(dbglvl, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
if (!for_this_plug(plugin, cmd, len)) {
- i++;
continue;
}
jcr->plugin_ctx = &plugin_ctx_list[i];
void load_fd_plugins(const char *plugin_dir)
{
Plugin *plugin;
+ int i;
if (!plugin_dir) {
Dmsg0(dbglvl, "plugin dir is NULL\n");
* Verify that the plugin is acceptable, and print information
* about it.
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
}
void new_plugins(JCR *jcr)
{
Plugin *plugin;
- int i = 0;
+ int i;
if (!bplugin_list) {
Dmsg0(dbglvl, "plugin list is NULL\n");
bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Instantiate plugin_ctx=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_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));
b_ctx->jcr = jcr;
plugin_ctx_list[i].bContext = (void *)b_ctx; /* Bacula private context */
plugin_ctx_list[i].pContext = NULL;
- if (plug_func(plugin)->newPlugin(&plugin_ctx_list[i++]) != bRC_OK) {
+ if (plug_func(plugin)->newPlugin(&plugin_ctx_list[i]) != bRC_OK) {
b_ctx->disabled = true;
}
}
void free_plugins(JCR *jcr)
{
Plugin *plugin;
- int i = 0;
+ int i;
if (!bplugin_list || !jcr->plugin_ctx_list) {
return; /* no plugins, nothing to do */
bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Free instance plugin_ctx=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
/* Free the plugin instance */
plug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
- free(plugin_ctx_list[i++].bContext); /* free Bacula private context */
+ free(plugin_ctx_list[i].bContext); /* free Bacula private context */
}
free(plugin_ctx_list);
jcr->plugin_ctx_list = NULL;
Dmsg2(dbglvl, "sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
- plugin_ctx = &plugin_ctx_list[i++];
+ foreach_alist_index(i, plugin, bplugin_list) {
+ plugin_ctx = &plugin_ctx_list[i];
if (is_plugin_disabled(plugin_ctx)) {
continue;
}
void load_sd_plugins(const char *plugin_dir)
{
Plugin *plugin;
+ int i;
Dmsg0(dbglvl, "Load sd plugins\n");
if (!plugin_dir) {
* Verify that the plugin is acceptable, and print information
* about it.
*/
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
}
bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Instantiate sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_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));
b_ctx->jcr = jcr;
plugin_ctx_list[i].bContext = (void *)b_ctx;
plugin_ctx_list[i].pContext = NULL;
- if (sdplug_func(plugin)->newPlugin(&plugin_ctx_list[i++]) != bRC_OK) {
+ if (sdplug_func(plugin)->newPlugin(&plugin_ctx_list[i]) != bRC_OK) {
b_ctx->disabled = true;
}
}
bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
Dmsg2(dbglvl, "Free instance sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
- foreach_alist(plugin, bplugin_list) {
+ foreach_alist_index(i, plugin, bplugin_list) {
/* Free the plugin instance */
sdplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
- free(plugin_ctx_list[i++].bContext); /* free Bacula private context */
+ free(plugin_ctx_list[i].bContext); /* free Bacula private context */
}
free(plugin_ctx_list);
jcr->plugin_ctx_list = NULL;