event.eventType = bEventBackupCommand;
/* Handle plugin command here backup */
- Dmsg1(100, "plugin cmd=%s\n", cmd);
+ Dmsg1(dbglvl, "plugin cmd=%s\n", cmd);
if (!(p = strchr(cmd, ':'))) {
Jmsg1(jcr, M_ERROR, 0, "Malformed plugin command: %s\n", cmd);
goto bail_out;
}
foreach_alist(plugin, plugin_list) {
- Dmsg3(100, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
+ Dmsg3(dbglvl, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
if (strncmp(plugin->file, cmd, len) != 0) {
i++;
continue;
}
- Dmsg1(100, "Command plugin = %s\n", cmd);
+ Dmsg1(dbglvl, "Command plugin = %s\n", cmd);
/* Send the backup command */
if (plug_func(plugin)->handlePluginEvent(&plugin_ctx_list[i], &event, cmd) != bRC_OK) {
goto bail_out;
sp.type = FT_REG;
sp.portable = true;
sp.cmd = cmd;
- Dmsg3(000, "startBackup st_size=%p st_blocks=%p sp=%p\n", &sp.statp.st_size, &sp.statp.st_blocks,
+ Dmsg3(dbglvl, "startBackup st_size=%p st_blocks=%p sp=%p\n", &sp.statp.st_size, &sp.statp.st_blocks,
&sp);
/* Get the file save parameters */
if (plug_func(plugin)->startBackupFile(&plugin_ctx_list[i], &sp) != bRC_OK) {
ff_pkt->fname = sp.fname;
ff_pkt->type = sp.type;
memcpy(&ff_pkt->statp, &sp.statp, sizeof(ff_pkt->statp));
- Dmsg1(000, "Save_file: file=%s\n", ff_pkt->fname);
+ Dmsg1(dbglvl, "Save_file: file=%s\n", ff_pkt->fname);
save_file(jcr, ff_pkt, true);
if (plug_func(plugin)->endBackupFile(&plugin_ctx_list[i]) != bRC_More) {
goto bail_out;
int stat;
struct save_pkt *sp = (struct save_pkt *)jcr->plugin_sp;
- Dmsg1(000, "send_plugin_name=%s\n", sp->cmd);
+ Dmsg1(dbglvl, "send_plugin_name=%s\n", sp->cmd);
/* Send stream header */
if (!sd->fsend("%ld %d 0", jcr->JobFiles+1, STREAM_PLUGIN_NAME)) {
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
sd->bstrerror());
return false;
}
- Dmsg1(000, "send: %s\n", sd->msg);
+ Dmsg1(dbglvl, "send: %s\n", sd->msg);
sd->signal(BNET_EOD); /* indicate end of plugin name data */
return true;
}
goto bail_out;
}
- Dmsg1(100, "Read plugin stream string=%s\n", name);
+ Dmsg1(dbglvl, "Read plugin stream string=%s\n", name);
skip_nonspaces(&p); /* skip over jcr->JobFiles */
skip_spaces(&p);
start = *p == '1';
* After this point, we are dealing with a restore start
*/
- Dmsg1(100, "plugin restore cmd=%s\n", cmd);
+ Dmsg1(dbglvl, "plugin restore cmd=%s\n", cmd);
if (!(p = strchr(cmd, ':'))) {
Jmsg1(jcr, M_ERROR, 0, "Malformed plugin command: %s\n", cmd);
goto bail_out;
*/
foreach_alist(plugin, plugin_list) {
bEvent event;
- Dmsg3(100, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
+ Dmsg3(dbglvl, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
if (strncmp(plugin->file, cmd, len) != 0) {
i++;
continue;
}
- Dmsg1(100, "Restore Command plugin = %s\n", cmd);
+ Dmsg1(dbglvl, "Restore Command plugin = %s\n", cmd);
event.eventType = bEventRestoreCommand;
if (plug_func(plugin)->handlePluginEvent(&plugin_ctx_list[i],
&event, cmd) != bRC_OK) {
Plugin *plugin;
if (!plugin_dir) {
+ Dmsg0(dbglvl, "plugin dir is NULL\n");
return;
}
if (plugin_list->size() == 0) {
delete plugin_list;
plugin_list = NULL;
+ Dmsg0(dbglvl, "No plugins loaded\n");
return;
}
}
plugin_blseek = my_plugin_blseek;
foreach_alist(plugin, plugin_list) {
Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
+ Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
+
}
}
int i = 0;
if (!plugin_list) {
+ Dmsg0(dbglvl, "plugin list is NULL\n");
return;
}
int num = plugin_list->size();
if (num == 0) {
+ Dmsg0(dbglvl, "No plugins loaded\n");
return;
}
Plugin *plugin = (Plugin *)jcr->plugin;
bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
struct io_pkt io;
- Dmsg0(000, "plugin_bopen\n");
+ Dmsg0(dbglvl, "plugin_bopen\n");
io.func = IO_OPEN;
io.count = 0;
io.buf = NULL;
Plugin *plugin = (Plugin *)jcr->plugin;
bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
struct io_pkt io;
- Dmsg0(000, "plugin_bclose\n");
+ Dmsg0(dbglvl, "plugin_bclose\n");
io.func = IO_CLOSE;
io.count = 0;
io.buf = NULL;
Plugin *plugin = (Plugin *)jcr->plugin;
bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
struct io_pkt io;
- Dmsg0(000, "plugin_bread\n");
+ Dmsg0(dbglvl, "plugin_bread\n");
io.func = IO_READ;
io.count = count;
io.buf = (char *)buf;
Plugin *plugin = (Plugin *)jcr->plugin;
bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
struct io_pkt io;
- Dmsg0(000, "plugin_bwrite\n");
+ Dmsg0(dbglvl, "plugin_bwrite\n");
io.func = IO_WRITE;
io.count = count;
io.buf = (char *)buf;
Plugin *plugin = (Plugin *)jcr->plugin;
bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
struct io_pkt io;
- Dmsg0(000, "plugin_bseek\n");
+ Dmsg0(dbglvl, "plugin_bseek\n");
io.func = IO_SEEK;
io.offset = offset;
io.whence = whence;
#include "bacula.h"
#include "plugins.h"
+static const int dbglvl = 50;
+
/* All loaded plugins */
alist *plugin_list = NULL;
berrno be;
Jmsg(NULL, M_ERROR_TERM, 0, _("Failed to open Plugin directory %s: ERR=%s\n"),
plugin_dir, be.bstrerror());
+ Dmsg2(dbglvl, "Failed to open Plugin directory %s: ERR=%s\n",
+ plugin_dir, be.bstrerror());
goto get_out;
}
if (!found) {
Jmsg(NULL, M_WARNING, 0, _("Failed to find any plugins in %s\n"),
plugin_dir);
+ Dmsg1(dbglvl, "Failed to find any plugins in %s\n", plugin_dir);
}
break;
}
len = strlen(result->d_name);
type_len = strlen(type);
if (len < type_len+1 || strcmp(&result->d_name[len-type_len], type) != 0) {
- Dmsg3(100, "Rejected plugin: want=%s name=%s len=%d\n", type, result->d_name, len);
+ Dmsg3(dbglvl, "Rejected plugin: want=%s name=%s len=%d\n", type, result->d_name, len);
continue;
}
- Dmsg2(100, "Loaded plugin: name=%s len=%d\n", result->d_name, len);
+ Dmsg2(dbglvl, "Loaded plugin: name=%s len=%d\n", result->d_name, len);
pm_strcpy(fname, plugin_dir);
if (need_slash) {
if (!plugin->pHandle) {
Jmsg(NULL, M_ERROR, 0, _("Plugin load %s failed: ERR=%s\n"),
fname.c_str(), NPRT(dlerror()));
+ Dmsg2(dbglvl, "Plugin load %s failed: ERR=%s\n", fname.c_str(),
+ NPRT(dlerror()));
goto get_out;
}
if (!loadPlugin) {
Jmsg(NULL, M_ERROR, 0, _("Lookup of loadPlugin in plugin %s failed: ERR=%s\n"),
fname.c_str(), NPRT(dlerror()));
+ Dmsg2(dbglvl, "Lookup of loadPlugin in plugin %s failed: ERR=%s\n",
+ fname.c_str(), NPRT(dlerror()));
goto get_out;
}
plugin->unloadPlugin = (t_unloadPlugin)dlsym(plugin->pHandle, "unloadPlugin");
if (!plugin->unloadPlugin) {
Jmsg(NULL, M_ERROR, 0, _("Lookup of unloadPlugin in plugin %s failed: ERR=%s\n"),
fname.c_str(), NPRT(dlerror()));
+ Dmsg2(dbglvl, "Lookup of unloadPlugin in plugin %s failed: ERR=%s\n",
+ fname.c_str(), NPRT(dlerror()));
goto get_out;
}