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