source: MondoRescue/branches/stable/mondo/src/include/my-stuff.h @ 1770

Last change on this file since 1770 was 1770, checked in by Bruno Cornec, 13 years ago
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

  • Property svn:eol-style set to native
File size: 9.1 KB
Line 
1/*
2 * Common defines across the project
3 *
4 *  $Id: my-stuff.h 973 2006-11-23 18:05:21Z bruno $
5 */
6
7#ifndef _MY_STUFF_H_
8#define _MY_STUFF_H_
9
10// Extra info for ACLs and SELINUX users
11#define STAR_ACL_SZ "-xfflags -acl"
12
13/*The number of lines of log output to keep at the bottom of the screen.*/
14#define NOOF_ERR_LINES  6   
15
16/* Hardcoded: Bad for the moment */
17#define MONDO_CACHE "/var/cache/mondo"
18#define MINDI_CACHE "/var/cache/mindi"
19#define MONDORESTORECFG MONDO_CACHE"/mondo-restore.cfg"
20/**
21 * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).
22 */
23#define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg"
24
25
26
27/**
28 * @file
29 * The main header file for Mondo.
30 */
31
32#include <stdio.h>
33#include "mr_mem.h"
34#include "mr_msg.h"
35#include "mr_types.h"
36
37#ifdef HAVE_CONFIG_H
38#include <config.h>
39#endif
40/* BERLIOS
41 * Useful ?
42*/
43
44#ifndef __FreeBSD__
45#include <getopt.h>
46#endif
47
48#include <sys/types.h>
49#include <sys/shm.h>
50#include <sys/ipc.h>
51#include <sys/ioctl.h>
52#include <sys/sem.h>
53#include <sys/param.h>
54
55#include <stdlib.h>
56#include <sys/stat.h>
57#include <fcntl.h>
58#include <errno.h>
59#include <stddef.h>
60#include <sys/stat.h>
61#include <sys/wait.h>
62#include <time.h>
63#include <unistd.h>
64#ifndef S_SPLINT_S
65#include <signal.h>
66#endif
67#include <newt.h>
68#include <ctype.h>
69#include <string.h>
70#ifndef S_SPLINT_S
71#include <pthread.h>
72#endif
73#include <assert.h>
74
75/**
76 * The biggielist stub (appended to the directory where all.tar.gz was unpacked).
77 */
78#define BIGGIELIST_TXT_STUB "tmp/biggielist.txt"
79
80/**
81 * The filelist stub (appended to the directory where all.tar.gz was unpacked).
82 */
83#define FILELIST_FULL_STUB "tmp/filelist.full.gz"
84
85/**
86 * The mountlist stub (appended to the directory where all.tar.gz was unpacked).
87 */
88#define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt"
89
90/**
91 * The location where mondo changed info are stored.
92 */
93#define MONDO_CACHE "/var/cache/mondo"
94
95/**
96 * The RAID kernel proc file
97 */
98#define MDSTAT_FILE "/proc/mdstat"
99
100#undef assert
101
102extern void _mondo_assert_fail(const char *file, const char *function,
103                               int line, const char *exp);
104
105/**
106 * An assert macro that calls _mondo_assert_fail() when it fails.
107 */
108#ifdef NDEBUG
109#   define assert(exp) ((void)0)
110#else
111#   ifndef S_SPLINT_S
112#       define assert(exp) ((exp)?((void)0):_mondo_assert_fail(__FILE__, __FUNCTION__, __LINE__, #exp))
113#   else
114#       define assert(exp) ((void)0)
115#   endif
116#endif
117
118#define CRC_M16 0xA001          ///< Mask for crc16.
119#define CRC_MTT 0x1021          ///< Mask for crc-ccitt.
120
121#define SCREEN_LENGTH 25        ///< The default size of the screen.
122#define ARBITRARY_MAXIMUM 2000  ///< The maximum number of items showing at once in the mountlist or filelist editor.
123#define MAX_TAPECATALOG_ENTRIES 8192    ///< The maximum number of entries in the tape catalog.
124#define MAX_STR_LEN 384         ///< The maximum length of almost all @p char buffers in Mondo.
125                                        ///  Note: Make this divisible by eight to avoid aligment issues
126                                        ///        on 64bit platforms like ia64.
127#define MAXIMUM_RAID_DEVS 32    ///< The maximum number of RAID devices in the raidlist.
128#define MAXIMUM_ADDITIONAL_RAID_VARS 32 ///< The maximum number of additional RAID variables per RAID device in the raidlist.
129#define MAXIMUM_DISKS_PER_RAID_DEV 32   ///< The maximum number of disks per RAID device in the raidtab.
130
131#define RAIDTAB_FNAME "/etc/raidtab"    ///< The filename of the raidtab file, at least on Linux.
132
133#define BLK_START_OF_BACKUP     1   ///< Marker block: start a backup.
134#define BLK_START_OF_TAPE       2   ///< Marker block: start a tape.
135#define BLK_START_AFIOBALLS 10  ///< Marker block: start the afioball section.
136#define BLK_STOP_AFIOBALLS  19  ///< Marker block: stop the afioball section.
137#define BLK_START_AN_AFIO_OR_SLICE      20  ///< Marker block: start an afioball or a slice.
138#define BLK_STOP_AN_AFIO_OR_SLICE   29  ///< Marker block: stop an afioball or a slice.
139#define BLK_START_BIGGIEFILES   30  ///< Marker block: start the biggiefile section.
140#define BLK_STOP_BIGGIEFILES    39  ///< Marker block: stop the biggiefile section.
141#define BLK_START_A_NORMBIGGIE  40  ///< Marker block: start a normal biggiefile.
142#define BLK_START_A_PIHBIGGIE   41  ///< Marker block: start a ntfsprog'd biggiefile
143#define BLK_START_EXTENDED_ATTRIBUTES 45    ///< Marker block: start xattr/acl info
144#define BLK_STOP_EXTENDED_ATTRIBUTES 46 ///< Marker block: stop xattr/acl info
145#define BLK_START_EXAT_FILE     47
146#define BLK_STOP_EXAT_FILE      48
147#define BLK_STOP_A_BIGGIE   59  ///< Marker block: stop a biggiefile.
148#define BLK_START_FILE          80  ///< Marker block: start a file (non-afio or slice).
149#define BLK_STOP_FILE           89  ///< Marker block: stop a file (non-afio or slice).
150#define BLK_END_OF_TAPE         100 ///< Marker block: end of tape.
151#define BLK_END_OF_BACKUP       101 ///< Marker block: end of backup.
152#define BLK_ABORTED_BACKUP      102 ///< Marker block: backup was aborted.
153
154/**
155 * Determine whether @p x (t_bkptype) is a streaming backup.
156 */
157#define IS_THIS_A_STREAMING_BACKUP(x) (x == tape || x == udev || x == cdstream)
158
159/**
160 * The stub name of the temporary ISO image to create, burn, and remove.
161 */
162#define MONDO_TMPISOS "temporary.iso"
163
164/**
165 * Assert that (@p x != NULL) and (@p x[0] != '\\0').
166 */
167#define assert_string_is_neither_NULL_nor_zerolength(x) {assert(x!=NULL);assert(x[0]!='\0');}
168
169/**
170 * Log the file, line, Mondo error message, and OS error message (errno).
171 */
172#define log_OS_error(x) {mr_msg(1, "%s, (%s)", x, strerror(errno));}
173
174/**
175 * Assert that (@p x != NULL).
176 */
177#define assert_pointer_is_not_NULL(x) {assert(x!=NULL);}
178
179/**
180 * close() @p x and log a message if it fails.
181 */
182#define paranoid_close(x) {if(close(x)) {mr_msg(5, "close err");} x=-999; }
183
184/**
185 * fclose() @p x and log a message if it fails.
186 */
187#define paranoid_fclose(x) {if(fclose(x)) {mr_msg(5, "fclose err");} x=NULL; }
188
189/**
190 * pclose() @p x and log a message if it fails.
191 */
192#define paranoid_pclose(x) {if(pclose(x)) {mr_msg(5, "pclose err");} x=NULL; }
193
194/**
195 * Run the command @p x and log it if it fails.
196 */
197#define paranoid_system(x) {if(system(x)) mr_msg(4, x); }
198
199/**
200 * Free variables and call finish(@p x).
201 */
202#define paranoid_MR_finish(x) {free_MR_global_filenames (); finish(x); }
203
204/**
205 * Log file, function, line, and @p x.
206 */
207#define iamhere(x) {mr_msg(2, x);}
208
209/**
210 * Yes, we want malloc() to help us fix bugs.
211 */
212#define MALLOC_CHECK_ 1
213
214/**
215 * Malloc @p x to be MAX_STR_LEN bytes and call fatal_error() if we're out of memory.
216 */
217#define malloc_string(x) { x = (char *)mr_malloc(MAX_STR_LEN); x[0] = x[1] = '\0'; }
218
219/**
220 * Path to the location the hard drive is mounted on during a restore.
221 */
222#define MNT_RESTORING "/mnt/RESTORING"
223
224/** @def VANILLA_SCSI_TAPE  The SCSI tape radical on the system (most likely to be the one towrite to. */
225/** @def DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE A string whose presence in a device name indicates the
226 * inability to check this device for errors in the mountlist. */
227/** @def RAID_DEVICE_STUB The stub of a RAID device (set up RAID if we find it). */
228/** @def SANE_FORMATS Sane formats for this OS, separated by spaces. */
229/** @def ALT_TAPE The first IDE tape in the system. */
230/** @def MKE2FS_OR_NEWFS @c mke2fs or @c newfs, depending on the OS. */
231/** @def CP_BIN The GNU @c cp binary to use. */
232#ifdef __FreeBSD__
233#define VANILLA_SCSI_TAPE   "/dev/sa"
234#define VANILLA_USB_DEVICE  "tobegivenbybsdguru"
235#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/vinum/"
236#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
237#define SANE_FORMATS        "swap image msdosfs nfs ntfs raid lvm ffs ufs ext2fs"
238#define ALT_TAPE        "/dev/ast"
239#define MKE2FS_OR_NEWFS "newfs"
240#define CP_BIN      "gcp"
241#else
242#define VANILLA_SCSI_TAPE   "/dev/st0"
243#define VANILLA_USB_DEVICE  "/dev/hda"
244#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/md"
245#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
246#define SANE_FORMATS        "swap image vfat ext2 ext3 xfs vfs jfs reiserfs dos minix coda nfs ntfs hpfs raid lvm cifs"
247#define ALT_TAPE        "/dev/ht0"
248#define MKE2FS_OR_NEWFS "mke2fs"
249#define CP_BIN      "cp"
250#endif
251
252
253/**
254 * The template for a filelist filename.
255 * The first argument (%s) is the tempdir and the second (%d) is the filelist number.
256 */
257#define FILELIST_FNAME_RAW_SZ "%s/filelist.%ld"
258
259#define XATTR_LIST_FNAME_RAW_SZ      "%s/xattr_list.%ld.gz"
260#define XATTR_BIGGLST_FNAME_RAW_SZ   "%s/xattr_list.big.gz"
261#define ACL_LIST_FNAME_RAW_SZ        "%s/acl_list.%ld.gz"
262#define ACL_BIGGLST_FNAME_RAW_SZ     "%s/acl_list.big.gz"
263
264/**
265 * The template for an afioball filename.
266 * The first argument (%s) is the tempdir and the second (%d) is the filelist number.
267 */
268#define AFIOBALL_FNAME_RAW_SZ (bkpinfo->use_star)?"%s/tmpfs/%ld.star.%s":"%s/tmpfs/%ld.afio.%s"
269#define ARCH_THREADS 2          ///< The number of simultaneous threads running afio in the background.
270#define ARCH_BUFFER_NUM (ARCH_THREADS*4)    // Number of permissible queued afio files
271#define PPCFG_RAMDISK_SIZE 350  ///< Size of the tmpfs, in megabytes, to attempt to mount (to speed up Mondo).
272
273/**
274 * Shorter log command
275 */
276#define log_it(format, args...) mr_msg(2, format, ## args)
277
278#define SZ_NTFSPROG_VOLSIZE "1048576"   // was 4096
279#define NTFSPROG_PARAMS "-z0 -V" SZ_NTFSPROG_VOLSIZE " -o -b -d -g1"
280
281#define MNT_CDROM "/mnt/cdrom"
282
283#endif                          /* _MY_STUFF_H_ */
Note: See TracBrowser for help on using the repository browser.