X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Ffiled%2Ffd_plugins.h;h=12d3baa256a778e3ac723ee315daa9a2d384abdd;hb=5450f5e38d6dd94600c7c35fedf7f9ccea3e7adb;hp=ae96109d9439f5f37bb87c414fd0abdc331f13ad;hpb=fc59d63f92ca701081af4e1f77bea017802f31d2;p=bacula%2Fbacula diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index ae96109d94..12d3baa256 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-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. @@ -46,7 +46,7 @@ #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE 1 #define _LARGE_FILES 1 -#endif +#endif /* ! _BACULA_H */ #include @@ -56,7 +56,7 @@ #else #include "winconfig.h" #endif -#else +#else /* !HAVE_WIN32 */ #ifndef __CONFIG_H #include "config.h" #define __CONFIG_H @@ -71,19 +71,22 @@ * This packet is used for file save info transfer. */ struct save_pkt { - char *fname; /* Full path and filename */ - char *link; /* Link name if any */ - struct stat statp; /* System stat() packet for file */ - int32_t type; /* FT_xx for this file */ - uint32_t flags; /* Bacula internal flags */ - bool portable; /* set if data format is portable */ - char *cmd; /* command */ + int32_t pkt_size; /* size of this packet */ + char *fname; /* Full path and filename */ + char *link; /* Link name if any */ + struct stat statp; /* System stat() packet for file */ + int32_t type; /* FT_xx for this file */ + uint32_t flags; /* Bacula internal flags */ + bool portable; /* set if data format is portable */ + char *cmd; /* command */ + int32_t pkt_end; /* end packet sentinel */ }; /* * This packet is used for file restore info transfer. */ struct restore_pkt { + int32_t pkt_size; /* size of this packet */ int32_t stream; /* attribute stream id */ int32_t data_stream; /* id of data stream to follow */ int32_t type; /* file type FT */ @@ -97,6 +100,8 @@ struct restore_pkt { const char *where; /* where */ const char *RegexWhere; /* regex where */ int replace; /* replace flag */ + int create_status; /* status from createFile() */ + int32_t pkt_end; /* end packet sentinel */ }; enum { @@ -108,6 +113,7 @@ enum { }; struct io_pkt { + int32_t pkt_size; /* Size of this packet */ int32_t func; /* Function code */ int32_t count; /* read/write count */ int32_t flags; /* Open flags */ @@ -120,6 +126,7 @@ struct io_pkt { int32_t whence; /* lseek argument */ boffset_t offset; /* lseek argument */ bool win32; /* Win32 GetLastError returned */ + int32_t pkt_end; /* end packet sentinel */ }; /**************************************************************************** @@ -137,9 +144,12 @@ typedef enum { bVarClient = 5, bVarJobName = 6, bVarJobStatus = 7, - bVarSinceTime = 8 + bVarSinceTime = 8, + bVarAccurate = 9, + bVarFileSeen = 10 } bVariable; +/* Events that are passed to plugin */ typedef enum { bEventJobStart = 1, bEventJobEnd = 2, @@ -153,6 +163,7 @@ typedef enum { bEventRestoreCommand = 10, bEventLevel = 11, bEventSince = 12, + bEventCancelCommand = 13, } bEventType; typedef struct s_bEvent { @@ -173,10 +184,11 @@ void new_plugins(JCR *jcr); void free_plugins(JCR *jcr); void generate_plugin_event(JCR *jcr, bEventType event, void *value=NULL); bool send_plugin_name(JCR *jcr, BSOCK *sd, bool start); -void plugin_name_stream(JCR *jcr, char *name); +bool plugin_name_stream(JCR *jcr, char *name); int plugin_create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace); bool plugin_set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd); int plugin_save(JCR *jcr, FF_PKT *ff_pkt, bool top_level); +bool plugin_check_file(JCR *jcr, char *fname); #endif #ifdef __cplusplus @@ -194,9 +206,12 @@ typedef struct s_baculaFuncs { bRC (*getBaculaValue)(bpContext *ctx, bVariable var, void *value); bRC (*setBaculaValue)(bpContext *ctx, bVariable var, void *value); bRC (*JobMessage)(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *fmt, ...); + int type, utime_t mtime, const char *fmt, ...); bRC (*DebugMessage)(bpContext *ctx, const char *file, int line, int level, const char *fmt, ...); + void *(*baculaMalloc)(bpContext *ctx, const char *file, int line, + size_t size); + void (*baculaFree)(bpContext *ctx, const char *file, int line, void *mem); } bFuncs; @@ -215,7 +230,7 @@ typedef enum { #define FD_PLUGIN_MAGIC "*FDPluginData*" -#define FD_PLUGIN_INTERFACE_VERSION 1 +#define FD_PLUGIN_INTERFACE_VERSION 4 typedef struct s_pluginInfo { uint32_t size; @@ -247,6 +262,7 @@ typedef struct s_pluginFuncs { bRC (*pluginIO)(bpContext *ctx, struct io_pkt *io); bRC (*createFile)(bpContext *ctx, struct restore_pkt *rp); bRC (*setFileAttributes)(bpContext *ctx, struct restore_pkt *rp); + bRC (*checkFile)(bpContext *ctx, char *fname); } pFuncs; #define plug_func(plugin) ((pFuncs *)(plugin->pfuncs))