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