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