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