]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/baconfig.h
authorAlain Spineux <alain@baculasystems.com>
Tue, 12 May 2020 20:27:37 +0000 (22:27 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:18 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Jan 14 15:09:05 2020 +0100

    Add specific checks when TLS PSK is not available in SSL library

Author: Alain Spineux <alain@baculasystems.com>
Date:   Thu Dec 12 10:42:16 2019 +0100

    new "typedef int error_t"

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Sep 23 10:06:43 2019 +0200

    Add bdelete_and_null() macro

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Nov 12 11:07:04 2018 +0100

    win32: Fix #4286 about the restore of a volume root directory with the hidden & system attributes

    - Detect root directories like C:\ or C:\mount_point
      and setup st_rdev=WIN32_ROOT_POINT to tell restore to not restore
      the hidden and system attributes
    - Be aware that there is 2 different "directories" (1) the parent
      directory like c:\mount_point and (2) the root directory of the volume
      that your are attaching to the parent. The attributes that you see is
      the attribute of (1) but for drive letters, their is no (1) then
      you see always (2) (that are hidden and system).
      When VSS snapshot is used

Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Jun 13 15:43:41 2018 +0200

    memory cleanup critical changes

Author: Alain Spineux <alain@baculasystems.com>
Date:   Sat Apr 28 07:42:58 2018 +0200

    win32: Rewrite of the stat() and reparse point detection

    - combine all stat() functions
    - statDir() i& stat2() are not used anymore
    - adjuste find_one for directory symlink

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Mar 26 17:26:27 2018 +0200

    win32: Add norm_wchar_win32_path()

Author: Alain Spineux <alain@baculasystems.com>
Date:   Fri Jun 2 15:55:19 2017 +0200

    dedup: add scrub

Author: Alain Spineux <alain@baculasystems.com>
Date:   Thu Apr 13 14:43:18 2017 +0200

    dedup: add Tmsg() DDEERR_MSG & VACERR_MSG level

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Jan 5 09:14:00 2017 +0100

    Change volume type for dedup volumes

Author: Alain Spineux <alain@baculasystems.com>
Date:   Thu Aug 11 17:44:39 2016 +0200

    dedup: use TmsgX(DDE_MSG, ) for critical messages related to DDE

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Mar 22 10:24:39 2016 +0100

    dedup: add extra DDE and vacuum logging using Tmsg

    - add some logging using TmsgX()
    - move minor errors accounting from dedupengine->vacuum_err
      dedupengine->{vacuum_err_bad_ref,vacuum_err_bad_addr}

Author: Kern Sibbald <kern@sibbald.com>
Date:   Thu Nov 1 20:36:46 2012 +0100

    Add ASSERT2 with message put in traceback

bacula/src/baconfig.h

index e8a90da462832cb0962dfbd881fd991e5a37bf23..87fc0c24cb0caa91f86b4531057f75715c26d1f3 100644 (file)
 
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
+/**
  * General header file configurations that apply to
  * all daemons.  System dependent stuff goes here.
+ *
  */
 
 
 #define FALSE 0
 
 #ifdef HAVE_TLS
-#define have_tls 1
+ #define have_tls 1
+ #ifdef HAVE_TLS_PSK
+   #define tls_psk_default 1
+ #else
+  #define tls_psk_default 0
+ #endif
 #else
-#define have_tls 0
+ #define have_tls 0
+ #define tls_psk_default 0
 #endif
 
 #ifndef ETIME
 
 #ifdef DEBUG
 #define ASSERT(x) if (!(x)) { \
-   char *tjcr = NULL; \
+   char *jcr = NULL; \
    Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
    Pmsg1(000, _("Failed ASSERT: %s\n"), #x); \
-   tjcr[0] = 0; }
+   jcr[0] = 0; }
 
 #define ASSERT2(x,y) if (!(x)) { \
    set_assert_msg(__FILE__, __LINE__, y); \
    Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
    Pmsg1(000, _("Failed ASSERT: %s\n"), #x); \
-   char *tjcr = NULL; \
-   tjcr[0] = 0; }
+   char *jcr = NULL; \
+   jcr[0] = 0; }
 #else
 #define ASSERT(x)
 #define ASSERT2(x, y)
 #define ASSERTD(x, y)
 #endif
 
