| 1 | /***************************************************************************
|
|---|
| 2 | * $Id: mondostructures.h 1079 2007-01-28 16:58:18Z bruno $
|
|---|
| 3 | *
|
|---|
| 4 | * @file
|
|---|
| 5 | * The header file defining all of Mondo's structures.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | /* @def MAX_NOOF_MEDIA The maximum number of media that can be used in any one backup. */
|
|---|
| 10 |
|
|---|
| 11 | /* So we can override it in config.h: */
|
|---|
| 12 | //#ifndef MAX_NOOF_MEDIA
|
|---|
| 13 | #define MAX_NOOF_MEDIA 50
|
|---|
| 14 | //#endif
|
|---|
| 15 |
|
|---|
| 16 | /**
|
|---|
| 17 | * Structure indicating one entry in the mountlist.
|
|---|
| 18 | * There is one mountlist_line for each device we're keeping track of in the mountlist.
|
|---|
| 19 | */
|
|---|
| 20 | struct mountlist_line {
|
|---|
| 21 | /**
|
|---|
| 22 | * The name of the device (/dev entry) for this mountlist line. Guaranteed to be unique.
|
|---|
| 23 | */
|
|---|
| 24 | char device[64];
|
|---|
| 25 |
|
|---|
| 26 | /**
|
|---|
| 27 | * The mountpoint for this mountlist line. Should be unique.
|
|---|
| 28 | * This can be "raid", for a RAID subdisk, or "lvm", for an LVM PV.
|
|---|
| 29 | */
|
|---|
| 30 | char mountpoint[256];
|
|---|
| 31 |
|
|---|
| 32 | /**
|
|---|
| 33 | * The filesystem type of this entry. Examples: ext2, ext3, reiserfs, xfs, swap.
|
|---|
| 34 | * Also, this can be "raid", for a RAID subdisk, or "lvm", for an LVM PV.
|
|---|
| 35 | */
|
|---|
| 36 | char format[64];
|
|---|
| 37 |
|
|---|
| 38 | /**
|
|---|
| 39 | * The size in kilobytes of this device. 0 or -1 indicates LVM.
|
|---|
| 40 | */
|
|---|
| 41 | long long size;
|
|---|
| 42 |
|
|---|
| 43 | /**
|
|---|
| 44 | * For ext2 and ext3, this is the filesystem label (if there is one). If not, this should be "".
|
|---|
| 45 | */
|
|---|
| 46 | char label[256];
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | /**
|
|---|
| 50 | * The mountlist structure.
|
|---|
| 51 | * This is used to keep track of a list of all the devices/partitions/formats/sizes/labels in the
|
|---|
| 52 | * system, so we can recreate them in a nuke restore.
|
|---|
| 53 | */
|
|---|
| 54 | struct mountlist_itself {
|
|---|
| 55 | /**
|
|---|
| 56 | * Number of entries in the mountlist.
|
|---|
| 57 | */
|
|---|
| 58 | int entries;
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | * The list of entries, all @p entries of them.
|
|---|
| 62 | */
|
|---|
| 63 | struct mountlist_line el[MAX_TAPECATALOG_ENTRIES];
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 | /**
|
|---|
| 67 | * A structure which holds references to elements of the mountlist.
|
|---|
| 68 | * This is used in resize_drive_proportionately_to_fit_new_drives() to
|
|---|
| 69 | * ensure accurate resizing.
|
|---|
| 70 | */
|
|---|
| 71 | struct mountlist_reference {
|
|---|
| 72 | /**
|
|---|
| 73 | * The number of entries in the list of mountlist references.
|
|---|
| 74 | */
|
|---|
| 75 | int entries;
|
|---|
| 76 |
|
|---|
| 77 | /**
|
|---|
| 78 | * The array of mountlist_line, allocated on demand.
|
|---|
| 79 | */
|
|---|
| 80 | struct mountlist_line **el;
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | /**
|
|---|
| 84 | * A line in @p additional_raid_variables.
|
|---|
| 85 | */
|
|---|
| 86 | struct raid_var_line {
|
|---|
| 87 | /**
|
|---|
| 88 | * The label for this RAID variable.
|
|---|
| 89 | */
|
|---|
| 90 | char *label;
|
|---|
| 91 |
|
|---|
| 92 | /**
|
|---|
| 93 | * The value for this RAID variable.
|
|---|
| 94 | */
|
|---|
| 95 | char *value;
|
|---|
| 96 | };
|
|---|
| 97 |
|
|---|
| 98 | /**
|
|---|
| 99 | * The additional RAID variables structure.
|
|---|
| 100 | * This is used to store a list of additional variables to be put in the raidtab,
|
|---|
| 101 | * to allow users to use (new) features of RAID which Mondo doesn't (yet) support directly.
|
|---|
| 102 | * Each @p raid_device_record has one.
|
|---|
| 103 | */
|
|---|
| 104 | struct additional_raid_variables {
|
|---|
| 105 | /**
|
|---|
| 106 | * The number of entries in the list.
|
|---|
| 107 | */
|
|---|
| 108 | int entries;
|
|---|
| 109 |
|
|---|
| 110 | /**
|
|---|
| 111 | * The list of entries, all @p entries of them.
|
|---|
| 112 | */
|
|---|
| 113 | struct raid_var_line el[MAXIMUM_ADDITIONAL_RAID_VARS];
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 | /**
|
|---|
| 117 | * One disk in a @p list_of_disks.
|
|---|
| 118 | */
|
|---|
| 119 | struct s_disk {
|
|---|
| 120 | #ifdef __FreeBSD__
|
|---|
| 121 | /**
|
|---|
| 122 | * The name of this disk. If blank it will eventually get filled in automatically.
|
|---|
| 123 | */
|
|---|
| 124 | char name[64];
|
|---|
| 125 | #endif
|
|---|
| 126 | /**
|
|---|
| 127 | * The device this entry describes.
|
|---|
| 128 | */
|
|---|
| 129 | char device[64];
|
|---|
| 130 |
|
|---|
| 131 | /**
|
|---|
| 132 | * Index number of this entry in the whole disklist.
|
|---|
| 133 | */
|
|---|
| 134 | int index;
|
|---|
| 135 |
|
|---|
| 136 | /**
|
|---|
| 137 | * Type of disk.
|
|---|
| 138 | */
|
|---|
| 139 | char type; // ' ' = data (default), S = spare, F = faulty
|
|---|
| 140 |
|
|---|
| 141 | };
|
|---|
| 142 |
|
|---|
| 143 | /**
|
|---|
| 144 | * A list of @p s_disk. Every @p raid_device_record has four.
|
|---|
| 145 | */
|
|---|
| 146 | struct list_of_disks {
|
|---|
| 147 | /**
|
|---|
| 148 | * The number of entries in the disklist.
|
|---|
| 149 | */
|
|---|
| 150 | int entries;
|
|---|
| 151 |
|
|---|
| 152 | /**
|
|---|
| 153 | * The entries themselves, all @p entries of them.
|
|---|
| 154 | */
|
|---|
| 155 | struct s_disk el[MAXIMUM_DISKS_PER_RAID_DEV];
|
|---|
| 156 | };
|
|---|
| 157 |
|
|---|
| 158 | /**
|
|---|
| 159 | * A type of media we're backing up to.
|
|---|
| 160 | */
|
|---|
| 161 | typedef enum { none = 0, ///< No type has been set yet.
|
|---|
| 162 | iso, ///< Back up to ISO images.
|
|---|
| 163 | cdr, ///< Back up to recordable CDs (do not erase them).
|
|---|
| 164 | cdrw, ///< Back up to CD-RWs and blank them first.
|
|---|
| 165 | dvd, ///< Back up to DVD+R[W] or DVD-R[W] disks.
|
|---|
| 166 | cdstream, ///< Back up to recordable CDs but treat them like a tape streamer.
|
|---|
| 167 | nfs, ///< Back up to an NFS mount on the local subnet.
|
|---|
| 168 | tape, ///< Back up to tapes.
|
|---|
| 169 | usb, ///< Back up to USB devices.
|
|---|
| 170 | udev ///< Back up to another unsupported device; just send a stream of bytes.
|
|---|
| 171 | } t_bkptype;
|
|---|
| 172 |
|
|---|
| 173 | /**
|
|---|
| 174 | * A type of file in the catalog of recent archives.
|
|---|
| 175 | */
|
|---|
| 176 | typedef enum { other, ///< Some other kind of file.
|
|---|
| 177 | fileset, ///< An afioball (fileset), optionally compressed.
|
|---|
| 178 | biggieslice ///< A slice of a biggiefile, optionally compressed.
|
|---|
| 179 | } t_archtype;
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | #ifdef __FreeBSD__
|
|---|
| 183 |
|
|---|
| 184 | struct vinum_subdisk {
|
|---|
| 185 | char which_device[64];
|
|---|
| 186 | };
|
|---|
| 187 |
|
|---|
| 188 | struct vinum_plex {
|
|---|
| 189 | int raidlevel;
|
|---|
| 190 | int stripesize;
|
|---|
| 191 | int subdisks;
|
|---|
| 192 | struct vinum_subdisk sd[MAXIMUM_RAID_DEVS];
|
|---|
| 193 | };
|
|---|
| 194 |
|
|---|
| 195 | struct vinum_volume {
|
|---|
| 196 | char volname[64];
|
|---|
| 197 | int plexes;
|
|---|
| 198 | struct vinum_plex plex[9];
|
|---|
| 199 | };
|
|---|
| 200 |
|
|---|
| 201 | struct raidlist_itself {
|
|---|
| 202 | int entries;
|
|---|
| 203 | struct list_of_disks spares;
|
|---|
| 204 | struct list_of_disks disks;
|
|---|
| 205 | struct vinum_volume el[MAXIMUM_RAID_DEVS];
|
|---|
| 206 | };
|
|---|
| 207 |
|
|---|
| 208 | #else
|
|---|
| 209 |
|
|---|
| 210 | /**
|
|---|
| 211 | * A RAID device in the raidlist.
|
|---|
| 212 | */
|
|---|
| 213 | struct raid_device_record {
|
|---|
| 214 | /**
|
|---|
| 215 | * The name of the RAID device (e.g. /dev/md0).
|
|---|
| 216 | */
|
|---|
| 217 | char *raid_device;
|
|---|
| 218 |
|
|---|
| 219 | /**
|
|---|
| 220 | * The RAID level (-1 to 5) we're using.
|
|---|
| 221 | */
|
|---|
| 222 | int raid_level;
|
|---|
| 223 |
|
|---|
| 224 | /**
|
|---|
| 225 | * Whether the disk has a persistent superblock.
|
|---|
| 226 | */
|
|---|
| 227 | int persistent_superblock;
|
|---|
| 228 |
|
|---|
| 229 | /**
|
|---|
| 230 | * The chunk size of this RAID device.
|
|---|
| 231 | */
|
|---|
| 232 | int chunk_size;
|
|---|
| 233 |
|
|---|
| 234 | /**
|
|---|
| 235 | * The parity algorithm of this RAID device. (RAID5 only)
|
|---|
| 236 | */
|
|---|
| 237 | int parity; // 0=left-asymmetric, 1=right-asymmetric, 2=left-symmetric, 3=right-symmetric
|
|---|
| 238 |
|
|---|
| 239 | /**
|
|---|
| 240 | * A list of the disks to use for storing data.
|
|---|
| 241 | */
|
|---|
| 242 | struct list_of_disks data_disks;
|
|---|
| 243 |
|
|---|
| 244 | /**
|
|---|
| 245 | * A list of the disks to use as "hot spares" in case one dies.
|
|---|
| 246 | */
|
|---|
| 247 | struct list_of_disks spare_disks;
|
|---|
| 248 |
|
|---|
| 249 | /**
|
|---|
| 250 | * A list of the disks to use for storing parity information.
|
|---|
| 251 | */
|
|---|
| 252 | struct list_of_disks parity_disks;
|
|---|
| 253 |
|
|---|
| 254 | /**
|
|---|
| 255 | * A list of the disks in this RAID device that have failed\. Rare.
|
|---|
| 256 | */
|
|---|
| 257 | struct list_of_disks failed_disks;
|
|---|
| 258 |
|
|---|
| 259 | /**
|
|---|
| 260 | * The additional RAID variables for this device.
|
|---|
| 261 | */
|
|---|
| 262 | struct additional_raid_variables additional_vars;
|
|---|
| 263 |
|
|---|
| 264 | /**
|
|---|
| 265 | * Resync progress for this device.
|
|---|
| 266 | */
|
|---|
| 267 | int progress;
|
|---|
| 268 | };
|
|---|
| 269 |
|
|---|
| 270 | /**
|
|---|
| 271 | * The list of RAID devices.
|
|---|
| 272 | * This is intended to be used along with the mountlist, and it can be
|
|---|
| 273 | * directly loaded from/saved to raidtab format.
|
|---|
| 274 | */
|
|---|
| 275 | struct raidlist_itself {
|
|---|
| 276 | /**
|
|---|
| 277 | * The number of entries in the list.
|
|---|
| 278 | */
|
|---|
| 279 | int entries;
|
|---|
| 280 |
|
|---|
| 281 | /**
|
|---|
| 282 | * The RAID devices in the raidlist, all @p entries of them.
|
|---|
| 283 | */
|
|---|
| 284 | struct raid_device_record el[MAXIMUM_RAID_DEVS];
|
|---|
| 285 | };
|
|---|
| 286 |
|
|---|
| 287 | #endif
|
|---|
| 288 |
|
|---|
| 289 | /**
|
|---|
| 290 | * The backup information structure.
|
|---|
| 291 | *
|
|---|
| 292 | * This is the central structure to all the activity going on inside Mondo.
|
|---|
| 293 | * It is passed to almost every function that is not just a helper, even those
|
|---|
| 294 | * which only use one variable of it, because it is useful keeping all the information
|
|---|
| 295 | * together in one place. The usage of particular fields in the bkpinfo is marked in
|
|---|
| 296 | * function documentation, but it is best to fill out as many fields as apply, because
|
|---|
| 297 | * that function may in turn pass the bkpinfo to other functions which use other fields.
|
|---|
| 298 | *
|
|---|
| 299 | * To fill out the bkpinfo first call reset_bkpinfo() and pre_param_configuration(). Then set
|
|---|
| 300 | * the backup-specific parameters (see mondo/mondoarchive/mondo-cli.c-\>process_switches for
|
|---|
| 301 | * an example). After that, you should call post_param_configuration() to set some final
|
|---|
| 302 | * parameters based on those you have already set. Failure to do the last step will result in
|
|---|
| 303 | * extremely strange and hard-to-track errors in chop_filelist(), since optimal_set_size is 0.
|
|---|
| 304 | */
|
|---|
| 305 | struct s_bkpinfo {
|
|---|
| 306 |
|
|---|
| 307 | /**
|
|---|
| 308 | * Pointer to the configuration structure
|
|---|
| 309 | */
|
|---|
| 310 | struct s_mr_conf *mr_conf;
|
|---|
| 311 |
|
|---|
| 312 | /**
|
|---|
| 313 | * The device we're backing up to.
|
|---|
| 314 | * If backup_media_type is @b cdr, @b cdrw, or @b cdstream, this should be the SCSI node (e.g. 0,1,0).
|
|---|
| 315 | * If backup_media_type is @b dvd, @b tape, @b usb or @b udev, this should be a /dev entry.
|
|---|
| 316 | * If backup_media_type is anything else, this should be blank.
|
|---|
| 317 | */
|
|---|
| 318 | char *media_device;
|
|---|
| 319 |
|
|---|
| 320 | /**
|
|---|
| 321 | * An array containing the sizes of each media in our backup set, in MB.
|
|---|
| 322 | * For example, media 1's size would be stored in media_size[1].
|
|---|
| 323 | * Element 0 is unused.
|
|---|
| 324 | * If the size should be autodetected, make it -1 (preferable) or 0.
|
|---|
| 325 | * @bug This should probably be only one variable, not an array.
|
|---|
| 326 | */
|
|---|
| 327 | long media_size[MAX_NOOF_MEDIA + 1];
|
|---|
| 328 |
|
|---|
| 329 | /**
|
|---|
| 330 | * The boot loader that is installed. Available choices are:
|
|---|
| 331 | * - 'G' for GRUB
|
|---|
| 332 | * - 'L' for LILO
|
|---|
| 333 | * - 'E' for ELILO
|
|---|
| 334 | * - (FreeBSD only) 'B' for boot0
|
|---|
| 335 | * - (FreeBSD only) 'D' for dangerously dedicated
|
|---|
| 336 | * - 'R' for Raw
|
|---|
| 337 | * - 'U' for Unknown or None
|
|---|
| 338 | *
|
|---|
| 339 | * The function which_boot_loader() can help you set this.
|
|---|
| 340 | */
|
|---|
| 341 | char boot_loader;
|
|---|
| 342 |
|
|---|
| 343 | /**
|
|---|
| 344 | * The boot device on which @p boot_loader is installed.
|
|---|
| 345 | * This is a bit difficult to autodetect; you may want
|
|---|
| 346 | * to take truncate_to_drive_name() of where_is_root_mounted().
|
|---|
| 347 | */
|
|---|
| 348 | char *boot_device;
|
|---|
| 349 |
|
|---|
| 350 | /**
|
|---|
| 351 | * The compression program to use. Currently supported
|
|---|
| 352 | * choices are lzop and bzip2; gzip may also work. This is ignored if
|
|---|
| 353 | * compression_level is 0.
|
|---|
| 354 | */
|
|---|
| 355 | char *zip_exe;
|
|---|
| 356 |
|
|---|
| 357 | /**
|
|---|
| 358 | * The extension your compression program uses. lzop uses lzo, bzip uses
|
|---|
| 359 | * bz2, gzip uses gz, etc. Do not include the dot.
|
|---|
| 360 | */
|
|---|
| 361 | char *zip_suffix;
|
|---|
| 362 |
|
|---|
| 363 | /**
|
|---|
| 364 | * Devices to back up as biggiefiles.
|
|---|
| 365 | *
|
|---|
| 366 | * This is useful for backing up NTFS partitions.
|
|---|
| 367 | * @c ntfsclone is used to back up only the used sectors, so the space tradeoff is not bad.
|
|---|
| 368 | * However, several caveats apply to such a partition:
|
|---|
| 369 | * - It must not be mounted during the backup
|
|---|
| 370 | * - It must be in a format that ntfsclone knows how to handle, i.e. NTFS
|
|---|
| 371 | * - It cannot be verified during the verify or compare phase
|
|---|
| 372 | * - It may not be resized or selectively restored at restore-time (all or nothing)
|
|---|
| 373 | *
|
|---|
| 374 | * This is a useful feature, but use at your own risk.
|
|---|
| 375 | */
|
|---|
| 376 | char *image_devs;
|
|---|
| 377 |
|
|---|
| 378 | /**
|
|---|
| 379 | * The compression level (1-9) to use. 0 disables compression.
|
|---|
| 380 | */
|
|---|
| 381 | int compression_level;
|
|---|
| 382 |
|
|---|
| 383 | /**
|
|---|
| 384 | * If TRUE, then use @c lzop to compress data.
|
|---|
| 385 | * This is used mainly in estimates. The backup/restore may or may
|
|---|
| 386 | * not work if you do not set this. You should also set @p zip_exe
|
|---|
| 387 | * and @p zip_suffix.
|
|---|
| 388 | */
|
|---|
| 389 | bool use_lzo;
|
|---|
| 390 |
|
|---|
| 391 | /**
|
|---|
| 392 | * If TRUE, then use @c gzip to compress data.
|
|---|
| 393 | * This is used mainly in estimates. The backup/restore may or may
|
|---|
| 394 | * not work if you do not set this. You should also set @p zip_exe
|
|---|
| 395 | * and @p zip_suffix.
|
|---|
| 396 | */
|
|---|
| 397 | bool use_gzip;
|
|---|
| 398 |
|
|---|
| 399 | /**
|
|---|
| 400 | * A filename containing a list of extensions, one per line, to not
|
|---|
| 401 | * compress. If this is set to "", afio will still exclude a set of well-known
|
|---|
| 402 | * compressed files from compression, but biggiefiles that are compressed
|
|---|
| 403 | * will be recompressed again.
|
|---|
| 404 | */
|
|---|
| 405 | char do_not_compress_these[MAX_STR_LEN / 2];
|
|---|
| 406 |
|
|---|
| 407 | /**
|
|---|
| 408 | * If TRUE, then we should verify a backup.
|
|---|
| 409 | */
|
|---|
| 410 | bool verify_data;
|
|---|
| 411 |
|
|---|
| 412 | /**
|
|---|
| 413 | * If TRUE, then we should back up some data.
|
|---|
| 414 | */
|
|---|
| 415 | bool backup_data;
|
|---|
| 416 |
|
|---|
| 417 | /**
|
|---|
| 418 | * If TRUE, then we should restore some data.
|
|---|
| 419 | */
|
|---|
| 420 | bool restore_data;
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 | /**
|
|---|
| 424 | * If TRUE, then we should backup/restore using star, not afio
|
|---|
| 425 | */
|
|---|
| 426 | bool use_star;
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 | /**
|
|---|
| 430 | * Size of internal block reads/writes
|
|---|
| 431 | */
|
|---|
| 432 | long internal_tape_block_size;
|
|---|
| 433 |
|
|---|
| 434 | /**
|
|---|
| 435 | * If TRUE, we're making a CD that will autonuke without confirmation when booted.
|
|---|
| 436 | */
|
|---|
| 437 | bool disaster_recovery;
|
|---|
| 438 |
|
|---|
| 439 | /**
|
|---|
| 440 | * The directory we're backing up to.
|
|---|
| 441 | * If backup_media_type is @b iso, then this is that directory.
|
|---|
| 442 | * If backup_media_type is anything else, this is ignored.
|
|---|
| 443 | */
|
|---|
| 444 | char *isodir;
|
|---|
| 445 |
|
|---|
| 446 | /**
|
|---|
| 447 | * The prefix to put in front of media number
|
|---|
| 448 | * If backup_media_type is @b iso, then this is the prefix for the filename
|
|---|
| 449 | * If backup_media_type is anything else, this is ignored.
|
|---|
| 450 | */
|
|---|
| 451 | char *prefix;
|
|---|
| 452 |
|
|---|
| 453 | /**
|
|---|
| 454 | * The scratch directory to use.
|
|---|
| 455 | * This is the "stage" that the CD image is made directly from.
|
|---|
| 456 | * As such, it needs to be at least as large as the largest CD/DVD/ISO.
|
|---|
| 457 | */
|
|---|
| 458 | char *scratchdir;
|
|---|
| 459 |
|
|---|
| 460 | /**
|
|---|
| 461 | * The temp directory to use.
|
|---|
| 462 | * This is where filesets are stored by the archival threads before
|
|---|
| 463 | * the main thread moves them to the scratchdir. You don't need a lot
|
|---|
| 464 | * of space here.
|
|---|
| 465 | */
|
|---|
| 466 | char *tmpdir;
|
|---|
| 467 |
|
|---|
| 468 | /**
|
|---|
| 469 | * The optimal size for each fileset. This is set automatically in
|
|---|
| 470 | * post_param_configuration() based on your @p backup_media_type; you
|
|---|
| 471 | * needn't set it yourself.
|
|---|
| 472 | */
|
|---|
| 473 | long optimal_set_size;
|
|---|
| 474 |
|
|---|
| 475 | /**
|
|---|
| 476 | * The type of media we're backing up to.
|
|---|
| 477 | */
|
|---|
| 478 | t_bkptype backup_media_type;
|
|---|
| 479 | // bool blank_dvd_first;
|
|---|
| 480 |
|
|---|
| 481 | /**
|
|---|
| 482 | * The string corresponding to the media type
|
|---|
| 483 | */
|
|---|
| 484 | char *backup_media_string;
|
|---|
| 485 |
|
|---|
| 486 | /**
|
|---|
| 487 | * Whether we should use a premade filelist or generate our own.
|
|---|
| 488 | * If TRUE, then we generate our own filelist from the directories in @p include_paths.
|
|---|
| 489 | * If FALSE, then we use the filelist whose name is specified in @p include_paths.
|
|---|
| 490 | */
|
|---|
| 491 | bool make_filelist;
|
|---|
| 492 |
|
|---|
| 493 | /**
|
|---|
| 494 | * Directories to back up, or (if !make_filelist) the filelist to use.
|
|---|
| 495 | * In the former case, multiple directories should be separated by spaces.
|
|---|
| 496 | * If you do nothing, "/" will be used.
|
|---|
| 497 | */
|
|---|
| 498 | char *include_paths;
|
|---|
| 499 |
|
|---|
| 500 | /**
|
|---|
| 501 | * Directories to NOT back up. Ignored if make_filelist == FALSE.
|
|---|
| 502 | * Multiple directories should be separated by spaces. /tmp, /proc,
|
|---|
| 503 | * the scratchdir, and the tempdir are automatically excluded.
|
|---|
| 504 | */
|
|---|
| 505 | char *exclude_paths;
|
|---|
| 506 |
|
|---|
| 507 | /**
|
|---|
| 508 | * The path to restore files relative to during a restore.
|
|---|
| 509 | * This is useful if you want to extract the files (to test, for example)
|
|---|
| 510 | * without overwriting the old ones. Ignored during a backup.
|
|---|
| 511 | */
|
|---|
| 512 | char *restore_path;
|
|---|
| 513 |
|
|---|
| 514 | /**
|
|---|
| 515 | * A command to call BEFORE making an ISO image.
|
|---|
| 516 | */
|
|---|
| 517 | char *call_before_iso;
|
|---|
| 518 |
|
|---|
| 519 | /**
|
|---|
| 520 | * A command to call to make an ISO image.
|
|---|
| 521 | */
|
|---|
| 522 | char *call_make_iso;
|
|---|
| 523 |
|
|---|
| 524 | /**
|
|---|
| 525 | * A command to call to burn the ISO image.
|
|---|
| 526 | * BERLIOS: Useful ???
|
|---|
| 527 | */
|
|---|
| 528 | char *call_burn_iso;
|
|---|
| 529 |
|
|---|
| 530 | /**
|
|---|
| 531 | * A command to call AFTER making an ISO image.
|
|---|
| 532 | */
|
|---|
| 533 | char *call_after_iso;
|
|---|
| 534 |
|
|---|
| 535 | /**
|
|---|
| 536 | * Path to the user's kernel, or "FAILSAFE" or "SUCKS" to use the kernel
|
|---|
| 537 | * included with Mindi.
|
|---|
| 538 | */
|
|---|
| 539 | char *kernel_path;
|
|---|
| 540 |
|
|---|
| 541 | /**
|
|---|
| 542 | * The NFS mount to back up to/restore from.
|
|---|
| 543 | * If backup_media_type is not @b nfs, this is ignored.
|
|---|
| 544 | * It must contain a colon, and the server's address should be in dotted-decimal IP
|
|---|
| 545 | * address form. (Domain names will be resolved in post_param_configuration().)
|
|---|
| 546 | */
|
|---|
| 547 | char *nfs_mount;
|
|---|
| 548 |
|
|---|
| 549 | /**
|
|---|
| 550 | * The directory, relative to the root of @p nfs_mount, to put
|
|---|
| 551 | * the backups in.
|
|---|
| 552 | */
|
|---|
| 553 | char *nfs_remote_dir;
|
|---|
| 554 |
|
|---|
| 555 | /**
|
|---|
| 556 | * A tarball containing a program called "usr/bin/post-nuke" that will be run
|
|---|
| 557 | * after nuking the system. If "", do not use a post-nuke tarball.
|
|---|
| 558 | */
|
|---|
| 559 | char *postnuke_tarball;
|
|---|
| 560 |
|
|---|
| 561 | /**
|
|---|
| 562 | * If TRUE, then pass cdrecord the argument "blank=fast" to wipe the CDs before
|
|---|
| 563 | * writing to them. This has no effect for DVDs.
|
|---|
| 564 | */
|
|---|
| 565 | bool wipe_media_first;
|
|---|
| 566 |
|
|---|
| 567 | // patch by Herman Kuster
|
|---|
| 568 | /**
|
|---|
| 569 | * The differential level of this backup. Currently only 0 (full backup) and 1
|
|---|
| 570 | * (files changed since last full backup) are supported.
|
|---|
| 571 | */
|
|---|
| 572 | int differential;
|
|---|
| 573 | // end patch
|
|---|
| 574 |
|
|---|
| 575 | /**
|
|---|
| 576 | * If TRUE, then don't eject media when backing up or restoring.
|
|---|
| 577 | */
|
|---|
| 578 | bool please_dont_eject;
|
|---|
| 579 |
|
|---|
| 580 | /**
|
|---|
| 581 | * The speed of the CD-R[W] drive.
|
|---|
| 582 | */
|
|---|
| 583 | int cdrw_speed;
|
|---|
| 584 |
|
|---|
| 585 | /**
|
|---|
| 586 | * If TRUE, then cdrecord will be passed some flags to help compensate for PCs
|
|---|
| 587 | * with eccentric CD-ROM drives. If it has BurnProof technology, or is in a laptop,
|
|---|
| 588 | * it probably falls into this category.
|
|---|
| 589 | */
|
|---|
| 590 | bool manual_cd_tray;
|
|---|
| 591 |
|
|---|
| 592 | /**
|
|---|
| 593 | * If TRUE, do not make the first CD bootable. This is dangerous but it saves a minute
|
|---|
| 594 | * or so. It is useful in testing. Use with care.
|
|---|
| 595 | */
|
|---|
| 596 | bool nonbootable_backup;
|
|---|
| 597 |
|
|---|
| 598 | /**
|
|---|
| 599 | * If TRUE, make the bootable CD use LILO/ELILO. If FALSE, use isolinux (the default).
|
|---|
| 600 | */
|
|---|
| 601 | bool make_cd_use_lilo;
|
|---|
| 602 | };
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 |
|
|---|
| 606 | /**
|
|---|
| 607 | * A node in a directory structure.
|
|---|
| 608 | * Its internals are managed by load_filelist() et al; you only need to keep track of the top node.
|
|---|
| 609 | * @bug My understanding of this structure is horrendously incomplete. Could you please fill in the details?
|
|---|
| 610 | */
|
|---|
| 611 | struct s_node {
|
|---|
| 612 | /**
|
|---|
| 613 | * The character this node contains.
|
|---|
| 614 | */
|
|---|
| 615 | char ch;
|
|---|
| 616 |
|
|---|
| 617 | /**
|
|---|
| 618 | * The node to the right of this one.
|
|---|
| 619 | */
|
|---|
| 620 | struct s_node *right;
|
|---|
| 621 |
|
|---|
| 622 | /**
|
|---|
| 623 | * The node below this one.
|
|---|
| 624 | */
|
|---|
| 625 | struct s_node *down;
|
|---|
| 626 |
|
|---|
| 627 | /**
|
|---|
| 628 | * If TRUE, then this node is selected (for restore, for example).
|
|---|
| 629 | */
|
|---|
| 630 | bool selected;
|
|---|
| 631 |
|
|---|
| 632 | /**
|
|---|
| 633 | * If TRUE, then we want to see the directories below this one.
|
|---|
| 634 | */
|
|---|
| 635 | bool expanded;
|
|---|
| 636 | };
|
|---|
| 637 |
|
|---|
| 638 | /**
|
|---|
| 639 | * Information about one file.
|
|---|
| 640 | * This is used as the "zeroth slice" of a biggiefile to be able to recreate
|
|---|
| 641 | * its name, mode, owner, group, mtime, atime, and to be able to verify it in Compare Mode.
|
|---|
| 642 | */
|
|---|
| 643 | struct s_filename_and_lstat_info {
|
|---|
| 644 | /**
|
|---|
| 645 | * The filename of the file this structure is describing.
|
|---|
| 646 | */
|
|---|
| 647 | char filename[MAX_STR_LEN];
|
|---|
| 648 |
|
|---|
| 649 | /**
|
|---|
| 650 | * The MD5 checksum (32 hex digits) of this file.
|
|---|
| 651 | */
|
|---|
| 652 | char checksum[64];
|
|---|
| 653 |
|
|---|
| 654 | /**
|
|---|
| 655 | * Unused; kept for backwards compatibility.
|
|---|
| 656 | */
|
|---|
| 657 | char for_backward_compatibility;
|
|---|
| 658 |
|
|---|
| 659 | /**
|
|---|
| 660 | * The stat buffer for this file.
|
|---|
| 661 | * Generated with a call to <tt>lstat(&(struc->properties))</tt> where @p struc
|
|---|
| 662 | * is the @p s_filename_and_lstat_info.
|
|---|
| 663 | */
|
|---|
| 664 | struct stat properties;
|
|---|
| 665 | bool use_ntfsprog;
|
|---|
| 666 | };
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 | /**
|
|---|
| 670 | * A file with associated severity if it differed in a verify or compare.
|
|---|
| 671 | */
|
|---|
| 672 | struct s_filelist_entry {
|
|---|
| 673 | /**
|
|---|
| 674 | * The name of the file.
|
|---|
| 675 | */
|
|---|
| 676 | char filename[MAX_STR_LEN];
|
|---|
| 677 | /**
|
|---|
| 678 | * The severity if the file has changed between the backup and live filesystem.
|
|---|
| 679 | * This is on a scale from 1 to 3, 3 being the most important. File patterns which cause
|
|---|
| 680 | * a severity of 1 are:
|
|---|
| 681 | * - /etc/adjtime
|
|---|
| 682 | * - /etc/mtab
|
|---|
| 683 | * - /var/lib/slocate
|
|---|
| 684 | * - /var/lock
|
|---|
| 685 | * - /var/log
|
|---|
| 686 | * - /var/spool (except /var/spool/mail)
|
|---|
| 687 | * - /var/run
|
|---|
| 688 | * - *~
|
|---|
| 689 | * - *.log
|
|---|
| 690 | * - *cache*
|
|---|
| 691 | * - other temporary or unimportant files
|
|---|
| 692 | *
|
|---|
| 693 | * File patterns which cause a severity of 2 are:
|
|---|
| 694 | * - /var (except /var/lock, /var/log, /var/run, /var/spool)
|
|---|
| 695 | * - /home
|
|---|
| 696 | * - /root/.*
|
|---|
| 697 | * - /var/lib (except /var/lib/slocate, /var/lib/rpm)
|
|---|
| 698 | * - /var/spool/mail
|
|---|
| 699 | *
|
|---|
| 700 | * File patterns which cause a severity of 3 are:
|
|---|
| 701 | * - /etc (except /etc/adjtime, /etc/mtab)
|
|---|
| 702 | * - /root (except /root/.*)
|
|---|
| 703 | * - /usr
|
|---|
| 704 | * - /var/lib/rpm
|
|---|
| 705 | * - Anything else not matched explicitly
|
|---|
| 706 | *
|
|---|
| 707 | * @see severity_of_difference
|
|---|
| 708 | */
|
|---|
| 709 | int severity;
|
|---|
| 710 | };
|
|---|
| 711 |
|
|---|
| 712 |
|
|---|
| 713 | /**
|
|---|
| 714 | * A list of @c s_filelist_entry.
|
|---|
| 715 | */
|
|---|
| 716 | struct s_filelist {
|
|---|
| 717 | /**
|
|---|
| 718 | * The number of entries in the list.
|
|---|
| 719 | */
|
|---|
| 720 | int entries;
|
|---|
| 721 |
|
|---|
| 722 | /**
|
|---|
| 723 | * The entries themselves, all @p entries of them.
|
|---|
| 724 | */
|
|---|
| 725 | struct s_filelist_entry el[ARBITRARY_MAXIMUM];
|
|---|
| 726 | };
|
|---|
| 727 |
|
|---|
| 728 |
|
|---|
| 729 | /**
|
|---|
| 730 | * An entry in the tape catalog.
|
|---|
| 731 | */
|
|---|
| 732 | struct s_tapecat_entry {
|
|---|
| 733 | /**
|
|---|
| 734 | * The type of archive it is (afioball, slice, or something else).
|
|---|
| 735 | */
|
|---|
| 736 | t_archtype type;
|
|---|
| 737 |
|
|---|
| 738 | /**
|
|---|
| 739 | * The filelist number or biggiefile (not slice!) number.
|
|---|
| 740 | */
|
|---|
| 741 | int number;
|
|---|
| 742 |
|
|---|
| 743 | /**
|
|---|
| 744 | * The slice number if it's a biggiefile.
|
|---|
| 745 | */
|
|---|
| 746 | long aux;
|
|---|
| 747 |
|
|---|
| 748 | /**
|
|---|
| 749 | * The tape position at the point this entry was added.
|
|---|
| 750 | */
|
|---|
| 751 | long long tape_posK;
|
|---|
| 752 |
|
|---|
| 753 | /**
|
|---|
| 754 | * The filename of the file cataloged here.
|
|---|
| 755 | */
|
|---|
| 756 | char fname[MAX_TAPECAT_FNAME_LEN + 1];
|
|---|
| 757 | };
|
|---|
| 758 |
|
|---|
| 759 |
|
|---|
| 760 | /**
|
|---|
| 761 | * A tape catalog, made of a list of @p s_tapecat_entry.
|
|---|
| 762 | */
|
|---|
| 763 | struct s_tapecatalog {
|
|---|
| 764 | /**
|
|---|
| 765 | * The number of entries in the tape catalog.
|
|---|
| 766 | */
|
|---|
| 767 | int entries;
|
|---|
| 768 |
|
|---|
| 769 | /**
|
|---|
| 770 | * The entries themselves, all @p entries of them.
|
|---|
| 771 | */
|
|---|
| 772 | struct s_tapecat_entry el[MAX_TAPECATALOG_ENTRIES];
|
|---|
| 773 | };
|
|---|
| 774 |
|
|---|
| 775 |
|
|---|
| 776 |
|
|---|
| 777 | struct s_mdrec {
|
|---|
| 778 | int md; // /dev/mdN
|
|---|
| 779 | int raidlevel; // 0, 1, 5
|
|---|
| 780 | struct list_of_disks disks;
|
|---|
| 781 | int progress;
|
|---|
| 782 | };
|
|---|
| 783 |
|
|---|
| 784 | struct s_mdstat {
|
|---|
| 785 | int entries;
|
|---|
| 786 | struct s_mdrec el[MAXIMUM_RAID_DEVS];
|
|---|
| 787 | };
|
|---|
| 788 |
|
|---|
| 789 | struct s_mr_conf {
|
|---|
| 790 | int mindi_ia64_boot_size;
|
|---|
| 791 | char *mondo_iso_creation_cmd;
|
|---|
| 792 | char *mondo_logfile;
|
|---|
| 793 | };
|
|---|