[541] | 1 | /* my-stuff.h
|
---|
| 2 | $Id: my-stuff.h 1315 2007-04-16 14:13:59Z bruno $
|
---|
| 3 | .
|
---|
[1] | 4 |
|
---|
| 5 |
|
---|
[541] | 6 | 07/14
|
---|
| 7 | - ARCH_THREADS is now 2; buffers, 4
|
---|
| 8 |
|
---|
| 9 | 07/10
|
---|
| 10 | - added acl, xattr stuff
|
---|
| 11 |
|
---|
| 12 | 06/19
|
---|
| 13 | - added AUX_VER
|
---|
| 14 |
|
---|
| 15 | 06/14
|
---|
| 16 | - added DO_MBR_PLEASE
|
---|
| 17 |
|
---|
| 18 | 04/17
|
---|
| 19 | - replaced INTERNAL_TAPE_BLK_SIZE with g_internal_tape_block_size
|
---|
| 20 | and DEFAULT_INTERNAL_TAPE_BLOCK_SIZE
|
---|
| 21 |
|
---|
| 22 | 04/13
|
---|
| 23 | - log_msg is now calling standard_log_debug_msg, not the alias (log_debug_msg)
|
---|
| 24 |
|
---|
| 25 | 04/03/2004
|
---|
| 26 | - added star and SELINUX support
|
---|
| 27 |
|
---|
| 28 | 11/20/2003
|
---|
| 29 | - boot from isolinux.bin, not mindi-boot.2880.img
|
---|
| 30 |
|
---|
| 31 | 11/15
|
---|
| 32 | - reduced SLICE_SIZE from 8192 to 4096
|
---|
| 33 |
|
---|
| 34 | 10/08
|
---|
| 35 | - set p-i-h volsize to 1GB
|
---|
| 36 |
|
---|
| 37 | 10/21
|
---|
| 38 | - added MNT_CDROM and FREELOADER
|
---|
| 39 |
|
---|
| 40 | 10/11
|
---|
| 41 | - added DEFAULT_DVD_DISK_SIZE
|
---|
| 42 | - added PARTIMAGE_DEBUG_LEVEL
|
---|
| 43 |
|
---|
| 44 | 09/27
|
---|
| 45 | - better logging
|
---|
| 46 |
|
---|
| 47 | 09/24
|
---|
| 48 | - added MR_LOGFILE="/tmp/mondo-restore.log"
|
---|
| 49 |
|
---|
| 50 | 09/22
|
---|
| 51 | - added bool, FALSE, TRUE
|
---|
| 52 |
|
---|
| 53 | 09/20
|
---|
| 54 | - increasd PPCFG_RAMDISK_SIZE to 150
|
---|
| 55 |
|
---|
| 56 | 09/12
|
---|
| 57 | - reduced MAX_STR_LEN from 512 to 460
|
---|
| 58 |
|
---|
| 59 | 09/10
|
---|
| 60 | - moved PPCFG_RAMDISK_SIZE here
|
---|
| 61 |
|
---|
| 62 | 09/05
|
---|
| 63 | - better config.h stuff
|
---|
| 64 |
|
---|
| 65 | 06/05
|
---|
| 66 | - changed fgrep to grep
|
---|
| 67 |
|
---|
| 68 | 05/19
|
---|
| 69 | - added CP_BIN
|
---|
| 70 |
|
---|
| 71 | 05/05
|
---|
| 72 | - added #include <sys/param.h> and sys/sem.h and ioctl.h
|
---|
| 73 |
|
---|
| 74 | 05/03
|
---|
| 75 | - added kill_anything_like_this()
|
---|
| 76 |
|
---|
| 77 | 04/24/2003
|
---|
| 78 | - added *STUB #define's
|
---|
| 79 |
|
---|
| 80 | 11/22/2002
|
---|
| 81 | - added INTERNAL_TAPE_BLK_SIZE
|
---|
| 82 |
|
---|
| 83 | 10/10
|
---|
| 84 | - use #define to create XMondo-friendly log file name if appropriate
|
---|
| 85 |
|
---|
| 86 | 08/30
|
---|
| 87 | - changed ARBITRARY_MAXIMUM to 512
|
---|
| 88 |
|
---|
| 89 | 08/26
|
---|
| 90 | - set MAX_STR_LEN at 512 but halved it within many _structures_
|
---|
| 91 | - changed ARBITRARY_MAXIMUM to 128
|
---|
| 92 |
|
---|
| 93 | 08/08
|
---|
| 94 | - added '#include <signal.h>'
|
---|
| 95 | - added WELCOME_STRING
|
---|
| 96 |
|
---|
| 97 | 06/19
|
---|
| 98 | - changed tape block size from 8192 to 65536
|
---|
| 99 |
|
---|
| 100 | 04/08
|
---|
| 101 | - added manual_cd_tray flag to bkpinfo
|
---|
| 102 |
|
---|
| 103 | 03/31
|
---|
| 104 | - added restore_path to struct s_bkpinfo
|
---|
| 105 |
|
---|
| 106 | 03/21
|
---|
| 107 | - updated version# to 1.42
|
---|
| 108 |
|
---|
| 109 | 02/20
|
---|
| 110 | - added bkpinfo->using_cdstream
|
---|
| 111 |
|
---|
| 112 | 02/06
|
---|
| 113 | - added MONDO_VERSION
|
---|
| 114 |
|
---|
| 115 | 02/02
|
---|
| 116 | - added MONDO_CFG_FILE
|
---|
| 117 | - added SLICE_SIZE
|
---|
| 118 |
|
---|
| 119 | 01/31
|
---|
| 120 | - removed MINDI_HOME: it is unnecessary
|
---|
| 121 | - replaced MONDO_HOME with variable g_mondo_home
|
---|
| 122 |
|
---|
| 123 | 01/25
|
---|
| 124 | - added MONDO_HOME, MINDI_HOME
|
---|
| 125 |
|
---|
| 126 | 01/21
|
---|
| 127 | - added s_node{} structure
|
---|
| 128 |
|
---|
| 129 | 01/17
|
---|
| 130 | - added sys/shm.h, types.h, ipc.h
|
---|
| 131 |
|
---|
| 132 | 01/02/2002
|
---|
| 133 | - added that groovy bkpinfo{} stuff
|
---|
| 134 |
|
---|
| 135 | 11/29/2001
|
---|
| 136 | - added raidlist{} struct
|
---|
| 137 |
|
---|
| 138 | 08/27
|
---|
| 139 | - stuff
|
---|
[1] | 140 | */
|
---|
| 141 |
|
---|
[541] | 142 | #define HAVE_MALLOC 1
|
---|
| 143 |
|
---|
| 144 |
|
---|
[1] | 145 | // Extra info for ACLs and SELINUX users
|
---|
| 146 | #define STAR_ACL_SZ "-xfflags -acl"
|
---|
| 147 | //#define STAR_ACL_SZ "-xfflags"
|
---|
| 148 | //#define STAR_ACL_SZ ""
|
---|
| 149 | // Enable the first line and disable the second if you are a Fedora Core 2 user
|
---|
| 150 |
|
---|
| 151 | /**
|
---|
| 152 | * @file
|
---|
| 153 | * The main header file for Mondo.
|
---|
| 154 | */
|
---|
| 155 |
|
---|
| 156 | #if !defined(bool) && !defined(__cplusplus)
|
---|
| 157 | /**
|
---|
| 158 | * Create the illusion of a Boolean type.
|
---|
| 159 | */
|
---|
[541] | 160 | #define bool int
|
---|
[1] | 161 | #define TRUE 1
|
---|
| 162 | #define FALSE 0
|
---|
| 163 | #endif
|
---|
| 164 |
|
---|
[541] | 165 | #ifndef _MY_STUFF_H_
|
---|
| 166 | #define _MY_STUFF_H_
|
---|
| 167 |
|
---|
[1] | 168 | #ifdef HAVE_CONFIG_H
|
---|
| 169 | #include <config.h>
|
---|
| 170 | #endif
|
---|
| 171 |
|
---|
| 172 | #ifndef __FreeBSD__
|
---|
| 173 | #include <getopt.h>
|
---|
| 174 | #endif
|
---|
| 175 | #include <sys/types.h>
|
---|
| 176 | #include <sys/shm.h>
|
---|
| 177 | #include <sys/ipc.h>
|
---|
| 178 | #include <sys/ioctl.h>
|
---|
| 179 | #include <sys/sem.h>
|
---|
| 180 | #include <sys/param.h>
|
---|
| 181 | #include <stdio.h>
|
---|
| 182 | #include <stdlib.h>
|
---|
| 183 | #ifndef __USE_FILE_OFFSET64
|
---|
| 184 | #define __USE_FILE_OFFSET64
|
---|
| 185 | #endif
|
---|
| 186 | #ifndef __USE_LARGEFILE64
|
---|
| 187 | #define __USE_LARGEFILE64
|
---|
| 188 | #endif
|
---|
| 189 | #include <sys/stat.h>
|
---|
| 190 | #include <fcntl.h>
|
---|
| 191 | #include <errno.h>
|
---|
| 192 | #include <stddef.h>
|
---|
| 193 | #include <sys/stat.h>
|
---|
| 194 | #include <sys/wait.h>
|
---|
| 195 | #include <time.h>
|
---|
| 196 | #include <unistd.h>
|
---|
| 197 | #include <signal.h>
|
---|
[541] | 198 | //#include <curses.h>
|
---|
[1] | 199 | #include <newt.h>
|
---|
| 200 | #include <ctype.h>
|
---|
| 201 | #include <string.h>
|
---|
| 202 | #include <pthread.h>
|
---|
| 203 | #include <assert.h>
|
---|
| 204 |
|
---|
| 205 | #if defined(DEBUG) && !__cplusplus
|
---|
| 206 | int count;
|
---|
[541] | 207 | char trace_log[255]; /*buffer for logging */
|
---|
[1] | 208 | char *trace_log_ptr;
|
---|
[541] | 209 | #endif /* DEBUG */
|
---|
[1] | 210 |
|
---|
[541] | 211 | #define IA64_BOOT_SIZE "8192" /* Should be coherent with mindi */
|
---|
| 212 | #define STD_PREFIX "mondorescue" /* Should be coherent with mindi */
|
---|
[1] | 213 |
|
---|
| 214 | /**
|
---|
| 215 | * The biggielist stub (appended to the directory where all.tar.gz was unpacked).
|
---|
| 216 | */
|
---|
| 217 | #define BIGGIELIST_TXT_STUB "tmp/biggielist.txt"
|
---|
| 218 |
|
---|
| 219 | /**
|
---|
| 220 | * The filelist stub (appended to the directory where all.tar.gz was unpacked).
|
---|
| 221 | */
|
---|
| 222 | #define FILELIST_FULL_STUB "tmp/filelist.full.gz"
|
---|
| 223 |
|
---|
| 224 | /**
|
---|
| 225 | * The mountlist stub (appended to the directory where all.tar.gz was unpacked).
|
---|
| 226 | */
|
---|
| 227 | #define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt"
|
---|
| 228 |
|
---|
| 229 | /**
|
---|
| 230 | * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).
|
---|
| 231 | */
|
---|
| 232 | #define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg"
|
---|
| 233 |
|
---|
| 234 | /**
|
---|
[558] | 235 | * The RAID kernel proc file
|
---|
| 236 | */
|
---|
| 237 | #define MDSTAT_FILE "/proc/mdstat"
|
---|
| 238 |
|
---|
| 239 | /**
|
---|
[1] | 240 | * @bug Apparently unused.
|
---|
| 241 | */
|
---|
| 242 | #define MONDO_TRACEFILE "/var/log/mondo-tracefile.log"
|
---|
| 243 |
|
---|
| 244 | #undef assert
|
---|
| 245 |
|
---|
[128] | 246 | extern void _mondo_assert_fail(const char *file, const char *function,
|
---|
| 247 | int line, const char *exp);
|
---|
[1] | 248 |
|
---|
| 249 | /**
|
---|
| 250 | * An assert macro that calls _mondo_assert_fail() when it fails.
|
---|
| 251 | */
|
---|
| 252 | #ifdef NDEBUG
|
---|
| 253 | #define assert(exp) ((void)0)
|
---|
| 254 | #else
|
---|
| 255 | #define assert(exp) ((exp)?((void)0):_mondo_assert_fail(__FILE__, __FUNCTION__, __LINE__, #exp))
|
---|
| 256 | #endif
|
---|
| 257 |
|
---|
[128] | 258 | #define CRC_M16 0xA001 ///< Mask for crc16.
|
---|
| 259 | #define CRC_MTT 0x1021 ///< Mask for crc-ccitt.
|
---|
[1] | 260 |
|
---|
[541] | 261 | #define FALSE 0 ///< The ubiquitous FALSE macro.
|
---|
| 262 | #define TRUE 1 ///< The even more ubiquitous TRUE macro.
|
---|
| 263 |
|
---|
[128] | 264 | #define SCREEN_LENGTH 25 ///< The default size of the screen.
|
---|
| 265 | #define NOOF_ERR_LINES 6 ///< The number of lines of log output to keep at the bottom of the screen.
|
---|
[159] | 266 | #define ARBITRARY_MAXIMUM 2000 ///< The maximum number of items showing at once in the mountlist or filelist editor.
|
---|
[686] | 267 | #define MAX_TAPECATALOG_ENTRIES 8192 ///< The maximum number of entries in the tape catalog.
|
---|
[1236] | 268 | #define MAX_STR_LEN 384 ///< The maximum length of almost all @p char buffers in Mondo.
|
---|
| 269 | /// Note: Make this divisible by eight to avoid aligment issues
|
---|
| 270 | /// on 64bit platforms like ia64.
|
---|
[1] | 271 | #define MAXIMUM_RAID_DEVS 32 ///< The maximum number of RAID devices in the raidlist.
|
---|
[128] | 272 | #define MAXIMUM_ADDITIONAL_RAID_VARS 32 ///< The maximum number of additional RAID variables per RAID device in the raidlist.
|
---|
| 273 | #define MAXIMUM_DISKS_PER_RAID_DEV 32 ///< The maximum number of disks per RAID device in the raidtab.
|
---|
[1] | 274 |
|
---|
[128] | 275 | #define RAIDTAB_FNAME "/etc/raidtab" ///< The filename of the raidtab file, at least on Linux.
|
---|
[1] | 276 |
|
---|
[128] | 277 | #define BLK_START_OF_BACKUP 1 ///< Marker block: start a backup.
|
---|
| 278 | #define BLK_START_OF_TAPE 2 ///< Marker block: start a tape.
|
---|
| 279 | #define BLK_START_AFIOBALLS 10 ///< Marker block: start the afioball section.
|
---|
| 280 | #define BLK_STOP_AFIOBALLS 19 ///< Marker block: stop the afioball section.
|
---|
| 281 | #define BLK_START_AN_AFIO_OR_SLICE 20 ///< Marker block: start an afioball or a slice.
|
---|
| 282 | #define BLK_STOP_AN_AFIO_OR_SLICE 29 ///< Marker block: stop an afioball or a slice.
|
---|
| 283 | #define BLK_START_BIGGIEFILES 30 ///< Marker block: start the biggiefile section.
|
---|
| 284 | #define BLK_STOP_BIGGIEFILES 39 ///< Marker block: stop the biggiefile section.
|
---|
| 285 | #define BLK_START_A_NORMBIGGIE 40 ///< Marker block: start a normal biggiefile.
|
---|
[296] | 286 | #define BLK_START_A_PIHBIGGIE 41 ///< Marker block: start a ntfsprog'd biggiefile
|
---|
[128] | 287 | #define BLK_START_EXTENDED_ATTRIBUTES 45 ///< Marker block: start xattr/acl info
|
---|
| 288 | #define BLK_STOP_EXTENDED_ATTRIBUTES 46 ///< Marker block: stop xattr/acl info
|
---|
[1] | 289 | #define BLK_START_EXAT_FILE 47
|
---|
| 290 | #define BLK_STOP_EXAT_FILE 48
|
---|
[128] | 291 | #define BLK_STOP_A_BIGGIE 59 ///< Marker block: stop a biggiefile.
|
---|
| 292 | #define BLK_START_FILE 80 ///< Marker block: start a file (non-afio or slice).
|
---|
| 293 | #define BLK_STOP_FILE 89 ///< Marker block: stop a file (non-afio or slice).
|
---|
| 294 | #define BLK_END_OF_TAPE 100 ///< Marker block: end of tape.
|
---|
| 295 | #define BLK_END_OF_BACKUP 101 ///< Marker block: end of backup.
|
---|
| 296 | #define BLK_ABORTED_BACKUP 102 ///< Marker block: backup was aborted.
|
---|
[1] | 297 |
|
---|
| 298 | /// The external tape blocksize.
|
---|
| 299 | #ifdef EXTTAPE
|
---|
[128] | 300 | #define TAPE_BLOCK_SIZE (long)EXTTAPE
|
---|
[1] | 301 | #else
|
---|
[128] | 302 | #define TAPE_BLOCK_SIZE 131072L /* was 8192; 06/2002-->65536; 11/2002-->131072 */
|
---|
[1] | 303 | #endif
|
---|
| 304 |
|
---|
[128] | 305 | #define DEFAULT_INTERNAL_TAPE_BLOCK_SIZE 32768 // Nov 2003?
|
---|
[1] | 306 |
|
---|
| 307 |
|
---|
| 308 |
|
---|
| 309 |
|
---|
[128] | 310 | #define SLICE_SIZE 4096 ///< The size of a slice of a biggiefile.
|
---|
[1] | 311 |
|
---|
| 312 |
|
---|
| 313 |
|
---|
| 314 |
|
---|
| 315 |
|
---|
| 316 |
|
---|
| 317 | /**
|
---|
| 318 | * Determine whether @p x (t_bkptype) is a streaming backup.
|
---|
| 319 | */
|
---|
| 320 | #define IS_THIS_A_STREAMING_BACKUP(x) (x == tape || x == udev || x == cdstream)
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | /**
|
---|
| 324 | * @c mkisofs command to generate a nonbootable CD, except for -o option and the directory to image.
|
---|
| 325 | */
|
---|
| 326 | #define MONDO_MKISOFS_NONBOOT "mkisofs -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_"
|
---|
| 327 |
|
---|
| 328 | /**
|
---|
| 329 | * @c mkisofs command to generate a bootable CD using isolinux, except for -o option and the directory to image.
|
---|
| 330 | */
|
---|
| 331 | #define MONDO_MKISOFS_REGULAR_SYSLINUX "mkisofs -J -boot-info-table -no-emul-boot -b isolinux.bin -c boot.cat -boot-load-size 4 -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_"
|
---|
| 332 |
|
---|
| 333 | /**
|
---|
| 334 | * @c mkisofs command to generate a bootable CD using LILO, except for -o option and the directory to image.
|
---|
| 335 | */
|
---|
| 336 | // -b images/mindi-boot.2880.img
|
---|
| 337 | #define MONDO_MKISOFS_REGULAR_LILO "mkisofs -boot-info-table -no-emul-boot -b isolinux.bin -c boot.cat -boot-load-size 4 -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_"
|
---|
| 338 |
|
---|
| 339 | /**
|
---|
| 340 | * @c mkisofs command to generate a bootable CD using ELILO, except for -o option and the directory to image.
|
---|
| 341 | */
|
---|
| 342 | // -b images/mindi-boot.2880.img
|
---|
| 343 | // Should replace 8192 by IA64_BOOT_SIZE
|
---|
| 344 | #define MONDO_MKISOFS_REGULAR_ELILO "mkisofs -no-emul-boot -b images/mindi-bootroot.8192.img -c boot.cat -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_"
|
---|
| 345 |
|
---|
| 346 | /**
|
---|
| 347 | * The stub name of the temporary ISO image to create, burn, and remove.
|
---|
| 348 | */
|
---|
| 349 | #define MONDO_TMPISOS "/temporary.iso"
|
---|
| 350 |
|
---|
| 351 | /**
|
---|
| 352 | * @c growisofs command to generate a bootable DVD using isolinux, except for the directory to image.
|
---|
| 353 | */
|
---|
[542] | 354 | #define MONDO_GROWISOFS_REGULAR_SYSLINUX "growisofs -use-the-force-luke -J -no-emul-boot -boot-load-size 4 -b isolinux.bin --boot-info-table -c boot.cat -boot-load-size 4 -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_ -v"
|
---|
[1] | 355 |
|
---|
| 356 | /**
|
---|
| 357 | * @c growisofs command to generate a bootable DVD using LILO, except for the directory to image.
|
---|
[128] | 358 | */// -b images/mindi-boot.2880.img
|
---|
[542] | 359 | #define MONDO_GROWISOFS_REGULAR_ELILO "growisofs -use-the-force-luke -no-emul-boot -b images/mindi-boot.2880.img -c boot.cat -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ -v"
|
---|
[1] | 360 |
|
---|
| 361 | /**
|
---|
| 362 | * @c growisofs command to generate a bootable DVD using LILO, except for the directory to image.
|
---|
[128] | 363 | */// -b images/mindi-boot.2880.img
|
---|
[542] | 364 | #define MONDO_GROWISOFS_REGULAR_LILO "growisofs -no-emul-boot -b isolinux.bin -c boot.cat -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ -v"
|
---|
[1] | 365 |
|
---|
| 366 | /**
|
---|
| 367 | * @c growisofs command to generate a nonbootable DVD, except for the directory to image.
|
---|
| 368 | */
|
---|
[542] | 369 | #define MONDO_GROWISOFS_NONBOOT "growisofs -use-the-force-luke -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ -v"
|
---|
[1] | 370 |
|
---|
| 371 | /**
|
---|
| 372 | * Welcome string displayed at the top of the newt interface.
|
---|
| 373 | */
|
---|
[541] | 374 | #define WELCOME_STRING "W E L C O M E T O M O N D O R E S C U E"
|
---|
[1] | 375 |
|
---|
| 376 | /**
|
---|
| 377 | * The maximum length of a filename in the tape catalog.
|
---|
| 378 | */
|
---|
| 379 | #define MAX_TAPECAT_FNAME_LEN 32
|
---|
| 380 |
|
---|
| 381 | //#define strcpy(y,x) strncpy(y, x, sizeof(y)-1)
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | /**
|
---|
| 385 | * Assert that (@p x != NULL) and (@p x[0] != '\\0').
|
---|
| 386 | */
|
---|
| 387 | #define assert_string_is_neither_NULL_nor_zerolength(x) {assert(x!=NULL);assert(x[0]!='\0');}
|
---|
| 388 |
|
---|
| 389 | /**
|
---|
| 390 | * Log the file, line, Mondo error message, and OS error message (errno).
|
---|
| 391 | */
|
---|
| 392 | #define log_OS_error(x) {log_msg(0, "%s, line %ld: %s (%s)", __FILE__, __LINE__, x, strerror(errno));}
|
---|
| 393 |
|
---|
| 394 | /**
|
---|
| 395 | * Assert that (@p x != NULL).
|
---|
| 396 | */
|
---|
| 397 | #define assert_pointer_is_not_NULL(x) {assert(x!=NULL);}
|
---|
| 398 |
|
---|
| 399 | /**
|
---|
| 400 | * close() @p x and log a message if it fails.
|
---|
| 401 | */
|
---|
| 402 | #define paranoid_close(x) {if(close(x)) {log_msg(5, "close err");} x=-999; }
|
---|
| 403 |
|
---|
| 404 | /**
|
---|
| 405 | * fclose() @p x and log a message if it fails.
|
---|
| 406 | */
|
---|
| 407 | #define paranoid_fclose(x) {if(fclose(x)) {log_msg(5, "fclose err");} x=NULL; }
|
---|
| 408 |
|
---|
| 409 | /**
|
---|
| 410 | * pclose() @p x and log a message if it fails.
|
---|
| 411 | */
|
---|
| 412 | #define paranoid_pclose(x) {if(pclose(x)) {log_msg(5, "pclose err");} x=NULL; }
|
---|
| 413 |
|
---|
| 414 | /**
|
---|
| 415 | * Run the command @p x and log it if it fails.
|
---|
| 416 | */
|
---|
| 417 | #define paranoid_system(x) {if(system(x)) log_msg(4, x); }
|
---|
| 418 |
|
---|
| 419 | /**
|
---|
| 420 | * Free @p x and set it to NULL.
|
---|
| 421 | */
|
---|
[31] | 422 | #define paranoid_free(x) {if (x != NULL) free(x); x=NULL;}
|
---|
[1] | 423 |
|
---|
| 424 | /**
|
---|
| 425 | * Free variables and call finish(@p x).
|
---|
| 426 | */
|
---|
| 427 | #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) paranoid_free ( g_bkpinfo_DONTUSETHIS ); finish(x); }
|
---|
| 428 |
|
---|
| 429 | /**
|
---|
| 430 | * Log file, function, line, and @p x.
|
---|
| 431 | */
|
---|
| 432 | #define iamhere(x) {log_it("%s, %s, %ld: %s", __FILE__, __FUNCTION__, __LINE__, x);}
|
---|
| 433 |
|
---|
| 434 | /**
|
---|
| 435 | * Yes, we want malloc() to help us fix bugs.
|
---|
| 436 | */
|
---|
| 437 | #define MALLOC_CHECK_ 1
|
---|
| 438 |
|
---|
| 439 | /**
|
---|
| 440 | * Malloc @p x to be MAX_STR_LEN bytes and call fatal_error() if we're out of memory.
|
---|
| 441 | */
|
---|
[402] | 442 | #define malloc_string(x) { x = (char *)malloc(MAX_STR_LEN); if (!x) { fatal_error("Unable to malloc"); } x[0] = x[1] = '\0'; }
|
---|
[1] | 443 |
|
---|
| 444 | /**
|
---|
| 445 | * Path to the location the hard drive is mounted on during a restore.
|
---|
| 446 | */
|
---|
| 447 | #define MNT_RESTORING "/mnt/RESTORING"
|
---|
| 448 |
|
---|
| 449 | /** @def VANILLA_SCSI_CDROM The first SCSI CD-ROM in the system (most likely to be the one to write to). */
|
---|
| 450 | /** @def VANILLA_SCSI_TAPE The first SCSI tape in the system (most likely to be the one towrite to. */
|
---|
| 451 | /** @def DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE A string whose presence in a device name indicates the
|
---|
| 452 | * inability to check this device for errors in the mountlist. */
|
---|
| 453 | /** @def RAID_DEVICE_STUB The stub of a RAID device (set up RAID if we find it). */
|
---|
| 454 | /** @def SANE_FORMATS Sane formats for this OS, separated by spaces. */
|
---|
| 455 | /** @def ALT_TAPE The first IDE tape in the system. */
|
---|
| 456 | /** @def MKE2FS_OR_NEWFS @c mke2fs or @c newfs, depending on the OS. */
|
---|
| 457 | /** @def CP_BIN The GNU @c cp binary to use. */
|
---|
| 458 | #ifdef __FreeBSD__
|
---|
[128] | 459 | #define VANILLA_SCSI_CDROM "/dev/cd0"
|
---|
| 460 | #define VANILLA_SCSI_TAPE "/dev/sa0"
|
---|
| 461 | #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/vinum/"
|
---|
| 462 | #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
|
---|
| 463 | #define SANE_FORMATS "swap image msdosfs nfs ntfs raid lvm ffs ufs ext2fs"
|
---|
| 464 | #define ALT_TAPE "/dev/ast0"
|
---|
| 465 | #define MKE2FS_OR_NEWFS "newfs"
|
---|
| 466 | #define CP_BIN "gcp"
|
---|
[1] | 467 | #else
|
---|
[128] | 468 | #define VANILLA_SCSI_CDROM "/dev/scd0"
|
---|
| 469 | #define VANILLA_SCSI_TAPE "/dev/st0"
|
---|
| 470 | #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/md"
|
---|
| 471 | #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
|
---|
[141] | 472 | #define SANE_FORMATS "swap image vfat ext2 ext3 xfs vfs jfs reiserfs dos minix coda nfs ntfs hpfs raid lvm cifs"
|
---|
[128] | 473 | #define ALT_TAPE "/dev/ht0"
|
---|
| 474 | #define MKE2FS_OR_NEWFS "mke2fs"
|
---|
| 475 | #define CP_BIN "cp"
|
---|
[1] | 476 | #endif
|
---|
| 477 |
|
---|
| 478 |
|
---|
| 479 | /**
|
---|
| 480 | * The template for a filelist filename.
|
---|
| 481 | * The first argument (%s) is the tempdir and the second (%d) is the filelist number.
|
---|
| 482 | */
|
---|
| 483 | #define FILELIST_FNAME_RAW_SZ "%s/filelist.%ld"
|
---|
| 484 |
|
---|
| 485 | #define XATTR_LIST_FNAME_RAW_SZ "%s/xattr_list.%ld.gz"
|
---|
| 486 | #define XATTR_BIGGLST_FNAME_RAW_SZ "%s/xattr_list.big.gz"
|
---|
| 487 | #define ACL_LIST_FNAME_RAW_SZ "%s/acl_list.%ld.gz"
|
---|
| 488 | #define ACL_BIGGLST_FNAME_RAW_SZ "%s/acl_list.big.gz"
|
---|
| 489 |
|
---|
| 490 | /**
|
---|
| 491 | * The template for an afioball filename.
|
---|
| 492 | * The first argument (%s) is the tempdir and the second (%d) is the filelist number.
|
---|
| 493 | */
|
---|
| 494 | #define AFIOBALL_FNAME_RAW_SZ (bkpinfo->use_star)?"%s/tmpfs/%ld.star.%s":"%s/tmpfs/%ld.afio.%s"
|
---|
[128] | 495 | #define ARCH_THREADS 2 ///< The number of simultaneous threads running afio in the background.
|
---|
| 496 | #define ARCH_BUFFER_NUM (ARCH_THREADS*4) // Number of permissible queued afio files
|
---|
| 497 | #define FORTY_SPACES " " ///< 40 spaces.
|
---|
[677] | 498 | #define PPCFG_RAMDISK_SIZE 350 ///< Size of the tmpfs, in megabytes, to attempt to mount (to speed up Mondo).
|
---|
[1] | 499 |
|
---|
| 500 | #define DO_MBR_PLEASE "/tmp/DO-MBR-PLEASE"
|
---|
| 501 |
|
---|
| 502 |
|
---|
| 503 | /**
|
---|
| 504 | * Compatibility define to change log_it() calls to log_debug_msg() calls.
|
---|
| 505 | */
|
---|
| 506 | #define log_it(format, args...) log_debug_msg(2, __FILE__, __FUNCTION__, __LINE__, format, ## args)
|
---|
| 507 |
|
---|
| 508 | /**
|
---|
| 509 | * Macro to log a message along with file, line, and function information.
|
---|
| 510 | */
|
---|
| 511 | #define log_msg(level, format, args...) log_debug_msg(level, __FILE__, __FUNCTION__, __LINE__, format, ## args)
|
---|
| 512 |
|
---|
[128] | 513 | #define DEFAULT_DVD_DISK_SIZE 4380 ///< The default size (in MB) of a DVD disk, unless the user says otherwise.
|
---|
[1] | 514 |
|
---|
[128] | 515 | #define DEFAULT_DEBUG_LEVEL 4 ///< By default, don't log messages with a loglevel higher than this.
|
---|
[1] | 516 |
|
---|
[296] | 517 | #define SZ_NTFSPROG_VOLSIZE "1048576" // was 4096
|
---|
| 518 | #define NTFSPROG_PARAMS "-z0 -V" SZ_NTFSPROG_VOLSIZE " -o -b -d -g1"
|
---|
[1] | 519 |
|
---|
| 520 | #define MNT_CDROM "/mnt/cdrom"
|
---|
| 521 | #define MNT_FLOPPY "/mnt/floppy"
|
---|
| 522 |
|
---|
| 523 | #define DEFAULT_MR_LOGLEVEL 4
|
---|
| 524 |
|
---|
[128] | 525 | #endif /* _MY_STUFF_H_ */
|
---|