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