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