]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/sd_plugins.c
update version
[bacula/bacula] / bacula / src / stored / sd_plugins.c
index d289c986d894a4db003facff97bb67dff6f1584f..32bbcc51ba156879faba6e1438846e1c0bb7baea 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2009 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.
@@ -44,7 +44,7 @@ static bRC baculaGetValue(bpContext *ctx, brVariable var, void *value);
 static bRC baculaSetValue(bpContext *ctx, bwVariable var, void *value);
 static bRC baculaRegisterEvents(bpContext *ctx, ...);
 static bRC baculaJobMsg(bpContext *ctx, const char *file, int line,
-  int type, time_t mtime, const char *msg);
+  int type, utime_t mtime, const char *msg);
 static bRC baculaDebugMsg(bpContext *ctx, const char *file, int line,
   int level, const char *msg);
 
@@ -95,14 +95,30 @@ void generate_plugin_event(JCR *jcr, bEventType eventType, void *value)
    return;
 }
 
-void load_dir_plugins(const char *plugin_dir)
+static void dump_sd_plugin(Plugin *plugin, FILE *fp)
+{
+   if (!plugin) {
+      return ;
+   }
+   pInfo *info = (pInfo *) plugin->pinfo;
+   fprintf(fp, "\tversion=%d\n", info->version);
+   fprintf(fp, "\tdate=%s\n", NPRTB(info->plugin_date));
+   fprintf(fp, "\tmagic=%s\n", NPRTB(info->plugin_magic));
+   fprintf(fp, "\tauthor=%s\n", NPRTB(info->plugin_author));
+   fprintf(fp, "\tlicence=%s\n", NPRTB(info->plugin_license));
+   fprintf(fp, "\tversion=%s\n", NPRTB(info->plugin_version));
+   fprintf(fp, "\tdescription=%s\n", NPRTB(info->plugin_description));
+}
+
+void load_sd_plugins(const char *plugin_dir)
 {
    if (!plugin_dir) {
       return;
    }
 
    plugin_list = New(alist(10, not_owned_by_alist));
-   load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type);
+   load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type, NULL);
+   dbg_plugin_add_hook(dump_sd_plugin);
 }
 
 /*
@@ -123,9 +139,9 @@ void new_plugins(JCR *jcr)
       return;
    }
 
-   jcr->plugin_ctx_list = (void *)malloc(sizeof(bpContext) * num);
+   jcr->plugin_ctx_list = (bpContext *)malloc(sizeof(bpContext) * num);
 
-   bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
+   bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Instantiate plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
    foreach_alist(plugin, plugin_list) {
       /* Start a new instance of each plugin */
@@ -203,9 +219,9 @@ static bRC baculaRegisterEvents(bpContext *ctx, ...)
 }
 
 static bRC baculaJobMsg(bpContext *ctx, const char *file, int line,
-  int type, time_t mtime, const char *msg)
+  int type, utime_t mtime, const char *msg)
 {
-   Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%ld msg=%s\n",
+   Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%lld msg=%s\n",
       file, line, type, mtime, msg);
    return bRC_OK;
 }
@@ -231,7 +247,7 @@ int main(int argc, char *argv[])
    strcpy(my_name, "test-dir");
     
    getcwd(plugin_dir, sizeof(plugin_dir)-1);
-   load_dir_plugins(plugin_dir);
+   load_sd_plugins(plugin_dir);
 
    jcr1->JobId = 111;
    new_plugins(jcr1);