示例#1
0
/*
 * Create a plugin event
 */
int generate_plugin_event(JCR *jcr, bDirEventType eventType, void *value, bool reverse)
{
    bDirEvent event;
    Plugin *plugin;
    int i;
    bRC rc = bRC_OK;

    if (!dird_plugin_list || !jcr || !jcr->plugin_ctx_list) {
        return bRC_OK;                  /* Return if no plugins loaded */
    }

    if (jcr->is_job_canceled()) {
        return bRC_Cancel;
    }

    bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
    event.eventType = eventType;

    Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);

    /*
     * See if we need to trigger the loaded plugins in reverse order.
     */
    if (reverse) {
        foreach_alist_rindex(i, plugin, dird_plugin_list) {
            rc = trigger_plugin_event(jcr, eventType, &event, plugin, plugin_ctx_list, i, value);

            if (rc != bRC_OK) {
                break;
            }
        }
    } else {
示例#2
0
/*
 * Create a plugin event
 */
int generate_plugin_event(JCR *jcr, bsdEventType eventType, void *value, bool reverse)
{
   int i;
   bsdEvent event;
   alist *plugin_ctx_list;
   bRC rc = bRC_OK;

   if (!sd_plugin_list) {
      Dmsg0(dbglvl, "No bplugin_list: generate_plugin_event ignored.\n");
      return bRC_OK;
   }

   if (!jcr) {
      Dmsg0(dbglvl, "No jcr: generate_plugin_event ignored.\n");
      return bRC_OK;
   }

   if (!jcr->plugin_ctx_list) {
      Dmsg0(dbglvl, "No plugin_ctx_list: generate_plugin_event ignored.\n");
      return bRC_OK;                  /* Return if no plugins loaded */
   }

   if (jcr->is_job_canceled()) {
      Dmsg0(dbglvl, "Cancel return from generate_plugin_event\n");
      return bRC_Cancel;
   }

   plugin_ctx_list = jcr->plugin_ctx_list;
   event.eventType = eventType;

   Dmsg2(dbglvl, "sd-plugin_ctx_list=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);

   /*
    * See if we need to trigger the loaded plugins in reverse order.
    */
   if (reverse) {
      bpContext *ctx;

      foreach_alist_rindex(i, ctx, plugin_ctx_list) {
         rc = trigger_plugin_event(jcr, eventType, &event, ctx, value);
         if (rc != bRC_OK) {
            break;
         }
      }
   } else {
示例#3
0
/*
 * Create a plugin event
 */
bRC generate_plugin_event(JCR *jcr, bDirEventType eventType, void *value, bool reverse)
{
   int i;
   bDirEvent event;
   alist *plugin_ctx_list;
   bRC rc = bRC_OK;

   if (!dird_plugin_list) {
      Dmsg0(dbglvl, "No bplugin_list: generate_plugin_event ignored.\n");
      goto bail_out;
   }

   if (!jcr) {
      Dmsg0(dbglvl, "No jcr: generate_plugin_event ignored.\n");
      goto bail_out;
   }

   /*
    * Return if no plugins loaded
    */
   if (!jcr->plugin_ctx_list) {
      Dmsg0(dbglvl, "No plugin_ctx_list: generate_plugin_event ignored.\n");
      goto bail_out;
   }

   plugin_ctx_list = jcr->plugin_ctx_list;
   event.eventType = eventType;

   Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);

   /*
    * See if we need to trigger the loaded plugins in reverse order.
    */
   if (reverse) {
      bpContext *ctx;

      foreach_alist_rindex(i, ctx, plugin_ctx_list) {
         if (trigger_plugin_event(jcr, eventType, &event, ctx, value, plugin_ctx_list, &i, &rc)) {
            break;
         }
      }
   } else {
示例#4
0
 foreach_alist_index(i, ctx, plugin_ctx_list) {
    if (trigger_plugin_event(jcr, eventType, &event, ctx, value, plugin_ctx_list, &i, &rc)) {
       break;
    }
 }