+/* Until DDE has its own logging, use Tmsg, with following debug levels */
+#define DDE_MSG 0
+#define VACUUM_MSG 0
+#define DDEERR_MSG 0
+#define VACERR_MSG 0
+#define SCRUB_MSG 0
+#define SCRUBERR_MSG 0
+
 /* Allow printing of NULL pointers */
 #define NPRT(x) (x)?(x):_("*None*")
 #define NPRTB(x) (x)?(x):""
 
-#if defined(HAVE_WIN32)
-
-#define WIN32_REPARSE_POINT  1   /* Can be any number of "funny" directories except the next two */
+/* stored in statp.st_rdev */
+#define WIN32_REPARSE_NONE   0   /* Not a reparse point */
+#define WIN32_REPARSE_POINT  1   /* Can be any reparse point except one of the following */
 #define WIN32_MOUNT_POINT    2   /* Directory link to Volume */
 #define WIN32_JUNCTION_POINT 3   /* Directory link to a directory */
+#define WIN32_SYMLINK_POINT  4   /* A Symlink to a file OR a directory */
+#define WIN32_ROOT_POINT     5   /* Root of a volume, like C: */
+
+#if defined(HAVE_WIN32)
 
 /* Reduce compiler warnings from Windows vss code */
 #define uuid(x)
@@ -236,10 +255,12 @@ enum {
    B_VTL_DEV =  7,                    /* Virtual tape library device */
    B_ADATA_DEV = 8,                   /* Aligned data Data file */
    B_ALIGNED_DEV = 9,                 /* Aligned data Meta file */
+   B_DEDUP_OLD_DEV = 10,              /* Old Deduplication device */
    B_NULL_DEV  = 11,                  /* /dev/null for testing */
    B_VALIGNED_DEV = 12,               /* Virtual for Aligned device (not stored) */
    B_VDEDUP_DEV = 13,                 /* Virtual for Dedup device (not stored) */
-   B_CLOUD_DEV  = 14                  /* New Cloud device type (available in 8.8) */
+   B_CLOUD_DEV  = 14,                 /* New Cloud device type (available in 8.8) */
+   B_DEDUP_DEV  = 15                  /* New Deduplication Device (do not split ref records) */
 };
 
 /**
@@ -582,7 +603,8 @@ void t_msg(const char *file, int line, int64_t level, const char *fmt,...);
 #endif
 
 /** Macro to simplify free/reset pointers */
-#define bfree_and_null(a) do{if(a){free(a); (a)=NULL;}} while(0)
+#define bfree_and_null(a) do{if(a){bfree(a); (a)=NULL;}} while(0)
+#define bdelete_and_null(a) do{if(a){delete a; (a)=NULL;}} while(0)
 
 /**
  * Replace codes needed in both file routines and non-file routines
@@ -625,6 +647,7 @@ void t_msg(const char *file, int line, int64_t level, const char *fmt,...);
 #define PathSeparatorCur ".\\"
 
 inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; }
+inline bool IsWPathSeparator(wchar_t ch) { return ch == L'/' || ch == L'\\'; }
 inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); }
 inline const char *first_path_separator(const char *path) { return strpbrk(path, "/\\"); }
 
@@ -749,4 +772,14 @@ static inline bool bigendian() { return htonl(1) == 1L; }
 # define CHECK_FORMAT(fun, f, a)
 #endif
 
+/* error_t is a type that can be used for the return value of functions to tell
+ * the developer how to handle the result
+ * value == 0 : means no error
+ * value > 0 : are for expected or controlled conditions, like to notify that
+ *             the end of file is reached or that the last element has been processed
+ * value < 0 : are for exceptional or unexpected errors like memory allocation
+ *             failures or failing open("/dev/null"), ....
+ */
+typedef int error_t;
+
 #endif /* _BACONFIG_H */