2 Bacula® - The Network Backup Solution
4 Copyright (C) 2010-2010 Bacula Systems(R) SA
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can modify it under the terms of
9 version three of the GNU Affero General Public License as published by the Free
10 Software Foundation, which is listed in the file LICENSE.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Affero General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 Bacula® is a registered trademark of Kern Sibbald.
23 Bacula Systems(R) is a trademark of Bacula Systems SA.
24 Bacula Enterprise(TM) is a trademark of Bacula Systems SA.
26 The licensor of Bacula Enterprise(TM) is Bacula Systems(R) SA,
27 Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland.
30 /* You can include this file to your plugin to have
31 * access to some common tools and utilities provided by Bacula
37 #define JT_BACKUP 'B' /* Backup Job */
38 #define JT_RESTORE 'R' /* Restore Job */
40 #define L_FULL 'F' /* Full backup */
41 #define L_INCREMENTAL 'I' /* since last backup */
42 #define L_DIFFERENTIAL 'D' /* since last full backup */
45 # if defined(BUILDING_DLL)
46 # define DLL_IMP_EXP __declspec(dllexport)
47 # elif defined(USING_DLL)
48 # define DLL_IMP_EXP __declspec(dllimport)
54 DLL_IMP_EXP void *sm_malloc(const char *fname, int lineno, unsigned int nbytes);
55 DLL_IMP_EXP void sm_free(const char *file, int line, void *fp);
56 DLL_IMP_EXP void *reallymalloc(const char *fname, int lineno, unsigned int nbytes);
57 DLL_IMP_EXP void reallyfree(const char *file, int line, void *fp);
58 DLL_IMP_EXP void sm_check(const char *fname, int lineno, bool dump);
61 # define bmalloc(s) sm_malloc(__FILE__, __LINE__, (s))
62 # define bfree(o) sm_free(__FILE__, __LINE__, (o))
65 #define SM_CHECK sm_check(__FILE__, __LINE__, false)
72 #define malloc(s) sm_malloc(__FILE__, __LINE__, (s))
73 #define free(o) sm_free(__FILE__, __LINE__, (o))
75 inline void *operator new(size_t size, char const * file, int line)
77 void *pnew = sm_malloc(file,line, size);
78 memset((char *)pnew, 0, size);
82 inline void *operator new[](size_t size, char const * file, int line)
84 void *pnew = sm_malloc(file, line, size);
85 memset((char *)pnew, 0, size);
89 inline void *operator new(size_t size)
91 void *pnew = sm_malloc(__FILE__, __LINE__, size);
92 memset((char *)pnew, 0, size);
96 inline void *operator new[](size_t size)
98 void *pnew = sm_malloc(__FILE__, __LINE__, size);
99 memset((char *)pnew, 0, size);
103 #define new new(__FILE__, __LINE__)
105 inline void operator delete(void *buf)
107 sm_free( __FILE__, __LINE__, buf);
110 inline void operator delete[] (void *buf)
112 sm_free(__FILE__, __LINE__, buf);
115 #define Dmsg(context, level, message, ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, message, ##__VA_ARGS__)
116 #define Jmsg(context, type, message, ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__)