| 1 | /***************************************************************************
|
|---|
| 2 | * $Id: mondostructures.h 1977 2008-06-02 08:49:01Z bruno $
|
|---|
| 3 | *
|
|---|
| 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 | */
|
|---|
| 13 | struct mountlist_line {
|
|---|
| 14 | /**
|
|---|
| 15 | * The name of the device (/dev entry) for this mountlist line. Guaranteed to be unique.
|
|---|
| 16 | */
|
|---|
| 17 | char device[64];
|
|---|
| 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 | */
|
|---|
| 23 | char mountpoint[256];
|
|---|
| 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 | */
|
|---|
| 29 | char format[64];
|
|---|
| 30 |
|
|---|
| 31 | /**
|
|---|
| 32 | * The size in kilobytes of this device. 0 or -1 indicates LVM.
|
|---|
| 33 | */
|
|---|
| 34 | long long size;
|
|---|
| 35 |
|
|---|
| 36 | /**
|
|---|
| 37 | * For ext2 and ext3, this is the filesystem label or uuid (if there is one). If not, this should be "".
|
|---|
| 38 | */
|
|---|
| 39 | char label[256];
|
|---|
| 40 |
|
|---|
| 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 | */
|
|---|
| 48 | struct mountlist_itself {
|
|---|
| 49 | /**
|
|---|
| 50 | * Number of entries in the mountlist.
|
|---|
| 51 | */
|
|---|
| 52 | int entries;
|
|---|
| 53 |
|
|---|
| 54 | /**
|
|---|
| 55 | * The list of entries, all @p entries of them.
|
|---|
| 56 | */
|
|---|
| 57 | struct mountlist_line el[MAX_TAPECATALOG_ENTRIES];
|
|---|
| 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 | */
|
|---|
| 65 | struct mountlist_reference {
|
|---|
| 66 | /**
|
|---|
| 67 | * The number of entries in the list of mountlist references.
|
|---|
| 68 | */
|
|---|
| 69 | int entries;
|
|---|
| 70 |
|
|---|
| 71 | /**
|
|---|
| 72 | * The array of mountlist_line, allocated on demand.
|
|---|
| 73 | */
|
|---|
| 74 | struct mountlist_line **el;
|
|---|
| 75 | };
|
|---|
| 76 |
|
|---|
| 77 | /**
|
|---|
| 78 | * A line in @p additional_raid_variables.
|
|---|
| 79 | */
|
|---|
| 80 | struct raid_var_line {
|
|---|
| 81 | /**
|
|---|
| 82 | * The label for this RAID variable.
|
|---|
| 83 | */
|
|---|
| 84 | char label[64];
|
|---|
| 85 |
|
|---|
| 86 | /**
|
|---|
| 87 | * The value for this RAID variable.
|
|---|
| 88 | */
|
|---|
| 89 | char value[64];
|
|---|
| 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 | */
|
|---|
| 98 | struct additional_raid_variables {
|
|---|
| 99 | /**
|
|---|
| 100 | * The number of entries in the list.
|
|---|
| 101 | */
|
|---|
| 102 | int entries;
|
|---|
| 103 |
|
|---|
| 104 | /**
|
|---|
| 105 | * The list of entries, all @p entries of them.
|
|---|
| 106 | */
|
|---|
| 107 | struct raid_var_line el[MAXIMUM_ADDITIONAL_RAID_VARS];
|
|---|
| 108 | };
|
|---|
| 109 |
|
|---|
| 110 | /**
|
|---|
| 111 | * One disk in a @p list_of_disks.
|
|---|
| 112 | */
|
|---|
| 113 | struct s_disk {
|
|---|
| 114 | #ifdef __FreeBSD__
|
|---|
| 115 | /**
|
|---|
| 116 | * The name of this disk. If blank it will eventually get filled in automatically.
|
|---|
| 117 | */
|
|---|
| 118 | char name[64];
|
|---|
| 119 | #endif
|
|---|
| 120 | /**
|
|---|
| 121 | * The device this entry describes.
|
|---|
| 122 | */
|
|---|
| 123 | char device[64];
|
|---|
| 124 |
|
|---|
| 125 | /**
|
|---|
| 126 | * Index number of this entry in the whole disklist.
|
|---|
| 127 | */
|
|---|
| 128 | int index;
|
|---|
| 129 |
|
|---|
| 130 | /**
|
|---|
| 131 | * Type of disk.
|
|---|
| 132 | */
|
|---|
| 133 | char type; // ' ' = data (default), S = spare, F = faulty
|
|---|
| 134 |
|
|---|
| 135 | };
|
|---|
| 136 |
|
|---|
| 137 | /**
|
|---|
| 138 | * A list of @p s_disk. Every @p raid_device_record has four.
|
|---|
| 139 | */
|
|---|
| 140 | struct list_of_disks {
|
|---|
| 141 | /**
|
|---|
| 142 | * The number of entries in the disklist.
|
|---|
| 143 | */
|
|---|
| 144 | int entries;
|
|---|
| 145 |
|
|---|
| 146 | /**
|
|---|
| 147 | * The entries themselves, all @p entries of them.
|
|---|
| 148 | */
|
|---|
| 149 | struct s_disk el[MAXIMUM_DISKS_PER_RAID_DEV];
|
|---|
| 150 | };
|
|---|
| 151 |
|
|---|
| 152 | /**
|
|---|
| 153 | * A type of media we're backing up to.
|
|---|
| 154 | */
|
|---|
| 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.
|
|---|
| 163 | usb, ///< Back up to USB devices.
|
|---|
| 164 | udev ///< Back up to another unsupported device; just send a stream of bytes.
|
|---|
| 165 | } t_bkptype;
|
|---|
| 166 |
|
|---|
| 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 |
|
|---|
| 178 | /**
|
|---|
| 179 | * A type of file in the catalog of recent archives.
|
|---|
| 180 | */
|
|---|
| 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;
|
|---|
| 185 |
|
|---|
| 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;
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 | #ifdef __FreeBSD__
|
|---|
| 200 |
|
|---|
| 201 | struct vinum_subdisk {
|
|---|
| 202 | char which_device[64];
|
|---|
| 203 | };
|
|---|
| 204 |
|
|---|
| 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 |
|
|---|
| 225 | #else
|
|---|
| 226 |
|
|---|
| 227 | /**
|
|---|
| 228 | * A RAID device in the raidlist.
|
|---|
| 229 | */
|
|---|
| 230 | struct raid_device_record {
|
|---|
| 231 | /**
|
|---|
| 232 | * The name of the RAID device (e.g. /dev/md0).
|
|---|
| 233 | */
|
|---|
| 234 | char raid_device[64];
|
|---|
| 235 |
|
|---|
| 236 | /**
|
|---|
| 237 | * The RAID level (-1 to 5) we're using.
|
|---|
| 238 | */
|
|---|
| 239 | int raid_level;
|
|---|
| 240 |
|
|---|
| 241 | /**
|
|---|
| 242 | * Whether the disk has a persistent superblock.
|
|---|
| 243 | */
|
|---|
| 244 | int persistent_superblock;
|
|---|
| 245 |
|
|---|
| 246 | /**
|
|---|
| 247 | * The chunk size of this RAID device.
|
|---|
| 248 | */
|
|---|
| 249 | int chunk_size;
|
|---|
| 250 |
|
|---|
| 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
|
|---|
| 255 |
|
|---|
| 256 | /**
|
|---|
| 257 | * A list of the disks to use for storing data.
|
|---|
| 258 | */
|
|---|
| 259 | struct list_of_disks data_disks;
|
|---|
| 260 |
|
|---|
| 261 | /**
|
|---|
| 262 | * A list of the disks to use as "hot spares" in case one dies.
|
|---|
| 263 | */
|
|---|
| 264 | struct list_of_disks spare_disks;
|
|---|
| 265 |
|
|---|
| 266 | /**
|
|---|
| 267 | * A list of the disks to use for storing parity information.
|
|---|
| 268 | */
|
|---|
| 269 | struct list_of_disks parity_disks;
|
|---|
| 270 |
|
|---|
| 271 | /**
|
|---|
| 272 | * A list of the disks in this RAID device that have failed\. Rare.
|
|---|
| 273 | */
|
|---|
| 274 | struct list_of_disks failed_disks;
|
|---|
| 275 |
|
|---|
| 276 | /**
|
|---|
| 277 | * The additional RAID variables for this device.
|
|---|
| 278 | */
|
|---|
| 279 | struct additional_raid_variables additional_vars;
|
|---|
| 280 |
|
|---|
| 281 | /**
|
|---|
| 282 | * Resync progress for this device.
|
|---|
| 283 | */
|
|---|
| 284 | int progress;
|
|---|
| 285 | };
|
|---|
| 286 |
|
|---|
| 287 | /**
|
|---|
| 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 | */
|
|---|
| 292 | struct raidlist_itself {
|
|---|
| 293 | /**
|
|---|
| 294 | * The number of entries in the list.
|
|---|
| 295 | */
|
|---|
| 296 | int entries;
|
|---|
| 297 |
|
|---|
| 298 | /**
|
|---|
| 299 | * The RAID devices in the raidlist, all @p entries of them.
|
|---|
| 300 | */
|
|---|
| 301 | struct raid_device_record el[MAXIMUM_RAID_DEVS];
|
|---|
| 302 | };
|
|---|
| 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 | */
|
|---|
| 322 | struct s_bkpinfo {
|
|---|
| 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).
|
|---|
| 326 | * If backup_media_type is @b dvd, @b tape, @b usb or @b udev, this should be a /dev entry.
|
|---|
| 327 | * If backup_media_type is anything else, this should be blank.
|
|---|
| 328 | */
|
|---|
| 329 | char *media_device;
|
|---|
| 330 |
|
|---|
| 331 | /* SCSI node (a la 0,0,0) or NULL if we use the media_device */
|
|---|
| 332 | char *iso_burning_dev;
|
|---|
| 333 |
|
|---|
| 334 | /**
|
|---|
| 335 | *
|
|---|
| 336 | * The size of the media in our backup set, in MB.
|
|---|
| 337 | * If the size should be autodetected, make it -1 (preferable) or 0.
|
|---|
| 338 | *
|
|---|
| 339 | */
|
|---|
| 340 | long media_size;
|
|---|
| 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 | */
|
|---|
| 354 | char boot_loader;
|
|---|
| 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 | */
|
|---|
| 361 | char boot_device[MAX_STR_LEN / 4];
|
|---|
| 362 |
|
|---|
| 363 | /**
|
|---|
| 364 | * The compression program to use. Currently supported
|
|---|
| 365 | * choices are lzop, bzip2, and gzip. This is ignored if
|
|---|
| 366 | * compression_level is 0.
|
|---|
| 367 | */
|
|---|
| 368 | char *compression_tool;
|
|---|
| 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 | */
|
|---|
| 374 | char *compression_suffix;
|
|---|
| 375 |
|
|---|
| 376 | /**
|
|---|
| 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 | /**
|
|---|
| 387 | * Devices to back up as biggiefiles.
|
|---|
| 388 | *
|
|---|
| 389 | * This is useful for backing up NTFS partitions.
|
|---|
| 390 | * @c ntfsclone is used to back up only the used sectors, so the space tradeoff is not bad.
|
|---|
| 391 | * However, several caveats apply to such a partition:
|
|---|
| 392 | * - It must not be mounted during the backup
|
|---|
| 393 | * - It must be in a format that ntfsclone knows how to handle, i.e. NTFS
|
|---|
| 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 | */
|
|---|
| 399 | char image_devs[MAX_STR_LEN / 4];
|
|---|
| 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 | */
|
|---|
| 407 | char do_not_compress_these[MAX_STR_LEN / 2];
|
|---|
| 408 |
|
|---|
| 409 | /**
|
|---|
| 410 | * If TRUE, then we should verify a backup.
|
|---|
| 411 | */
|
|---|
| 412 | bool verify_data;
|
|---|
| 413 |
|
|---|
| 414 | /**
|
|---|
| 415 | * If TRUE, then we should back up some data.
|
|---|
| 416 | */
|
|---|
| 417 | bool backup_data;
|
|---|
| 418 |
|
|---|
| 419 | /**
|
|---|
| 420 | * If TRUE, then we should restore some data.
|
|---|
| 421 | */
|
|---|
| 422 | bool restore_data;
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 | /**
|
|---|
| 426 | * If TRUE, then we should backup/restore using star, not afio
|
|---|
| 427 | */
|
|---|
| 428 | bool use_star;
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 | /**
|
|---|
| 432 | * Size of internal block reads/writes
|
|---|
| 433 | */
|
|---|
| 434 | long internal_tape_block_size;
|
|---|
| 435 |
|
|---|
| 436 | /**
|
|---|
| 437 | * If TRUE, we're making a CD that will autonuke without confirmation when booted.
|
|---|
| 438 | */
|
|---|
| 439 | bool disaster_recovery;
|
|---|
| 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 | */
|
|---|
| 446 | char isodir[MAX_STR_LEN / 4];
|
|---|
| 447 |
|
|---|
| 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 | */
|
|---|
| 453 | char *prefix;
|
|---|
| 454 |
|
|---|
| 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 | */
|
|---|
| 460 | char scratchdir[MAX_STR_LEN / 4];
|
|---|
| 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 | */
|
|---|
| 468 | char tmpdir[MAX_STR_LEN / 4];
|
|---|
| 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 | */
|
|---|
| 475 | long optimal_set_size;
|
|---|
| 476 |
|
|---|
| 477 | /**
|
|---|
| 478 | * The type of media we're backing up to.
|
|---|
| 479 | */
|
|---|
| 480 | t_bkptype backup_media_type;
|
|---|
| 481 | // bool blank_dvd_first;
|
|---|
| 482 |
|
|---|
| 483 | /**
|
|---|
| 484 | * The string corresponding to the media type
|
|---|
| 485 | */
|
|---|
| 486 | char backup_media_string[64];
|
|---|
| 487 |
|
|---|
| 488 | /**
|
|---|
| 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 | */
|
|---|
| 493 | bool make_filelist;
|
|---|
| 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 | */
|
|---|
| 500 | char include_paths[MAX_STR_LEN*4];
|
|---|
| 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 | */
|
|---|
| 507 | char *exclude_paths;
|
|---|
| 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 | */
|
|---|
| 514 | char restore_path[MAX_STR_LEN];
|
|---|
| 515 |
|
|---|
| 516 | /**
|
|---|
| 517 | * A command to call BEFORE making an ISO image.
|
|---|
| 518 | */
|
|---|
| 519 | char call_before_iso[MAX_STR_LEN];
|
|---|
| 520 |
|
|---|
| 521 | /**
|
|---|
| 522 | * A command to call to make an ISO image.
|
|---|
| 523 | */
|
|---|
| 524 | char call_make_iso[MAX_STR_LEN];
|
|---|
| 525 |
|
|---|
| 526 | /**
|
|---|
| 527 | * A command to call AFTER making an ISO image.
|
|---|
| 528 | */
|
|---|
| 529 | char call_after_iso[MAX_STR_LEN];
|
|---|
| 530 |
|
|---|
| 531 | /**
|
|---|
| 532 | * Path to the user's kernel, or "FAILSAFE" or "SUCKS" to use the kernel
|
|---|
| 533 | * included with Mindi.
|
|---|
| 534 | */
|
|---|
| 535 | char *kernel_path;
|
|---|
| 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 | */
|
|---|
| 543 | char nfs_mount[MAX_STR_LEN];
|
|---|
| 544 |
|
|---|
| 545 | /**
|
|---|
| 546 | * The directory, relative to the root of @p nfs_mount, to put
|
|---|
| 547 | * the backups in.
|
|---|
| 548 | */
|
|---|
| 549 | char nfs_remote_dir[MAX_STR_LEN];
|
|---|
| 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 | */
|
|---|
| 555 | char postnuke_tarball[MAX_STR_LEN];
|
|---|
| 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 | */
|
|---|
| 561 | bool wipe_media_first;
|
|---|
| 562 |
|
|---|
| 563 | /**
|
|---|
| 564 | * The differential level of this backup. Currently only FALSE (full backup) and TRUE
|
|---|
| 565 | * (files changed since last full backup) are supported.
|
|---|
| 566 | */
|
|---|
| 567 | bool differential;
|
|---|
| 568 |
|
|---|
| 569 | /**
|
|---|
| 570 | * If TRUE, then don't eject media when backing up or restoring.
|
|---|
| 571 | */
|
|---|
| 572 | bool please_dont_eject;
|
|---|
| 573 |
|
|---|
| 574 | /**
|
|---|
| 575 | * The speed of the CD-R[W] drive.
|
|---|
| 576 | */
|
|---|
| 577 | int writer_speed;
|
|---|
| 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 | */
|
|---|
| 584 | bool manual_tray;
|
|---|
| 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 | */
|
|---|
| 590 | bool nonbootable_backup;
|
|---|
| 591 |
|
|---|
| 592 | /**
|
|---|
| 593 | * If TRUE, make the bootable CD use LILO/ELILO. If FALSE, use isolinux (the default).
|
|---|
| 594 | */
|
|---|
| 595 | bool make_cd_use_lilo;
|
|---|
| 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;
|
|---|
| 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 | */
|
|---|
| 615 | struct s_node {
|
|---|
| 616 | /**
|
|---|
| 617 | * The character this node contains.
|
|---|
| 618 | */
|
|---|
| 619 | char ch;
|
|---|
| 620 |
|
|---|
| 621 | /**
|
|---|
| 622 | * The node to the right of this one.
|
|---|
| 623 | */
|
|---|
| 624 | struct s_node *right;
|
|---|
| 625 |
|
|---|
| 626 | /**
|
|---|
| 627 | * The node below this one.
|
|---|
| 628 | */
|
|---|
| 629 | struct s_node *down;
|
|---|
| 630 |
|
|---|
| 631 | /**
|
|---|
| 632 | * If TRUE, then this node is selected (for restore, for example).
|
|---|
| 633 | */
|
|---|
| 634 | bool selected;
|
|---|
| 635 |
|
|---|
| 636 | /**
|
|---|
| 637 | * If TRUE, then we want to see the directories below this one.
|
|---|
| 638 | */
|
|---|
| 639 | bool expanded;
|
|---|
| 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 {
|
|---|
| 649 | /**
|
|---|
| 650 | * The filename of the file this structure is describing.
|
|---|
| 651 | */
|
|---|
| 652 | char filename[MAX_STR_LEN];
|
|---|
| 653 |
|
|---|
| 654 | /**
|
|---|
| 655 | * The MD5 checksum (32 hex digits) of this file.
|
|---|
| 656 | */
|
|---|
| 657 | char checksum[64];
|
|---|
| 658 |
|
|---|
| 659 | /**
|
|---|
| 660 | * Unused; kept for backwards compatibility.
|
|---|
| 661 | */
|
|---|
| 662 | char for_backward_compatibility;
|
|---|
| 663 |
|
|---|
| 664 | /**
|
|---|
| 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;
|
|---|
| 670 | bool use_ntfsprog;
|
|---|
| 671 | };
|
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 | /**
|
|---|
| 675 | * A file with associated severity if it differed in a verify or compare.
|
|---|
| 676 | */
|
|---|
| 677 | struct s_filelist_entry {
|
|---|
| 678 | /**
|
|---|
| 679 | * The name of the file.
|
|---|
| 680 | */
|
|---|
| 681 | char filename[MAX_STR_LEN];
|
|---|
| 682 | /**
|
|---|
| 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 | */
|
|---|
| 714 | int severity;
|
|---|
| 715 | };
|
|---|
| 716 |
|
|---|
| 717 |
|
|---|
| 718 | /**
|
|---|
| 719 | * A list of @c s_filelist_entry.
|
|---|
| 720 | */
|
|---|
| 721 | struct s_filelist {
|
|---|
| 722 | /**
|
|---|
| 723 | * The number of entries in the list.
|
|---|
| 724 | */
|
|---|
| 725 | int entries;
|
|---|
| 726 |
|
|---|
| 727 | /**
|
|---|
| 728 | * The entries themselves, all @p entries of them.
|
|---|
| 729 | */
|
|---|
| 730 | struct s_filelist_entry el[ARBITRARY_MAXIMUM];
|
|---|
| 731 | };
|
|---|