[2211] | 1 | /*
|
---|
| 2 | * $Id$
|
---|
| 3 | *
|
---|
| 4 | * Test program for mountlist management at restore time
|
---|
| 5 | * Cn be used on host system with valgrind easier than with mondorestore
|
---|
| 6 | */
|
---|
[2202] | 7 | #include <stdio.h>
|
---|
| 8 | #include "my-stuff.h"
|
---|
[2211] | 9 | #include "mr_mem.h"
|
---|
[2202] | 10 | #include "../common/mondostructures.h"
|
---|
| 11 | #include "../common/libmondo.h"
|
---|
| 12 | #include "../mondorestore/mondorestore.h"
|
---|
[2204] | 13 | #include "../mondorestore/mr-externs.h"
|
---|
[2202] | 14 |
|
---|
| 15 | extern void twenty_seconds_til_yikes(void);
|
---|
| 16 |
|
---|
| 17 | /* Reference to global bkpinfo */
|
---|
| 18 | struct s_bkpinfo *bkpinfo;
|
---|
| 19 |
|
---|
| 20 | extern bool g_text_mode;
|
---|
| 21 | extern FILE *g_fprep;
|
---|
| 22 | extern double g_kernel_version;
|
---|
| 23 | extern int g_partition_table_locked_up;
|
---|
| 24 | extern int g_noof_rows;
|
---|
| 25 |
|
---|
| 26 | bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
|
---|
| 27 | bool g_I_have_just_nuked = FALSE;
|
---|
| 28 | char *g_isodir_device;
|
---|
| 29 | char *g_isodir_format;
|
---|
| 30 | char *g_biggielist_txt;
|
---|
| 31 | char *g_filelist_full;
|
---|
| 32 | char *g_filelist_imagedevs;
|
---|
| 33 | char *g_imagedevs_restthese;
|
---|
| 34 |
|
---|
| 35 | char *g_mondo_cfg_file;
|
---|
| 36 |
|
---|
| 37 | char *g_mountlist_fname;
|
---|
| 38 | char *g_mondo_home;
|
---|
| 39 |
|
---|
| 40 | char *g_getfacl;
|
---|
| 41 | char *g_getfattr;
|
---|
| 42 |
|
---|
| 43 | extern char *MONDO_LOGFILE;
|
---|
[2209] | 44 | extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction);
|
---|
| 45 | /* We don't have a cleanup function yet */
|
---|
| 46 | void (*mr_cleanup)(void) = NULL;
|
---|
[2202] | 47 |
|
---|
| 48 | void main() {
|
---|
| 49 |
|
---|
[2234] | 50 | struct mountlist_itself *mountlist = NULL;
|
---|
[2350] | 51 | struct raidlist_itself *raidlist = NULL;
|
---|
| 52 | char *flaws_str = NULL;
|
---|
[2204] | 53 |
|
---|
[2234] | 54 | mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
|
---|
[2202] | 55 |
|
---|
[2234] | 56 | /* Globals */
|
---|
| 57 | g_loglevel = 99;
|
---|
| 58 | g_text_mode = FALSE;
|
---|
| 59 | g_main_pid = getpid();
|
---|
[2206] | 60 |
|
---|
[2234] | 61 | if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) {
|
---|
| 62 | fatal_error("Cannot malloc mountlist");
|
---|
| 63 | }
|
---|
| 64 | if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) {
|
---|
| 65 | fatal_error("Cannot malloc raidlist");
|
---|
| 66 | }
|
---|
| 67 | malloc_libmondo_global_strings();
|
---|
[2202] | 68 |
|
---|
| 69 | setup_newt_stuff();
|
---|
[2211] | 70 | mr_asprintf(&g_mountlist_fname, "/tmp/mountlist.txt");
|
---|
[2206] | 71 | log_it("before mountlist");
|
---|
[2202] | 72 | load_mountlist(mountlist, g_mountlist_fname);
|
---|
[2206] | 73 | log_it("after mountlist");
|
---|
[2204] | 74 | resize_mountlist_proportionately_to_suit_new_drives(mountlist);
|
---|
[2206] | 75 | log_it("after resize_mountlist_proportionately_to_suit_new_drives");
|
---|
[2204] | 76 | load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
|
---|
[2206] | 77 | log_it("after load_raidtab_into_raidlist");
|
---|
[2204] | 78 | edit_mountlist(g_mountlist_fname, mountlist, raidlist);
|
---|
[2206] | 79 | log_it("after edit_mountlist");
|
---|
[2234] | 80 |
|
---|
[2394] | 81 | flaws_str = evaluate_mountlist(mountlist);
|
---|
[2234] | 82 | log_it("after evaluate_mountlist");
|
---|
[2350] | 83 | mr_free(flaws_str);
|
---|
[2235] | 84 |
|
---|
| 85 | mr_free(MONDO_LOGFILE);
|
---|
[2204] | 86 | exit(0);
|
---|
[2202] | 87 | }
|
---|