source: MondoRescue/branches/2.2.10/mondo/test/test-mountlist.c@ 2623

Last change on this file since 2623 was 2623, checked in by Bruno Cornec, 14 years ago

r3783@localhost: bruno | 2010-04-11 11:57:27 +0200

  • Use MINDI_CACHE for temp file communication between archive/restore
  • Remove some now useless globals in mondo
  • Remove function get_cfg_file_from_archive_or_bust and get_cfg_file_from_archive
  • Adds function get_cfg_file_from_initrd (Not finished)
  • Recovery doesn't work in that version atm (checkpoint version)
  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
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 */
7#include <stdio.h>
8#include "my-stuff.h"
9#include "mr_mem.h"
10#include "../common/mondostructures.h"
11#include "../common/libmondo.h"
12#include "../mondorestore/mondorestore.h"
13#include "../mondorestore/mr-externs.h"
14
15extern void twenty_seconds_til_yikes(void);
16
17/* Reference to global bkpinfo */
18struct s_bkpinfo *bkpinfo;
19
20extern bool g_text_mode;
21extern FILE *g_fprep;
22extern double g_kernel_version;
23extern int g_partition_table_locked_up;
24extern int g_noof_rows;
25
26bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
27bool g_I_have_just_nuked = FALSE;
28char *g_isodir_device;
29char *g_isodir_format;
30char *g_filelist_full;
31char *g_filelist_imagedevs;
32char *g_imagedevs_restthese;
33
34char *g_mondo_home;
35
36char *g_getfacl;
37char *g_getfattr;
38
39extern char *MONDO_LOGFILE;
40extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction);
41/* We don't have a cleanup function yet */
42void (*mr_cleanup)(int) = NULL;
43
44int main() {
45
46struct mountlist_itself *mountlist = NULL;
47struct raidlist_itself *raidlist = NULL;
48char *flaws_str = NULL;
49
50mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
51
52/* Globals */
53g_loglevel = 99;
54g_text_mode = FALSE;
55g_main_pid = getpid();
56
57if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) {
58 fatal_error("Cannot malloc mountlist");
59}
60if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) {
61 fatal_error("Cannot malloc raidlist");
62}
63malloc_libmondo_global_strings();
64
65setup_newt_stuff();
66log_it("before mountlist");
67load_mountlist(mountlist, MINDI_CACHE"/mountlist.txt");
68log_it("after mountlist");
69resize_mountlist_proportionately_to_suit_new_drives(mountlist);
70log_it("after resize_mountlist_proportionately_to_suit_new_drives");
71load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
72log_it("after load_raidtab_into_raidlist");
73edit_mountlist(MINDI_CACHE"/mountlist.txt", mountlist, raidlist);
74log_it("after edit_mountlist");
75
76flaws_str = evaluate_mountlist(mountlist);
77log_it("after evaluate_mountlist");
78mr_free(flaws_str);
79
80mr_free(MONDO_LOGFILE);
81exit(0);
82}
Note: See TracBrowser for help on using the repository browser.