/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2012 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.
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;
static void update_ff_pkt(FF_PKT *ff_pkt, struct save_pkt *sp)
{
+ ff_pkt->no_read = sp->no_read;
ff_pkt->delta_seq = sp->delta_seq;
if (sp->flags & FO_DELTA) {
ff_pkt->flags |= FO_DELTA;
sp->statp = ff_pkt->statp;
sp->fname = ff_pkt->fname;
sp->delta_seq = ff_pkt->delta_seq;
+ sp->accurate_found = ff_pkt->accurate_found;
if (!bplugin_list || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
Jmsg1(jcr, M_FATAL, 0, "Command plugin \"%s\" requested, but is not loaded.\n", cmd);
}
/* 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);
}
return false;
}
if (strcmp(info->plugin_license, "Bacula AGPLv3") != 0 &&
- strcmp(info->plugin_license, "AGPLv3") != 0 &&
- strcmp(info->plugin_license, "Bacula Systems(R) SA") != 0) {
+ strcmp(info->plugin_license, "AGPLv3") != 0) {
Jmsg(NULL, M_ERROR, 0, _("Plugin license incompatible. Plugin=%s license=%s\n"),
plugin->file, info->plugin_license);
Dmsg2(50, "Plugin license incompatible. Plugin=%s license=%s\n",
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;
*((char **)value) = jcr->Job;
Dmsg1(dbglvl, "Bacula: return Job name=%s\n", jcr->Job);
break;
+ case bVarPrevJobName:
+ *((char **)value) = jcr->PrevJob;
+ Dmsg1(dbglvl, "Bacula: return Previous Job name=%s\n", jcr->PrevJob);
+ break;
case bVarJobStatus:
*((int *)value) = jcr->JobStatus;
Dmsg1(dbglvl, "Bacula: return bVarJobStatus=%d\n", jcr->JobStatus);
case bVarRegexWhere:
*(char **)value = jcr->RegexWhere;
break;
-
case bVarFDName: /* get warning with g++ if we missed one */
case bVarWorkingDir:
case bVarExePath:
case bVarVersion:
case bVarDistName:
case bVarBEEF:
+ case bVarPrefixLinks:
break;
}
return bRC_OK;
* plugin
*/
sp->delta_seq = ff_pkt->delta_seq;
+ sp->accurate_found = ff_pkt->accurate_found;
bail_out:
Dmsg1(100, "checkChanges=%i\n", ret);