]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Don't print clock skew message in FD if less than 3 seconds diff.
authorKern Sibbald <kern@sibbald.com>
Thu, 21 Jun 2007 21:45:36 +0000 (21:45 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 21 Jun 2007 21:45:36 +0000 (21:45 +0000)
kes  Add a bit of VSS info to status client.
kes  Make a gross first cut of Vista VSS, using Win2003 code.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5062 91ce42f0-d328-0410-95d8-f526ca767f89

13 files changed:
bacula/src/filed/job.c
bacula/src/filed/status.c
bacula/src/version.h
bacula/src/win32/compat/Makefile
bacula/src/win32/compat/compat.cpp
bacula/src/win32/compat/winapi.c
bacula/src/win32/filed/Makefile
bacula/src/win32/filed/vss.cpp
bacula/src/win32/filed/vss.h
bacula/src/win32/filed/vss_W2K3.cpp
bacula/src/win32/filed/vss_generic.cpp
bacula/src/win32/winapi.h
bacula/technotes-2.1

index 4a095228125c60355e863cab00aa701209185fcd..ad0d4d68bde1b1298e56202e4ecfb7a03f006f52 100644 (file)
@@ -1217,7 +1217,8 @@ static int level_cmd(JCR *jcr)
       Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
       adj = btime_to_utime(bt_adj);
       since_time += adj;              /* adjust for clock difference */
-      if (adj != 0) {
+      /* Don't notify if time within 3 seconds */
+      if (adj > 3 || adj < -3) {
          int type;
          if (adj > 600 || adj < -600) {
             type = M_WARNING;
index 497c7cc215fd0388d2b64471f5c99efc72de9a71..00549fe0e0fba6da3024e6521d221be6dff7f30d 100644 (file)
@@ -86,7 +86,7 @@ void output_status(void sendit(const char *msg, int len, void *sarg), void *arg)
       if (!privs) {
          privs = enable_backup_privileges(NULL, 1);
       }
-      len = Mmsg(msg, "Priv 0x%x\n", privs);
+      len = Mmsg(msg, "VSS=%s Priv 0x%x\n", g_pVSSClient?"yes":"no", privs);
       sendit(msg.c_str(), len, arg);
       len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n",
                  p_OpenProcessToken?"":"!",
index fc544442a1d3d32c86171b484669b206a3d8f1bc..ddd9938c56aef7aa196e097dcb12c490c9478516 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "2.1.20"
-#define BDATE   "20 June 2007"
-#define LSMDATE "20Jun07"
+#define VERSION "2.1.21"
+#define BDATE   "21 June 2007"
+#define LSMDATE "21Jun07"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2007"       /* year for copyright messages in progs */
index 9b5f5d3c002c0607a6c218d6078a3f02af3b9288..e42f55a9b4dc4807132664a2b7807cde29e0d9e6 100644 (file)
@@ -31,7 +31,8 @@ LIB_OBJS = \
        $(OBJDIR)/print.o \
        $(OBJDIR)/vss.o \
        $(OBJDIR)/vss_XP.o \
-       $(OBJDIR)/vss_W2K3.o
+       $(OBJDIR)/vss_W2K3.o \
+       $(OBJDIR)/vss_Vista.o
 
 ######################################################################
 
index 90a4a7dbb087a2bd086d16ab1d751281f2f3847b..88918b4ba7308116f73d436b9c9f3633b3a22bbf 100644 (file)
@@ -1508,7 +1508,7 @@ winver::winver(void)
                                    osvinfo.dwMajorVersion,
                                    osvinfo.dwMinorVersion);
         snprintf(WIN_RAWVERSION, sizeof(WIN_RAWVERSION), "Windows %#08x", ver);
-         switch (ver)
+        switch (ver)
         {
         case MS_WINDOWS_95: (version =  "Windows 95"); break;
         case MS_WINDOWS_98: (version =  "Windows 98"); break;
index a723835caf560af246610b10c22b281692177bfe..ed7548338808591d6a84aa9f964c6e135320f7cd 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * Windows APIs that are different for each system.
- *   We use pointers to the entry points so that a
- *   single binary will run on all Windows systems.
- *
- *     Kern Sibbald MMIII
- */
 /*
    Bacula® - The Network Backup Solution
 
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ * Windows APIs that are different for each system.
+ *   We use pointers to the entry points so that a
+ *   single binary will run on all Windows systems.
+ *
+ *     Kern Sibbald MMIII
+ */
 
 #include "bacula.h"
 
 // init with win9x, but maybe set to NT in InitWinAPI
 DWORD g_platform_id = VER_PLATFORM_WIN32_WINDOWS;
 DWORD g_MinorVersion = 0;
+DWORD g_MajorVersion = 0;
 
 /* API Pointers */
 
@@ -95,10 +96,10 @@ InitWinAPIWrapper()
    // Get the current OS version
    if (!GetVersionEx(&osversioninfo)) {
       g_platform_id = 0;
-      g_MinorVersion = 0;
    } else {
       g_platform_id = osversioninfo.dwPlatformId;
       g_MinorVersion = osversioninfo.dwMinorVersion;
+      g_MajorVersion = osversioninfo.dwMajorVersion;
    }
 
    HMODULE hLib = LoadLibraryA("KERNEL32.DLL");
index 6e2cab8bb0a08c6d4acf03899bb0176dd28b162d..72f778f549fddaf1a02063b0c4cca2c746bb95f5 100644 (file)
@@ -42,6 +42,7 @@ FILED_OBJS = \
        $(OBJDIR)/vss.o \
        $(OBJDIR)/vss_XP.o \
        $(OBJDIR)/vss_W2K3.o \
+       $(OBJDIR)/vss_Vista.o \
        $(OBJDIR)/winabout.o \
        $(OBJDIR)/winservice.o \
        $(OBJDIR)/winstat.o \
index 7e33725ad6aa5629d2ddee20361cce65b620d609..a8a0837e9c2147bd8087a7fc43e973bb5ea81274 100644 (file)
@@ -9,7 +9,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2005-2007 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.
 
 VSSClient *g_pVSSClient;
 
+// {b5946137-7b9f-4925-af80-51abd60b20d5}
+
+static const GUID VSS_SWPRV_ProviderID =
+   { 0xb5946137, 0x7b9f, 0x4925, { 0xaf, 0x80, 0x51, 0xab, 0xd6, 0x0b, 0x20, 0xd5 } };
+
+
 void 
 VSSCleanup()
 {
-   if (g_pVSSClient)
+   if (g_pVSSClient) {
       delete (g_pVSSClient);
+   }
 }
 
-void
-VSSInit()
+void VSSInit()
 {
    /* decide which vss class to initialize */
-   switch (g_MinorVersion) {
+   if (g_MajorVersion == 5) {
+      switch (g_MinorVersion) {
       case 1: 
          g_pVSSClient = new VSSClientXP();
          atexit(VSSCleanup);
-         break;
+         return;
       case 2: 
          g_pVSSClient = new VSSClient2003();
          atexit(VSSCleanup);
-         break;
+         return;
+      }
+   /* Vista or Longhorn */
+   } else if (g_MajorVersion == 6 && g_MinorVersion == 0) {
+      /* Probably will not work */
+      g_pVSSClient = new VSSClientVista();
+      atexit(VSSCleanup);
+      return;
    }
 }
 
index 4540758004d39f3533e054cade074baaf8bc6e36..4e7c57a3dfc4e87699dadc941177dcb7ed83f7fc 100644 (file)
@@ -1,18 +1,7 @@
-/*                               -*- Mode: C -*-
- * vss.h --
- */
-//
-// Copyright transferred from MATRIX-Computer GmbH to
-//   Kern Sibbald by express permission.
-/*
- *
- * Author          : Thorsten Engel
- * Created On      : Fri May 06 21:44:00 2006 
- */
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2006-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2006-2007 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.
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*                               -*- Mode: C -*-
+ * vss.h --
+ */
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+//   Kern Sibbald by express permission.
+/*
+ *
+ * Author          : Thorsten Engel
+ * Created On      : Fri May 06 21:44:00 2006 
+ */
 
 #ifndef __VSS_H_
 #define __VSS_H_
@@ -126,6 +126,22 @@ private:
    BOOL CheckWriterStatus();
 };
 
+class VSSClientVista:public VSSClient
+{
+public:
+   VSSClientVista();
+   virtual ~VSSClientVista();
+   virtual BOOL CreateSnapshots(char* szDriveLetters);
+   virtual BOOL CloseBackup();   
+   virtual const char* GetDriverName() { return "VSS Vista"; };
+private:
+   virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore);
+   virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync*  pAsync);
+   virtual void QuerySnapshotSet(GUID snapshotSetID);
+   BOOL CheckWriterStatus();
+};
+
+
 extern VSSClient *g_pVSSClient;
 
 #endif /* WIN32_VSS */
index 68914d0f9c2d94ed9f283a2cc47b39aa5dbad80d..1c397dada77b8eccc617dd3d49c27edf8bb29701 100644 (file)
@@ -1,10 +1,10 @@
 /* 
-we need one class per OS as Microsofts API 
-differs only by calling convention and some
-function we don't use.
-
-vss_generic will handle all versions and
-switch between different headers to include.
+ * We need one class per OS as Microsofts API 
+ * differs only by calling convention and some
+ * function we don't use.
+ *
+ * vss_generic will handle all versions and
+ * switch between different headers to include.
 */
 
 #ifdef WIN32_VSS
index 2521fafe6d083cd1c84367adc41b2d12eb4a2870..3f4e8b4238ef1d35b1bb5109cb1907af96ed2c90 100644 (file)
@@ -1,15 +1,7 @@
-//                              -*- Mode: C++ -*-
-// vss.cpp -- Interface to Volume Shadow Copies (VSS)
-//
-// Copyright transferred from MATRIX-Computer GmbH to
-//   Kern Sibbald by express permission.
-//
-// Author          : Thorsten Engel
-// Created On      : Fri May 06 21:44:00 2005
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2005-2007 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.
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+//                              -*- Mode: C++ -*-
+// vss.cpp -- Interface to Volume Shadow Copies (VSS)
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+//   Kern Sibbald by express permission.
+//
+// Author          : Thorsten Engel
+// Created On      : Fri May 06 21:44:00 2005
 
 
 #ifdef WIN32_VSS
@@ -52,6 +52,18 @@ using namespace std;
 #include "ms_atl.h"
 #include <objbase.h>
 
+/* 
+ * Kludges to get Vista code to compile.             
+ *  KES - June 2007
+ */
+#define __in  IN
+#define __out OUT
+#define __RPC_unique_pointer
+#define __RPC_string
+#define __RPC__out_ecount_part(x, y)
+#define __RPC__deref_inout_opt
+#define __RPC__out
+
 #if !defined(ENABLE_NLS)
 #define setlocale(p, d)
 #endif
@@ -68,6 +80,9 @@ BOOL VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBufl
 class IXMLDOMDocument;
 #endif
 
+/* Reduce compiler warnings from Windows vss code */
+#define uuid(x)
+
 #ifdef B_VSS_XP
    #pragma message("compile VSS for Windows XP")   
    #define VSSClientGeneric VSSClientXP
@@ -75,15 +90,7 @@ class IXMLDOMDocument;
    #include "inc/WinXP/vss.h"
    #include "inc/WinXP/vswriter.h"
    #include "inc/WinXP/vsbackup.h"
-   
-   /* In VSSAPI.DLL */
-   typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
-   typedef void (APIENTRY* t_VssFreeSnapshotProperties)(IN VSS_SNAPSHOT_PROP*);
-   
-   static t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL;
-   static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
 
-   #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
 #endif
 
 #ifdef B_VSS_W2K3
@@ -93,6 +100,16 @@ class IXMLDOMDocument;
    #include "inc/Win2003/vss.h"
    #include "inc/Win2003/vswriter.h"
    #include "inc/Win2003/vsbackup.h"
+#endif
+
+#ifdef B_VSS_VISTA
+   #pragma message("compile VSS for Vista")
+   #define VSSClientGeneric VSSClientVista
+
+   #include "inc/Win2003/vss.h"
+   #include "inc/Win2003/vswriter.h"
+   #include "inc/Win2003/vsbackup.h"
+#endif
    
    /* In VSSAPI.DLL */
    typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
@@ -102,7 +119,7 @@ class IXMLDOMDocument;
    static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
 
    #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
-#endif
+
 
 #include "vss.h"
 
@@ -266,7 +283,7 @@ BOOL VSSClientGeneric::Initialize(DWORD dwContext, BOOL bDuringRestore)
       return FALSE;
    }
 
-#ifdef B_VSS_W2K3
+#if   defined(B_VSS_W2K3) || defined(B_VSS_VISTA)
    if (dwContext != VSS_CTX_BACKUP) {
       hr = ((IVssBackupComponents*) m_pVssObject)->SetContext(dwContext);
       if (FAILED(hr)) {
@@ -614,7 +631,7 @@ BOOL VSSClientGeneric::CheckWriterStatus()
             case VSS_WS_FAILED_AT_BACKUP_COMPLETE:
             case VSS_WS_FAILED_AT_PRE_RESTORE:
             case VSS_WS_FAILED_AT_POST_RESTORE:
-    #ifdef B_VSS_W2K3
+    #if  defined(B_VSS_W2K3) || defined(B_VSS_VISTA)
             case VSS_WS_FAILED_AT_BACKUPSHUTDOWN:
     #endif
                 /* failed */                
index 6098904a7849e6d304ddfc67f46932040f4686e4..72039378c6393b784efd39eaca31a0d5541bb01e 100644 (file)
@@ -73,6 +73,7 @@ int make_win32_path_UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF, BOOL* pBI
 // init with win9x, but maybe set to NT in InitWinAPI
 extern DWORD DLL_IMP_EXP g_platform_id;
 extern DWORD DLL_IMP_EXP g_MinorVersion;
+extern DWORD DLL_IMP_EXP g_MajorVersion;
 
 /* In ADVAPI32.DLL */
 typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
index a21830100da84b41a0eee71aaf01928aca18d6b8..d47a1ada9ed94426e238303b58cc719919273e28 100644 (file)
@@ -1,6 +1,12 @@
               Technical notes on version 2.1
 
 General:
+21Jun07
+kes  Don't print clock skew message in FD if less than 3 seconds diff.
+kes  Add a bit of VSS info to status client.
+kes  Make a gross first cut of Vista VSS, using Win2003 code.
+
+Release: 2.1.18 beta
 20Jun07
 kes  Fixed bug #886 (multidrive autochanger: SD doesn't use drive with
      loaded tape but uses first drive).