From 7bd5805c2add3c5db999638882572ce42579e8b6 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 30 Dec 2010 18:46:46 +0100 Subject: [PATCH] Add helpers to add drives in VSS snapshot from plugins --- bacula/src/plugins/fd/fd_common.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bacula/src/plugins/fd/fd_common.h b/bacula/src/plugins/fd/fd_common.h index 0fedcd6f51..5385def3ba 100644 --- a/bacula/src/plugins/fd/fd_common.h +++ b/bacula/src/plugins/fd/fd_common.h @@ -115,4 +115,32 @@ inline void operator delete[] (void *buf) #define Dmsg(context, level, message, ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, message, ##__VA_ARGS__) #define Jmsg(context, type, message, ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__) + +#ifdef USE_ADD_DRIVE +/* Keep drive letters for windows vss snapshot */ +static void add_drive(char *drives, int *nCount, char *fname) { + if (strlen(fname) >= 2 && B_ISALPHA(fname[0]) && fname[1] == ':') { + /* always add in uppercase */ + char ch = toupper(fname[0]); + /* if not found in string, add drive letter */ + if (!strchr(drives,ch)) { + drives[*nCount] = ch; + drives[*nCount+1] = 0; + (*nCount)++; + } + } +} + +/* Copy our drive list to Bacula core list */ +static void copy_drives(char *drives, char *dest) { + int last = strlen(dest); /* dest is 27 bytes long */ + for (char *p = drives; *p && last < 26; p++) { + if (!strchr(dest, *p)) { + dest[last++] = *p; + dest[last] = 0; + } + } +} +#endif + #endif -- 2.39.5