src/dird/dir_plugins.c
void new_plugins(JCR *jcr)
{
   Plugin *plugin;
   int i = 0;

   Dmsg0(dbglvl, "=== enter new_plugins ===\n");
   if (!b_plugin_list) {
      Dmsg0(dbglvl, "No Director plugin list!\n");
      return;
   }
   if (jcr->is_job_canceled()) {
      return;
   }

   int num = b_plugin_list->size();

   Dmsg1(dbglvl, "dir-plugin-list size=%d\n", num);
   if (num == 0) {
      return;
   }

   jcr->plugin_ctx_list = (bpContext *)malloc(sizeof(bpContext) * num);

   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, 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));
      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) {
         b_ctx->disabled = true;
      }
   }
}
/*
 * Create a new instance of each plugin for this Job
 */
Create a new instance of each plugin for this Job
Create a new instance of each plugin for this Job
void new_plugins(JCR *jcr)
{
   Plugin *plugin;
   int i = 0;
   Dmsg0(dbglvl, "=== enter new_plugins ===\n");
   if (!b_plugin_list) {
      Dmsg0(dbglvl, "No Director plugin list!\n");
      return;
   }
   if (jcr->is_job_canceled()) {
      return;
   }
   int num = b_plugin_list->size();
   Dmsg1(dbglvl, "dir-plugin-list size=%d\n", num);
   if (num == 0) {
      return;
   }
   jcr->plugin_ctx_list = (bpContext *)malloc(sizeof(bpContext) * num);
   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, b_plugin_list) {
      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) {
         b_ctx->disabled = true;
      }
   }
}
void new_plugins ( JCR * jcr ) { Plugin * plugin ; int i = 0 ; Dmsg0 ( dbglvl , " \n " ) ; if ( ! b_plugin_list ) { Dmsg0 ( dbglvl , " \n " ) ; return ; } if ( jcr -> is_job_canceled ( ) ) { return ; } int num = b_plugin_list -> size ( ) ; Dmsg1 ( dbglvl , " \n " , num ) ; if ( num == 0 ) { return ; } jcr -> plugin_ctx_list = ( bpContext * ) malloc ( sizeof ( bpContext ) * num ) ; bpContext * plugin_ctx_list = jcr -> plugin_ctx_list ; Dmsg2 ( dbglvl , " \n " , jcr -> plugin_ctx_list , jcr -> JobId ) ; foreach_alist_index ( i , plugin , b_plugin_list ) { 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 ) { b_ctx -> disabled = true ; } } }
Create a new instance of each plugin for this Job
Create a new instance of each plugin for this Job
/* Start a new instance of each plugin */