From a48b926c4542146253c681bb8ab20ee5517f05ff Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 18 Apr 2012 16:32:43 +0200 Subject: [PATCH] Allow plugin to backup a directory --- bacula/src/filed/backup.c | 2 +- bacula/src/filed/fd_plugins.c | 3 ++- bacula/src/filed/fd_plugins.h | 8 +++++--- bacula/src/findlib/find.h | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index e9242a06de..a17e8ceb3f 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -535,7 +535,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) set_portable_backup(&ff_pkt->bfd); /* disable Win32 BackupRead() */ } - if (ff_pkt->cmd_plugin) { + if (ff_pkt->cmd_plugin && !ff_pkt->no_read) { do_plugin_set = true; /* option and cmd plugin are not compatible together */ diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index f09d9ad2c0..7e25f04a3a 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -1,7 +1,7 @@ /* 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. @@ -319,6 +319,7 @@ static bool get_plugin_name(JCR *jcr, char *cmd, int *ret) 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; diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index dfb0d93d96..d20f17b6e2 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -1,7 +1,7 @@ /* 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. @@ -101,6 +101,7 @@ struct save_pkt { struct stat statp; /* System stat() packet for file */ int32_t type; /* FT_xx for this file */ uint32_t flags; /* Bacula internal flags */ + bool no_read; /* During the save, the file should not be saved */ bool portable; /* set if data format is portable */ bool accurate_found; /* Found in accurate list (valid after check_changes()) */ char *cmd; /* command */ @@ -187,7 +188,8 @@ typedef enum { bVarVersion = 17, bVarDistName = 18, bVarBEEF = 19, - bVarPrevJobName = 20 + bVarPrevJobName = 20, + bVarPrefixLinks = 21 } bVariable; /* Events that are passed to plugin */ @@ -299,7 +301,7 @@ typedef enum { #define FD_PLUGIN_MAGIC "*FDPluginData*" -#define FD_PLUGIN_INTERFACE_VERSION 5 +#define FD_PLUGIN_INTERFACE_VERSION 6 typedef struct s_pluginInfo { uint32_t size; diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index da504c27a3..a91ba882b4 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -188,6 +188,7 @@ struct FF_PKT { bool dereference; /* follow links (not implemented) */ bool null_output_device; /* using null output device */ bool incremental; /* incremental save */ + bool no_read; /* Do not read this file when using Plugin */ char VerifyOpts[20]; char AccurateOpts[20]; char BaseJobOpts[20]; -- 2.39.2