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