]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/baconfig.h
Add Raw file save/restore
[bacula/bacula] / bacula / src / baconfig.h
index 9051c754254f39b9ec80e03a14474497e14f762e..956a0ea350e20af9fd0a344adab359c228f8478d 100644 (file)
@@ -1,23 +1,27 @@
 /*
  * General header file configurations that apply to
  * all daemons.  System dependent stuff goes here.
+ *
+ *   Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001 Kern Sibbald and John Walker
+   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of
+   the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with this program; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
 
 
 /* Bacula common configuration defines */
 
-#define DEBUG 1                       /* turn on debug code */
-
 #define TRUE  1
 #define FALSE 0
 
+#ifndef ETIME
+#define ETIME ETIMEDOUT
+#endif
+
 #ifdef PROTOTYPES
 # define __PROTO(p)     p
 #else
 # define __PROTO(p)     ()
 #endif
 
-/* #define ASSERT(x) if (!(x)) Emsg1(M_ABORT, 0, "Failed ASSERT: %s\n", __STRING(x)) */
-#define ASSERT(x) if (!(x)) Emsg1(M_ABORT, 0, "Failed ASSERT: %s\n", #x)
+#ifdef DEBUG
+#define ASSERT(x) if (!(x)) { \
+   char *jcr = NULL; \
+   Emsg1(M_ERROR, 0, "Failed ASSERT: %s\n", #x); \
+   jcr[0] = 0; }
+#else
+#define ASSERT(x)
+#endif
 
+/* Allow printing of NULL pointers */
+#define NPRT(x) (x)?(x):"*None*" 
 
 #ifdef ENABLE_NLS
 #include <libintl.h>
@@ -65,7 +79,9 @@
 #define TAPE_BSIZE 1024
 #if !defined(DEV_BSIZE) && defined(BSIZE)
 #define DEV_BSIZE BSIZE
-#else 
+#endif
+
+#ifndef DEV_BSIZE
 #define DEV_BSIZE 512
 #endif
 
 #define MAX_NETWORK_BUFFER_SIZE (32 * 1024)
 
 /* Stream definitions.  Once defined these must NEVER
- * change as they go on the storage media
+ *   change as they go on the storage media.
  */
-#define STREAM_UNIX_ATTRIBUTES  1     /* Generic Unix attributes */
-#define STREAM_FILE_DATA        2     /* Standard uncompressed data */
-#define STREAM_MD5_SIGNATURE    3     /* MD5 signature for the file */
-#define STREAM_GZIP_DATA        4     /* GZip compressed file data */
+#define STREAM_UNIX_ATTRIBUTES   1    /* Generic Unix attributes */
+#define STREAM_FILE_DATA         2    /* Standard uncompressed data */
+#define STREAM_MD5_SIGNATURE     3    /* MD5 signature for the file */
+#define STREAM_GZIP_DATA         4    /* GZip compressed file data */
+#define STREAM_WIN32_ATTRIBUTES  5    /* Windows attributes (superset of Unix) */
+#define STREAM_SPARSE_DATA       6    /* Sparse data stream */
+#define STREAM_SPARSE_GZIP_DATA  7
+#define STREAM_PROGRAM_NAMES     8    /* program names for program data */
+#define STREAM_PROGRAM_DATA      9    /* Data needing program */
+
+/* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
+#define SPARSE_FADDR_SIZE (sizeof(uint64_t))
 
 
-/* This is for dumb compilers like Solaris. Linux GCC
+/* This is for dumb compilers/libraries like Solaris. Linux GCC
  * does it correctly, so it might be worthwhile
  * to remove the isascii(c) with ifdefs on such
  * "smart" systems.
  */
-#undef  ISSPACE
-#undef  ISALPHA
-#undef  ISUPPER
-#undef  ISDIGIT
-#define ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
-#define ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
-#define ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
-#define ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
+#define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
+#define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
+#define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
+#define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
 
 
 typedef void (HANDLER)();
@@ -111,6 +131,11 @@ typedef int (INTHANDLER)();
 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
 #endif
 
+/* Added by KES to deal with Win32 systems */
+#ifndef S_ISWIN32
+#define S_ISWIN32 020000
+#endif
+
 #ifndef INADDR_NONE
 #define INADDR_NONE ((unsigned long) -1)
 #endif
@@ -158,6 +183,20 @@ extern void _v(char *file, int line, pthread_mutex_t *m);
 
 #endif /* DEBUG_MUTEX */
 
+/* These probably should be subroutines */
+#define Pw(x) \
+   do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
+      e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
+           strerror(errstat)); \
+   } while(0)
+
+#define Vw(x) \
+   do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
+         e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
+           strerror(errstat)); \
+   } while(0)
+
+
 /*
  * The digit following Dmsg and Emsg indicates the number of substitutions in
  * the message string. We need to do this kludge because non-GNU compilers
@@ -174,7 +213,11 @@ extern void _v(char *file, int line, pthread_mutex_t *m);
 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
+#define Dmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+#define Dmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
+#define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
+#define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
 #else
 #define Dmsg0(lvl, msg)
 #define Dmsg1(lvl, msg, a1)
@@ -186,7 +229,28 @@ extern void _v(char *file, int line, pthread_mutex_t *m);
 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
+#define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
+#define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
 #endif /* DEBUG */
+
+
+/* Messages that are printed (uses d_msg) */
+#define Pmsg0(lvl, msg)             d_msg(__FILE__, __LINE__, lvl, msg)
+#define Pmsg1(lvl, msg, a1)         d_msg(__FILE__, __LINE__, lvl, msg, a1)
+#define Pmsg2(lvl, msg, a1, a2)     d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
+#define Pmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
+#define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
+#define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
+#define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
+#define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
+#define Pmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
+#define Pmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+#define Pmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
+#define Pmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
+#define Pmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
+#define Pmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
+#define Pmsg14(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)
+
        
 /* Daemon Error Messages that are delivered according to the message resource */
 #define Emsg0(typ, lvl, msg)             e_msg(__FILE__, __LINE__, typ, lvl, msg)
@@ -265,7 +329,30 @@ extern int thr_setconcurrency(int);
 
 #endif
 
+#ifdef HAVE_IRIX_OS
+#define socklen_t int
+#endif
+
+#ifdef HAVE_CYGWIN
+/* They don't really have it */
+#undef HAVE_GETDOMAINNAME
+#endif
+
 #define ALIGN_SIZE (sizeof(double))
 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
 
+
+/* Added by KES to deal with Win32 systems */
+#ifndef S_ISWIN32
+#define S_ISWIN32 020000
+#endif
+
+/* Replace codes needed in both file routines and non-file routines */
+/* Job replace codes -- in "replace" */
+#define REPLACE_ALWAYS   'a'
+#define REPLACE_IFNEWER  'w'
+#define REPLACE_NEVER    'n'
+#define REPLACE_IFOLDER  'o'
+
 #endif /* _BACONFIG_H */