From 0aa656eea2293b8452c65a0311408d9ca7fe6cd9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 10 Sep 2008 08:55:55 +0000 Subject: [PATCH] kes Enable Win32 plugin load code in lib. kes Make Verify code that computes disk checksums use the same algorithm as backup when dealing with sparse files. kes Attempt to run VSS on any systems newer than Vista -- should make it work on Windows Server 2008. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7580 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/verify.c | 23 +++++++++++++++++++++-- bacula/src/lib/plugins.c | 8 ++++---- bacula/src/lib/plugins.h | 2 -- bacula/technotes-2.5 | 9 +++++++-- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index 6c3171f120..54971ccdd9 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -333,13 +333,32 @@ int digest_file(JCR *jcr, FF_PKT *ff_pkt, DIGEST *digest) * Read message digest of bfd, updating digest * In case of errors we need the job control record and file name. */ -int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr) +static int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr) { char buf[DEFAULT_NETWORK_BUFFER_SIZE]; int64_t n; + int64_t bufsiz = (int64_t)sizeof(buf); + FF_PKT *ff_pkt = (FF_PKT *)jcr->ff; + uint64_t fileAddr = 0; /* file address */ + Dmsg0(50, "=== read_digest\n"); - while ((n=bread(bfd, buf, sizeof(buf))) > 0) { + while ((n=bread(bfd, buf, bufsiz)) > 0) { + /* Check for sparse blocks */ + if (ff_pkt->flags & FO_SPARSE) { + bool haveBlock = true; + if (n == bufsiz && + fileAddr+n < (uint64_t)ff_pkt->statp.st_size || + ((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) && + (uint64_t)ff_pkt->statp.st_size == 0)) { + haveBlock = !is_buf_zero(buf, bufsiz); + } + fileAddr += n; /* update file address */ + if (!haveBlock) { + continue; /* skip block of zeros */ + } + } + crypto_digest_update(digest, (uint8_t *)buf, n); jcr->JobBytes += n; jcr->ReadBytes += n; diff --git a/bacula/src/lib/plugins.c b/bacula/src/lib/plugins.c index 786f9ea682..1c60be7cf4 100644 --- a/bacula/src/lib/plugins.c +++ b/bacula/src/lib/plugins.c @@ -58,7 +58,7 @@ Plugin *new_plugin() bool load_plugins(void *binfo, void *bfuncs, const char *plugin_dir, const char *type) { bool found = false; -#ifndef HAVE_WIN32 +//#ifndef HAVE_WIN32 t_loadPlugin loadPlugin; Plugin *plugin; DIR* dp = NULL; @@ -153,7 +153,7 @@ get_out: if (dp) { closedir(dp); } -#endif +//#endif return found; } @@ -162,7 +162,7 @@ get_out: */ void unload_plugins() { -#ifndef HAVE_WIN32 +//#ifndef HAVE_WIN32 Plugin *plugin; if (!plugin_list) { @@ -179,5 +179,5 @@ void unload_plugins() } delete plugin_list; plugin_list = NULL; -#endif +//#endif } diff --git a/bacula/src/lib/plugins.h b/bacula/src/lib/plugins.h index ae60f8328d..be08be9659 100644 --- a/bacula/src/lib/plugins.h +++ b/bacula/src/lib/plugins.h @@ -34,9 +34,7 @@ #define __PLUGINS_H #include "bacula.h" -#ifndef HAVE_WIN32 #include -#endif #ifdef HAVE_DIRENT_H #include #define NAMELEN(dirent) (strlen((dirent)->d_name)) diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 57aa818d42..4829148bcf 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -62,8 +62,13 @@ remove reader/writer in FOPTS???? General: 09Sep08 +kes Enable Win32 plugin load code in lib. +kes Make Verify code that computes disk checksums use the same + algorithm as backup when dealing with sparse files. +kes Attempt to run VSS on any systems newer than Vista -- should + make it work on Windows Server 2008. ebl Change the new statistic implementation. Remove the UseStatistic - directive and add a "update stats [days=...]" command. You can + directive and add a 'update stats [days=...]' command. You can now decide when copy job records from Job table to JobStat. Statistics are much more accurate with this. 08Sep08 @@ -282,7 +287,7 @@ kes Fix bug where SD did not ask operator if the device could not kes Add dbuser to DIR conf file (replaces user). kes Add --with-db-password to ./configure kes Fix regress to handle db_password. -ebl Add new "status storage slots" that list autochanger +ebl Add new 'status storage slots' that list autochanger content. ebl Update vtape driver to compile only under Linux. ebl Fix a bug when restoring with a wrong mediatype. -- 2.39.5