From: Eric Bollengier Date: Thu, 30 Dec 2010 17:46:46 +0000 (+0100) Subject: Add helpers to add drives in VSS snapshot from plugins X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7bd5805c2add3c5db999638882572ce42579e8b6;p=bacula%2Fbacula Add helpers to add drives in VSS snapshot from plugins --- 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