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