source: MondoRescue/branches/3.3/mondo/src/common/mondostructures.h@ 3885

Last change on this file since 3885 was 3885, checked in by Bruno Cornec, 3 months ago

Removes support for ia64 depracated in upstream kernel, and elilo

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