source: MondoRescue/branches/2.2.9/mondo/test/test-mountlist.c@ 2209

Last change on this file since 2209 was 2209, checked in by Bruno Cornec, 15 years ago
  • Use new libmr.a in build process
  • Use mr_strcat to fix a memory allocation bug when mountlist contains lots of references unavailable at restore time, creating a error when memory is statically allocated (more usage is expected now).
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1#include <stdio.h>
2#include "my-stuff.h"
3#include "../common/mondostructures.h"
4#include "../common/libmondo.h"
5#include "../mondorestore/mondorestore.h"
6#include "../mondorestore/mr-externs.h"
7
8extern void twenty_seconds_til_yikes(void);
9
10/* Reference to global bkpinfo */
11struct s_bkpinfo *bkpinfo;
12
13extern bool g_text_mode;
14extern FILE *g_fprep;
15extern double g_kernel_version;
16extern int g_partition_table_locked_up;
17extern int g_noof_rows;
18
19bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
20bool g_I_have_just_nuked = FALSE;
21char *g_isodir_device;
22char *g_isodir_format;
23char *g_biggielist_txt;
24char *g_filelist_full;
25char *g_filelist_imagedevs;
26char *g_imagedevs_restthese;
27
28char *g_mondo_cfg_file;
29
30char *g_mountlist_fname;
31char *g_mondo_home;
32
33char *g_getfacl;
34char *g_getfattr;
35
36extern char *MONDO_LOGFILE;
37extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction);
38/* We don't have a cleanup function yet */
39void (*mr_cleanup)(void) = NULL;
40
41void main() {
42
43 struct mountlist_itself *mountlist = NULL;
44 struct raidlist_itself *raidlist;
45
46 asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
47
48 /* Globals */
49 g_loglevel = 99;
50 g_text_mode = FALSE;
51 g_main_pid = getpid();
52
53 if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) {
54 fatal_error("Cannot malloc mountlist");
55 }
56 if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) {
57 fatal_error("Cannot malloc raidlist");
58 }
59 malloc_libmondo_global_strings();
60
61setup_newt_stuff();
62asprintf(&g_mountlist_fname, "/tmp/mountlist.txt");
63log_it("before mountlist");
64load_mountlist(mountlist, g_mountlist_fname);
65log_it("after mountlist");
66resize_mountlist_proportionately_to_suit_new_drives(mountlist);
67log_it("after resize_mountlist_proportionately_to_suit_new_drives");
68load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
69log_it("after load_raidtab_into_raidlist");
70edit_mountlist(g_mountlist_fname, mountlist, raidlist);
71log_it("after edit_mountlist");
72exit(0);
73}
Note: See TracBrowser for help on using the repository browser.