Changeset 1663 in MondoRescue for branches/stable/mondo/src
- Timestamp:
- Sep 27, 2007, 12:21:18 PM (17 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive-EXT.h
r1639 r1663 2 2 3 3 4 extern int archive_this_fileset( struct s_bkpinfo *bkpinfo,char *filelist,4 extern int archive_this_fileset(char *filelist, 5 5 char *fname, int setno); 6 extern int backup_data( struct s_bkpinfo *bkpinfo);7 extern int call_mindi_to_supply_boot_disks( struct s_bkpinfo *bkpinfo);8 extern bool can_we_fit_these_files_on_media( struct s_bkpinfo *bkpinfo,6 extern int backup_data(); 7 extern int call_mindi_to_supply_boot_disks(); 8 extern bool can_we_fit_these_files_on_media( 9 9 char *files_to_add, ...); 10 extern int do_that_initial_phase( struct s_bkpinfo *bkpinfo);11 extern int do_that_final_phase( struct s_bkpinfo *bkpinfo);10 extern int do_that_initial_phase(); 11 extern int do_that_final_phase(); 12 12 extern int figure_out_kernel_path_interactively_if_necessary(char *kernel); 13 extern int make_those_slices_phase( struct s_bkpinfo *bkpinfo);14 extern int make_those_afios_phase( struct s_bkpinfo *bkpinfo);15 extern int make_slices_and_images( struct s_bkpinfo *bkpinfo,13 extern int make_those_slices_phase(); 14 extern int make_those_afios_phase(); 15 extern int make_slices_and_images( 16 16 char *biggielist_fname); 17 extern int make_iso_fs( struct s_bkpinfo *bkpinfo,char *destfile);18 extern int make_afioballs_and_images( struct s_bkpinfo *bkpinfo);19 extern int (*move_files_to_cd) ( struct s_bkpinfo *,char *, ...);20 extern int _move_files_to_cd( struct s_bkpinfo *bkpinfo,char *, ...);21 extern int (*move_files_to_stream) ( struct s_bkpinfo *,char *, ...);22 extern int _move_files_to_stream( struct s_bkpinfo *bkpinfo,17 extern int make_iso_fs(char *destfile); 18 extern int make_afioballs_and_images(); 19 extern int (*move_files_to_cd) (char *, ...); 20 extern int _move_files_to_cd(char *, ...); 21 extern int (*move_files_to_stream) (char *, ...); 22 extern int _move_files_to_stream( 23 23 char *files_to_add, ...); 24 24 extern void pause_and_ask_for_cdr(int); 25 extern int slice_up_file_etc( struct s_bkpinfo *bkpinfo,25 extern int slice_up_file_etc( 26 26 char *biggie_filename, 27 27 char *ntfsprog_fifo, … … 29 29 long noof_biggie_files, 30 30 bool use_ntfsprog); 31 extern int verify_data( struct s_bkpinfo *bkpinfo);31 extern int verify_data(); 32 32 extern void wipe_archives(char *d); 33 extern int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd); 34 extern int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo); 35 extern int call_growisofs(struct s_bkpinfo *bkpinfo, char *destfile); 36 extern int make_afioballs_and_images_SINGLETHREAD(struct s_bkpinfo 37 *bkpinfo); 38 extern int archive_this_fileset_with_star(struct s_bkpinfo *bkpinfo, 33 extern int write_iso_and_go_on(bool last_cd); 34 extern int write_final_iso_if_necessary(); 35 extern int call_growisofs(char *destfile); 36 extern int make_afioballs_and_images_SINGLETHREAD(); 37 extern int archive_this_fileset_with_star( 39 38 char *filelist, char *fname, 40 39 int setno); -
branches/stable/mondo/src/common/libmondo-archive.c
r1639 r1663 79 79 extern char *MONDO_LOGFILE; 80 80 81 /* Reference to global bkpinfo */ 82 extern struct s_bkpinfo *bkpinfo; 83 81 84 82 85 … … 198 201 199 202 int 200 archive_this_fileset_with_star(struct s_bkpinfo *bkpinfo, char *filelist, 201 char *fname, int setno) 203 archive_this_fileset_with_star(char *filelist, char *fname, int setno) 202 204 { 203 205 int retval = 0; … … 297 299 */ 298 300 int 299 archive_this_fileset(struct s_bkpinfo *bkpinfo, char *filelist, 300 char *fname, int setno) 301 archive_this_fileset(char *filelist, char *fname, int setno) 301 302 { 302 303 … … 319 320 320 321 if (bkpinfo->compression_level > 0 && bkpinfo->use_star) { 321 return (archive_this_fileset_with_star 322 (bkpinfo, filelist, fname, setno)); 322 return (archive_this_fileset_with_star(filelist, fname, setno)); 323 323 } 324 324 … … 431 431 * @ingroup archiveGroup 432 432 */ 433 int backup_data( struct s_bkpinfo *bkpinfo)433 int backup_data() 434 434 { 435 435 int retval = 0, res = 0; … … 437 437 438 438 assert(bkpinfo != NULL); 439 set_g_cdrom_and_g_dvd_to_bkpinfo_value( bkpinfo);439 set_g_cdrom_and_g_dvd_to_bkpinfo_value(); 440 440 441 441 if (bkpinfo->backup_media_type == dvd) { … … 452 452 } 453 453 454 if ((res = prepare_filelist( bkpinfo))) { /* generate scratchdir/filelist.full */454 if ((res = prepare_filelist())) { /* generate scratchdir/filelist.full */ 455 455 fatal_error("Failed to generate filelist catalog"); 456 456 } 457 if (call_filelist_chopper( bkpinfo)) {457 if (call_filelist_chopper()) { 458 458 fatal_error("Failed to run filelist chopper"); 459 459 } … … 472 472 mr_free(tmp); 473 473 474 copy_mondo_and_mindi_stuff_to_scratchdir( bkpinfo); // payload, too, if it exists474 copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists 475 475 #if __FreeBSD__ == 5 476 476 strcpy(bkpinfo->kernel_path, "/boot/kernel/kernel"); … … 486 486 #error "I don't know about this system!" 487 487 #endif 488 if ((res = call_mindi_to_supply_boot_disks( bkpinfo))) {488 if ((res = call_mindi_to_supply_boot_disks())) { 489 489 fatal_error("Failed to generate boot+data disks"); 490 490 } 491 retval += do_that_initial_phase( bkpinfo); // prepare491 retval += do_that_initial_phase(); // prepare 492 492 mr_asprintf(&tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir); 493 493 run_program_and_log_output(tmp, 1); 494 494 mr_free(tmp); 495 retval += make_those_afios_phase( bkpinfo); // backup regular files496 retval += make_those_slices_phase( bkpinfo); // backup BIG files497 retval += do_that_final_phase( bkpinfo); // clean up495 retval += make_those_afios_phase(); // backup regular files 496 retval += make_those_slices_phase(); // backup BIG files 497 retval += do_that_final_phase(); // clean up 498 498 mr_msg(1, "Creation of archives... complete."); 499 499 if (bkpinfo->verify_data) { … … 529 529 * @ingroup MLarchiveGroup 530 530 */ 531 int call_mindi_to_supply_boot_disks( struct s_bkpinfo *bkpinfo)531 int call_mindi_to_supply_boot_disks() 532 532 { 533 533 /*@ buffer ************************************************************ */ … … 1005 1005 char *curr_acl_list_fname; 1006 1006 1007 struct s_bkpinfo *bkpinfo ;1007 struct s_bkpinfo *bkpinfo_bis; 1008 1008 char *tmp = NULL; 1009 1009 int res = 0, retval = 0; … … 1020 1020 p_next_set_to_archive = (int *) (inbuf + 8); 1021 1021 p_list_of_fileset_flags = (char *) (inbuf + 12); 1022 bkpinfo = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);1022 bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET); 1023 1023 1024 1024 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, … … 1088 1088 mr_msg(4, "[%d:%d] - archiving %d...", getpid(), 1089 1089 this_thread_no, archiving_set_no); 1090 res = archive_this_fileset(bkpinfo, archiving_filelist_fname, 1090 res = 1091 archive_this_fileset(archiving_filelist_fname, 1091 1092 archiving_afioball_fname, 1092 1093 archiving_set_no); … … 1141 1142 * @ingroup MLarchiveGroup 1142 1143 */ 1143 int do_that_final_phase( struct s_bkpinfo *bkpinfo)1144 int do_that_final_phase() 1144 1145 { 1145 1146 … … 1157 1158 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1158 1159 /* write tape/cdstream */ 1159 closeout_tape( bkpinfo);1160 closeout_tape(); 1160 1161 } else { 1161 1162 /* write final ISO/USB */ 1162 res = write_final_iso_if_necessary( bkpinfo);1163 res = write_final_iso_if_necessary(); 1163 1164 retval += res; 1164 1165 if (res) { … … 1200 1201 * @ingroup MLarchiveGroup 1201 1202 */ 1202 int do_that_initial_phase( struct s_bkpinfo *bkpinfo)1203 int do_that_initial_phase() 1203 1204 { 1204 1205 /*@ int *************************************** */ … … 1309 1310 * @return The number of errors encountered (0 for success) 1310 1311 */ 1311 int make_afioballs_and_images( struct s_bkpinfo *bkpinfo)1312 int make_afioballs_and_images() 1312 1313 { 1313 1314 … … 1367 1368 _("Please wait. This may take a couple of hours."), 1368 1369 _("Working..."), 1369 get_last_filelist_number( bkpinfo) + 1);1370 get_last_filelist_number() + 1); 1370 1371 1371 1372 srand((unsigned int) getpid()); … … 1433 1434 sleep(5); 1434 1435 } 1435 strcpy(media_usage_comment, 1436 percent_media_full_comment(bkpinfo)); 1436 strcpy(media_usage_comment, percent_media_full_comment()); 1437 1437 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1438 1438 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { … … 1442 1442 storing_afioball_fname); 1443 1443 iamhere("Writing EXAT files"); 1444 res += write_EXAT_files_to_tape(bkpinfo, 1445 curr_xattr_list_fname, 1444 res += write_EXAT_files_to_tape(curr_xattr_list_fname, 1446 1445 curr_acl_list_fname); 1447 1446 // archives themselves 1448 1447 res += 1449 move_files_to_stream( bkpinfo,storing_afioball_fname,1448 move_files_to_stream(storing_afioball_fname, 1450 1449 NULL); 1451 1450 } else { 1452 1451 if (g_getfacl) { 1453 1452 if (g_getfattr) { 1454 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1453 res = move_files_to_cd(storing_filelist_fname, 1455 1454 curr_xattr_list_fname, 1456 1455 curr_acl_list_fname, 1457 1456 storing_afioball_fname, NULL); 1458 1457 } else { 1459 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1458 res = move_files_to_cd(storing_filelist_fname, 1460 1459 curr_acl_list_fname, 1461 1460 storing_afioball_fname, NULL); … … 1463 1462 } else { 1464 1463 if (g_getfattr) { 1465 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1464 res = move_files_to_cd(storing_filelist_fname, 1466 1465 curr_xattr_list_fname, 1467 1466 storing_afioball_fname, NULL); 1468 1467 } else { 1469 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1468 res = move_files_to_cd(storing_filelist_fname, 1470 1469 storing_afioball_fname, NULL); 1471 1470 } … … 1545 1544 * @return The number of errors encountered (0 for success) 1546 1545 */ 1547 int make_iso_fs( struct s_bkpinfo *bkpinfo,char *destfile)1546 int make_iso_fs(char *destfile) 1548 1547 { 1549 1548 /*@ int ********************************************** */ … … 1592 1591 mr_asprintf(&message_to_screen, "Running pre-ISO call for CD#%d", 1593 1592 g_current_media_number); 1594 res = eval_call_to_make_ISO(bkpinfo , bkpinfo->call_before_iso,1593 res = eval_call_to_make_ISO(bkpinfo->call_before_iso, 1595 1594 destfile, g_current_media_number, 1596 1595 MONDO_LOGFILE, message_to_screen); … … 1618 1617 ("Serious error(s) occurred already. I shan't try to write to media."); 1619 1618 } else { 1620 res = eval_call_to_make_ISO(bkpinfo , bkpinfo->call_make_iso,1619 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, 1621 1620 destfile, g_current_media_number, 1622 1621 MONDO_LOGFILE, message_to_screen); … … 1680 1679 pause_for_N_seconds(5, "Letting DVD drive settle"); 1681 1680 res = 1682 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_make_iso,1681 eval_call_to_make_ISO(bkpinfo->call_make_iso, 1683 1682 destfile, 1684 1683 g_current_media_number, … … 1724 1723 bkpinfo->backup_media_string, 1725 1724 g_current_media_number); 1726 res = eval_call_to_make_ISO(bkpinfo , bkpinfo->call_after_iso,1725 res = eval_call_to_make_ISO(bkpinfo->call_after_iso, 1727 1726 destfile, g_current_media_number, 1728 1727 MONDO_LOGFILE, message_to_screen); … … 1783 1782 */ 1784 1783 int 1785 make_slices_and_images( struct s_bkpinfo *bkpinfo,char *biggielist_fname)1784 make_slices_and_images(char *biggielist_fname) 1786 1785 { 1787 1786 … … 1814 1813 1815 1814 estimated_total_noof_slices = 1816 size_of_all_biggiefiles_K( bkpinfo) / bkpinfo->optimal_set_size + 1;1815 size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1; 1817 1816 1818 1817 mr_msg(1, "size of all biggiefiles = %ld", 1819 size_of_all_biggiefiles_K( bkpinfo));1818 size_of_all_biggiefiles_K()); 1820 1819 mr_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", 1821 size_of_all_biggiefiles_K( bkpinfo), bkpinfo->optimal_set_size,1820 size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, 1822 1821 estimated_total_noof_slices); 1823 1822 … … 1909 1908 } 1910 1909 res = 1911 slice_up_file_etc(b kpinfo, bigfile_fname,1910 slice_up_file_etc(bigfile_fname, 1912 1911 ntfsprog_fifo, biggie_file_number, 1913 1912 noof_biggie_files, use_ntfsprog); … … 1957 1956 * @see make_afioballs_and_images 1958 1957 */ 1959 int make_afioballs_and_images_OLD( struct s_bkpinfo *bkpinfo)1958 int make_afioballs_and_images_OLD() 1960 1959 { 1961 1960 … … 1983 1982 _("Please wait. This may take a couple of hours."), 1984 1983 _("Working..."), 1985 get_last_filelist_number( bkpinfo) + 1);1984 get_last_filelist_number() + 1); 1986 1985 1987 1986 mr_asprintf(&curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, … … 2007 2006 2008 2007 mr_msg(1, "Archiving set %ld", curr_set_no); 2009 res = archive_this_fileset( bkpinfo,curr_filelist_fname,2008 res = archive_this_fileset(curr_filelist_fname, 2010 2009 curr_afioball_fname, curr_set_no); 2011 2010 retval += res; … … 2018 2017 } 2019 2018 2020 strcpy(media_usage_comment, percent_media_full_comment( bkpinfo));2019 strcpy(media_usage_comment, percent_media_full_comment()); 2021 2020 2022 2021 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ … … 2027 2026 curr_afioball_fname); 2028 2027 iamhere("Writing EXAT files"); 2029 res += write_EXAT_files_to_tape( bkpinfo,curr_xattr_list_fname,2028 res += write_EXAT_files_to_tape(curr_xattr_list_fname, 2030 2029 curr_acl_list_fname); 2031 2030 // archives themselves 2032 res = move_files_to_stream( bkpinfo,curr_afioball_fname, NULL);2031 res = move_files_to_stream(curr_afioball_fname, NULL); 2033 2032 } else { 2034 2033 if (g_getfacl) { 2035 2034 if (g_getfattr) { 2036 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2035 res = move_files_to_cd(curr_filelist_fname, 2037 2036 curr_xattr_list_fname, 2038 2037 curr_acl_list_fname, 2039 2038 curr_afioball_fname, NULL); 2040 2039 } else { 2041 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2040 res = move_files_to_cd(curr_filelist_fname, 2042 2041 curr_acl_list_fname, 2043 2042 curr_afioball_fname, NULL); … … 2045 2044 } else { 2046 2045 if (g_getfattr) { 2047 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2046 res = move_files_to_cd(curr_filelist_fname, 2048 2047 curr_xattr_list_fname, 2049 2048 curr_afioball_fname, NULL); 2050 2049 } else { 2051 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2050 res = move_files_to_cd(curr_filelist_fname, 2052 2051 curr_afioball_fname, NULL); 2053 2052 } … … 2097 2096 * @ingroup MLarchiveGroup 2098 2097 */ 2099 int make_those_afios_phase( struct s_bkpinfo *bkpinfo)2098 int make_those_afios_phase() 2100 2099 { 2101 2100 /*@ int ******************************************* */ … … 2114 2113 mr_msg(1, 2115 2114 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2116 res = make_afioballs_and_images_OLD( bkpinfo);2115 res = make_afioballs_and_images_OLD(); 2117 2116 #else 2118 res = make_afioballs_and_images_OLD( bkpinfo);2117 res = make_afioballs_and_images_OLD(); 2119 2118 #endif 2120 2119 write_header_block_to_stream((off_t)0, "stop-afioballs", 2121 2120 BLK_STOP_AFIOBALLS); 2122 2121 } else { 2123 res = make_afioballs_and_images( bkpinfo);2122 res = make_afioballs_and_images(); 2124 2123 } 2125 2124 … … 2143 2142 * @ingroup MLarchiveGroup 2144 2143 */ 2145 int make_those_slices_phase( struct s_bkpinfo *bkpinfo)2144 int make_those_slices_phase() 2146 2145 { 2147 2146 … … 2195 2194 2196 2195 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2197 res += write_EXAT_files_to_tape( bkpinfo,xattr_fname, acl_fname);2196 res += write_EXAT_files_to_tape(xattr_fname, acl_fname); 2198 2197 mr_asprintf(&blah, "%ld", count_lines_in_file(biggielist)); 2199 2198 write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES); … … 2207 2206 } 2208 2207 2209 res = make_slices_and_images(b kpinfo, biggielist);2208 res = make_slices_and_images(biggielist); 2210 2209 mr_free(biggielist); 2211 2210 … … 2234 2233 * transfer files over the network) or leave it as is. 2235 2234 */ 2236 int (*move_files_to_cd) ( struct s_bkpinfo *,char *, ...) =2235 int (*move_files_to_cd) (char *, ...) = 2237 2236 _move_files_to_cd; 2238 2237 … … 2255 2254 * @return The number of errors encountered (0 for success) 2256 2255 */ 2257 int _move_files_to_cd( struct s_bkpinfo *bkpinfo,char *files_to_add, ...)2256 int _move_files_to_cd(char *files_to_add, ...) 2258 2257 { 2259 2258 … … 2296 2295 if (would_occupy / 1024 > bkpinfo->media_size) { 2297 2296 /* FALSE because this is not the last CD we'll write */ 2298 res = write_iso_and_go_on( bkpinfo,FALSE);2297 res = write_iso_and_go_on(FALSE); 2299 2298 retval += res; 2300 2299 if (res) { … … 2344 2343 * transfer files over the network) or leave it as is. 2345 2344 */ 2346 int (*move_files_to_stream) ( struct s_bkpinfo *,char *, ...) =2345 int (*move_files_to_stream) (char *, ...) = 2347 2346 _move_files_to_stream; 2348 2347 … … 2361 2360 */ 2362 2361 int 2363 _move_files_to_stream( struct s_bkpinfo *bkpinfo,char *files_to_add, ...)2362 _move_files_to_stream(char *files_to_add, ...) 2364 2363 { 2365 2364 … … 2405 2404 type = other; 2406 2405 } 2407 res = write_file_to_stream_from_file( bkpinfo,curr_file);2406 res = write_file_to_stream_from_file(curr_file); 2408 2407 retval += res; 2409 2408 unlink(curr_file); … … 2517 2516 } 2518 2517 log_to_screen("Scanning CD-ROM drive..."); 2519 sprintf(mtpt, "/tmp/cd.mtpt.%ld.%ld", (long int) random(), 2520 (long int) random()); 2518 sprintf(mtpt, "%s/cd.mtpt", bkpinfo->tmpdir); 2521 2519 make_hole_for_dir(mtpt); 2522 2520 … … 2670 2668 */ 2671 2669 int 2672 slice_up_file_etc( struct s_bkpinfo *bkpinfo,char *biggie_filename,2670 slice_up_file_etc(char *biggie_filename, 2673 2671 char *ntfsprog_fifo, long biggie_file_number, 2674 2672 long noof_biggie_files, bool use_ntfsprog) … … 2797 2795 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2798 2796 res = 2799 move_files_to_stream(bkpinfo, 2800 slice_fname(biggie_file_number, 0, 2797 move_files_to_stream(slice_fname(biggie_file_number, 0, 2801 2798 bkpinfo->tmpdir, ""), NULL); 2802 2799 } else { 2803 2800 res = 2804 move_files_to_cd(bkpinfo, 2805 slice_fname(biggie_file_number, 0, 2801 move_files_to_cd(slice_fname(biggie_file_number, 0, 2806 2802 bkpinfo->tmpdir, ""), NULL); 2807 2803 } … … 2823 2819 suffix)); 2824 2820 2825 mr_asprintf(&tmp, percent_media_full_comment( bkpinfo));2821 mr_asprintf(&tmp, percent_media_full_comment()); 2826 2822 update_progress_form(tmp); 2827 2823 mr_free(tmp); … … 2917 2913 maintain_collection_of_recent_archives(bkpinfo->tmpdir, 2918 2914 file_to_archive); 2919 res = move_files_to_stream( bkpinfo,file_to_archive, NULL);2915 res = move_files_to_stream(file_to_archive, NULL); 2920 2916 } else { 2921 res = move_files_to_cd( bkpinfo,file_to_archive, NULL);2917 res = move_files_to_cd(file_to_archive, NULL); 2922 2918 } 2923 2919 mr_free(file_to_archive); … … 3014 3010 * however, this occurs rarely. 3015 3011 */ 3016 int write_final_iso_if_necessary( struct s_bkpinfo *bkpinfo)3012 int write_final_iso_if_necessary() 3017 3013 { 3018 3014 /*@ int ***************************************************** */ … … 3037 3033 #endif 3038 3034 mr_free(tmp); 3039 res = write_iso_and_go_on( bkpinfo,TRUE);3035 res = write_iso_and_go_on(TRUE); 3040 3036 #ifndef _XWIN 3041 3037 if (!g_text_mode) { … … 3065 3061 * @see make_iso_fs 3066 3062 */ 3067 int write_iso_and_go_on( struct s_bkpinfo *bkpinfo,bool last_cd)3063 int write_iso_and_go_on(bool last_cd) 3068 3064 { 3069 3065 /*@ pointers **************************************************** */ … … 3147 3143 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3148 3144 if (bkpinfo->backup_media_type != usb) { 3149 res = make_iso_fs( bkpinfo,isofile);3145 res = make_iso_fs(isofile); 3150 3146 } else { 3151 3147 } … … 3168 3164 chdir("/"); 3169 3165 iamhere("Before calling verify_cd_image()"); 3170 res += verify_cd_image( bkpinfo);3166 res += verify_cd_image(); 3171 3167 iamhere("After calling verify_cd_image()"); 3172 3168 } … … 3227 3223 * @ingroup verifyGroup 3228 3224 */ 3229 int verify_data( struct s_bkpinfo *bkpinfo)3225 int verify_data() 3230 3226 { 3231 3227 int res = 0, retval = 0, cdno = 0; … … 3238 3234 mvaddstr_and_log_it(g_currentY, 0, 3239 3235 "Verifying archives against live filesystem"); 3240 verify_tape_backups( bkpinfo);3236 verify_tape_backups(); 3241 3237 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 3242 3238 } else if (bkpinfo->backup_data) … … 3245 3241 mr_msg(2, 3246 3242 "Not verifying again. Per-CD/ISO verification already carried out."); 3247 paranoid_system3248 ("cat /tmp/changed.files.* > /tmp/changed.files 2> /dev/null");3243 sprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MINDI_CACHE); 3244 paranoid_system(tmp); 3249 3245 } else { 3250 3246 g_current_media_number = cdno; … … 3258 3254 } 3259 3255 if (bkpinfo->backup_media_type != iso) { 3260 insist_on_this_cd_number( bkpinfo,cdno);3261 } 3262 res = verify_cd_image( bkpinfo); // sets verify_data to FALSE if it's time to stop verifying3256 insist_on_this_cd_number(cdno); 3257 } 3258 res = verify_cd_image(); // sets verify_data to FALSE if it's time to stop verifying 3263 3259 retval += res; 3264 3260 if (res) { 3265 3261 mr_asprintf(&tmp, 3266 3267 bkpinfo->backup_media_string,3268 3262 "Warnings/errors were reported while checking %s #%d", 3263 media_descriptor_string(bkpinfo->backup_media_type), 3264 g_current_media_number); 3269 3265 log_to_screen(tmp); 3270 3266 mr_free(tmp); … … 3273 3269 } 3274 3270 mr_asprintf(&tmp, 3275 "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> /tmp/changed.files",3276 MONDO_LOGFILE);3271 "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", 3272 MONDO_LOGFILE, MINDI_CACHE); 3277 3273 system(tmp); 3278 3274 mr_free(tmp); 3279 3275 3280 3276 mr_asprintf(&tmp, 3281 "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> /tmp/changed.files",3282 MONDO_LOGFILE);3277 "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", 3278 MONDO_LOGFILE, MINDI_CACHE); 3283 3279 system(tmp); 3284 3280 mr_free(tmp); … … 3287 3283 eject_device(bkpinfo->media_device); 3288 3284 } 3289 diffs = count_lines_in_file("/tmp/changed.files"); 3285 sprintf(tmp, "%s/changed.files", MINDI_CACHE); 3286 diffs = count_lines_in_file(tmp); 3290 3287 3291 3288 if (diffs > 0) { -
branches/stable/mondo/src/common/libmondo-archive.h
r1639 r1663 3 3 */ 4 4 5 int archive_this_fileset( struct s_bkpinfo *bkpinfo,char *filelist,5 int archive_this_fileset(char *filelist, 6 6 char *fname, int setno); 7 int backup_data( struct s_bkpinfo *bkpinfo);8 int call_mindi_to_supply_boot_disks( struct s_bkpinfo *bkpinfo);9 bool can_we_fit_these_files_on_media( struct s_bkpinfo *bkpinfo,7 int backup_data(); 8 int call_mindi_to_supply_boot_disks(); 9 bool can_we_fit_these_files_on_media( 10 10 char *files_to_add, ...); 11 int do_that_initial_phase( struct s_bkpinfo *bkpinfo);12 int do_that_final_phase( struct s_bkpinfo *bkpinfo);11 int do_that_initial_phase(); 12 int do_that_final_phase(); 13 13 int figure_out_kernel_path_interactively_if_necessary(char *kernel); 14 14 bool get_bit_N_of_array(char *array, int N); 15 int make_those_slices_phase( struct s_bkpinfo *bkpinfo);16 int make_those_afios_phase( struct s_bkpinfo *bkpinfo);17 int make_slices_and_images( struct s_bkpinfo *bkpinfo,15 int make_those_slices_phase(); 16 int make_those_afios_phase(); 17 int make_slices_and_images( 18 18 char *biggielist_fname); 19 int make_iso_fs( struct s_bkpinfo *bkpinfo,char *destfile);20 int make_afioballs_and_images( struct s_bkpinfo *bkpinfo);21 extern int (*move_files_to_cd) ( struct s_bkpinfo *,char *, ...);22 int _move_files_to_cd( struct s_bkpinfo *bkpinfo,char *files_to_add, ...);23 extern int (*move_files_to_stream) ( struct s_bkpinfo *,char *, ...);24 int _move_files_to_stream( struct s_bkpinfo *bkpinfo,char *files_to_add,19 int make_iso_fs(char *destfile); 20 int make_afioballs_and_images(); 21 extern int (*move_files_to_cd) (char *, ...); 22 int _move_files_to_cd(char *files_to_add, ...); 23 extern int (*move_files_to_stream) (char *, ...); 24 int _move_files_to_stream(char *files_to_add, 25 25 ...); 26 26 void pause_and_ask_for_cdr(int); 27 27 void set_bit_N_of_array(char *array, int N, bool true_or_false); 28 int slice_up_file_etc( struct s_bkpinfo *bkpinfo,char *biggie_filename,28 int slice_up_file_etc(char *biggie_filename, 29 29 char *ntfsprog_fifo, 30 30 long biggie_file_number, long noof_biggie_files, 31 31 bool use_ntfsprog); 32 int verify_data( struct s_bkpinfo *bkpinfo);32 int verify_data(); 33 33 void wipe_archives(char *d); 34 int write_iso_and_go_on( struct s_bkpinfo *bkpinfo,bool last_cd);35 int write_final_iso_if_necessary( struct s_bkpinfo *bkpinfo);36 int call_growisofs( struct s_bkpinfo *bkpinfo,char *destfile);37 int make_afioballs_and_images_SINGLETHREAD( struct s_bkpinfo *bkpinfo);38 int archive_this_fileset_with_star( struct s_bkpinfo *bkpinfo,34 int write_iso_and_go_on(bool last_cd); 35 int write_final_iso_if_necessary(); 36 int call_growisofs(char *destfile); 37 int make_afioballs_and_images_SINGLETHREAD(); 38 int archive_this_fileset_with_star( 39 39 char *filelist, char *fname, int setno); 40 40 void setenv_mondo_share(void); -
branches/stable/mondo/src/common/libmondo-devices-EXT.h
r1156 r1663 7 7 extern int does_partition_exist(const char *drive, int partno); 8 8 extern bool does_string_exist_in_boot_block(char *dev, char *str); 9 extern int find_and_mount_actual_cd( struct s_bkpinfo *bkpinfo,9 extern int find_and_mount_actual_cd( 10 10 char *mountpoint); 11 11 extern int find_cdrom_device(char *output, bool try_to_mount); … … 31 31 32 32 33 extern int interactively_obtain_media_parameters_from_user(struct s_bkpinfo 34 *, bool); 35 extern void insist_on_this_cd_number(struct s_bkpinfo *bkpinfo, 33 extern int interactively_obtain_media_parameters_from_user(bool); 34 extern void insist_on_this_cd_number( 36 35 int cd_number_i_want); 37 36 38 37 39 extern int what_number_cd_is_this( struct s_bkpinfo *bkpinfo);38 extern int what_number_cd_is_this(); 40 39 41 40 … … 44 43 extern char *list_of_NFS_mounts_only(void); 45 44 46 extern void sensibly_set_tmpdir_and_scratchdir( struct s_bkpinfo *bkpinfo);45 extern void sensibly_set_tmpdir_and_scratchdir(); 47 46 48 47 … … 59 58 *incoming); 60 59 61 extern void set_g_cdrom_and_g_dvd_to_bkpinfo_value(struct s_bkpinfo 62 *bkpinfo); 60 extern void set_g_cdrom_and_g_dvd_to_bkpinfo_value(); 63 61 64 62 extern bool is_dev_an_NTFS_dev(char *bigfile_fname); -
branches/stable/mondo/src/common/libmondo-devices.c
r1638 r1663 50 50 extern struct mr_ar_conf *mr_conf; 51 51 52 extern void setup_tmpdir(char *path); 53 52 54 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = ""; 53 55 static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = ""; … … 63 65 extern t_bkptype g_backup_media_type; // set by main() 64 66 65 66 67 68 void set_g_cdrom_and_g_dvd_to_bkpinfo_value(struct s_bkpinfo *bkpinfo) 67 /* Reference to global bkpinfo */ 68 extern struct s_bkpinfo *bkpinfo; 69 70 71 72 73 void set_g_cdrom_and_g_dvd_to_bkpinfo_value() 69 74 { 70 75 strcpy(g_cdrom_drive_is_here, bkpinfo->media_device); // just in case … … 502 507 * @see mount_CDROM_here 503 508 */ 504 int find_and_mount_actual_cd( struct s_bkpinfo *bkpinfo,char *mountpoint)509 int find_and_mount_actual_cd(char *mountpoint) 505 510 { 506 511 /*@ buffers ***************************************************** */ … … 690 695 } 691 696 692 sprintf(mountpoint, " /tmp/cd.%d", (int) (random() % 32767));697 sprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir); 693 698 make_hole_for_dir(mountpoint); 694 699 … … 1321 1326 */ 1322 1327 void 1323 insist_on_this_cd_number( struct s_bkpinfo *bkpinfo,int cd_number_i_want)1328 insist_on_this_cd_number(int cd_number_i_want) 1324 1329 { 1325 1330 … … 1355 1360 run_program_and_log_output("umount " MNT_CDROM, 5); 1356 1361 } 1357 system("mkdir -p /tmp/isodir &> /dev/null"); 1362 sprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir); 1363 system(tmp); 1358 1364 mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, 1359 1365 bkpinfo->nfs_remote_dir, bkpinfo->prefix, … … 1361 1367 if (!does_file_exist(tmp)) { 1362 1368 mr_free(tmp); 1363 mr_asprintf(&tmp, " /tmp/isodir/%s/%s-%d.iso",1369 mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, 1364 1370 bkpinfo->nfs_remote_dir, bkpinfo->prefix, 1365 1371 cd_number_i_want); 1366 1372 if (does_file_exist(tmp)) { 1367 1373 mr_msg(1, 1368 "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir",1369 bkpinfo->isodir );1370 s trcpy(bkpinfo->isodir, "/tmp/isodir");1374 "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", 1375 bkpinfo->isodir, bkpinfo->tmpdir); 1376 sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir); 1371 1377 } 1372 1378 } … … 1377 1383 mr_free(tmp); 1378 1384 } 1379 if ((res = what_number_cd_is_this( bkpinfo)) != cd_number_i_want) {1385 if ((res = what_number_cd_is_this()) != cd_number_i_want) { 1380 1386 mr_msg(3, "Currently, we hold %d but we want %d", res, 1381 1387 cd_number_i_want); … … 1389 1395 mr_free(tmp); 1390 1396 1391 while (what_number_cd_is_this( bkpinfo) != cd_number_i_want) {1397 while (what_number_cd_is_this() != cd_number_i_want) { 1392 1398 sync(); 1393 1399 if (is_this_device_mounted(MNT_CDROM)) { … … 1432 1438 * @ingroup archiveGroup 1433 1439 */ 1434 int interactively_obtain_media_parameters_from_user(struct s_bkpinfo 1435 *bkpinfo, 1436 bool 1437 archiving_to_media) 1440 int interactively_obtain_media_parameters_from_user(bool archiving_to_media) 1438 1441 // archiving_to_media is TRUE if I'm being called by mondoarchive 1439 1442 // archiving_to_media is FALSE if I'm being called by mondorestore … … 1465 1468 bkptype_to_string(bkpinfo->backup_media_type)); 1466 1469 if (archiving_to_media) { 1467 sensibly_set_tmpdir_and_scratchdir( bkpinfo);1470 sensibly_set_tmpdir_and_scratchdir(); 1468 1471 } 1469 1472 bkpinfo->compression_level = … … 1566 1569 mr_msg(1, "bkpinfo->media_device = %s", bkpinfo->media_device); 1567 1570 mr_asprintf(&comment, 1568 _("Please specify your %s drive's /dev entry"), bkpinfo->backup_media_string);1571 _("Please specify your %s drive's /dev entry"), media_descriptor_string(bkpinfo->backup_media)); 1569 1572 mr_asprintf(&tmp,"/dev/cdrom"); 1570 1573 if (!popup_and_get_string … … 1731 1734 } 1732 1735 if (bkpinfo->disaster_recovery) { 1733 system("umount /tmp/isodir 2> /dev/null"); 1736 sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir); 1737 system(command); 1734 1738 if (!popup_and_get_string 1735 1739 ("NFS share", "Which remote NFS share should I mount?", … … 1740 1744 } 1741 1745 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1742 sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", 1743 (int) (random() % 32768)); 1746 sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1744 1747 mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir); 1745 1748 run_program_and_log_output(command, 5); … … 2070 2073 * @ingroup utilityGroup 2071 2074 */ 2072 void sensibly_set_tmpdir_and_scratchdir( struct s_bkpinfo *bkpinfo)2075 void sensibly_set_tmpdir_and_scratchdir() 2073 2076 { 2074 2077 char *tmp = NULL; … … 2083 2086 mr_asprintf(&tmp, 2084 2087 call_program_and_get_last_line_of_output 2085 (" df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2088 ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2086 2089 #else 2087 2090 mr_asprintf(&tmp, 2088 2091 call_program_and_get_last_line_of_output 2089 (" df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2092 ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2090 2093 #endif 2091 2094 … … 2098 2101 fatal_error("I couldn't figure out the tempdir!"); 2099 2102 } 2100 i = (int) (random() % 32768); 2101 sprintf(bkpinfo->tmpdir, "%s/tmp.mondo.%d", tmp, i); 2103 setup_tmpdir(tmp); 2102 2104 log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir); 2103 2105 2104 2106 sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%d", tmp, i); 2105 2107 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 2106 2107 sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir,2108 bkpinfo->scratchdir);2109 2108 2110 2109 mr_asprintf(&command, "rm -Rf %s/tmp.mondo.* %s/mondo.scratch.*", tmp, tmp); … … 2165 2164 * (and remain mounted after this function returns). 2166 2165 */ 2167 int what_number_cd_is_this( struct s_bkpinfo *bkpinfo)2166 int what_number_cd_is_this() 2168 2167 { 2169 2168 int cd_number = -1; -
branches/stable/mondo/src/common/libmondo-devices.h
r1156 r1663 10 10 int does_partition_exist(const char *drive, int partno); 11 11 bool does_string_exist_in_boot_block(char *dev, char *str); 12 int find_and_mount_actual_cd( struct s_bkpinfo *bkpinfo,char *mountpoint);12 int find_and_mount_actual_cd(char *mountpoint); 13 13 int find_cdrom_device(char *output, bool try_to_mount); 14 14 int find_dvd_device(char *output, bool try_to_mount); … … 28 28 int find_cdrw_device(char *cdrw_device); 29 29 30 int interactively_obtain_media_parameters_from_user(struct s_bkpinfo *, 31 bool); 30 int interactively_obtain_media_parameters_from_user(bool); 32 31 33 void insist_on_this_cd_number( struct s_bkpinfo *bkpinfo,32 void insist_on_this_cd_number( 34 33 int cd_number_i_want); 35 34 36 int what_number_cd_is_this( struct s_bkpinfo *bkpinfo);35 int what_number_cd_is_this(); 37 36 38 37 int eject_device(char *); … … 40 39 char *list_of_NFS_mounts_only(void); 41 40 42 void sensibly_set_tmpdir_and_scratchdir( struct s_bkpinfo *bkpinfo);41 void sensibly_set_tmpdir_and_scratchdir(); 43 42 44 43 … … 53 52 bool does_nonMS_partition_exist(void); 54 53 char *resolve_softlinks_to_get_to_actual_device_file(char *incoming); 55 void set_g_cdrom_and_g_dvd_to_bkpinfo_value( struct s_bkpinfo *bkpinfo);54 void set_g_cdrom_and_g_dvd_to_bkpinfo_value(); 56 55 57 56 bool is_dev_an_NTFS_dev(char *bigfile_fname); -
branches/stable/mondo/src/common/libmondo-fifo.c
r1543 r1663 200 200 /* BERLIOS: useless ? 201 201 int 202 extract_config_file_from_ramdisk( struct s_bkpinfo *bkpinfo,202 extract_config_file_from_ramdisk( 203 203 char *ramdisk_fname, 204 204 char *output_cfg_file, -
branches/stable/mondo/src/common/libmondo-filelist-EXT.h
r128 r1663 2 2 3 3 extern int chop_filelist(char *filelist, char *outdir, long maxsetsizeK); 4 extern int call_filelist_chopper( struct s_bkpinfo *bkpinfo);4 extern int call_filelist_chopper(); 5 5 extern void free_filelist(struct s_node *filelist); 6 extern int get_last_filelist_number( struct s_bkpinfo *bkpinfo);6 extern int get_last_filelist_number(); 7 7 extern int add_string_at_node(struct s_node *startnode, 8 8 char *string_to_add); … … 16 16 bool on_or_off); 17 17 extern void toggle_node_selection(struct s_node *filelist, bool on_or_off); 18 extern int prepare_filelist( struct s_bkpinfo *bkpinfo);18 extern int prepare_filelist(); 19 19 20 20 extern long save_filelist_entries_in_common(char *needles_list_fname, -
branches/stable/mondo/src/common/libmondo-filelist.c
r1639 r1663 40 40 extern char *MONDO_LOGFILE; 41 41 42 /* Reference to global bkpinfo */ 43 extern struct s_bkpinfo *bkpinfo; 44 42 45 int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir, 43 46 char *include_paths, char *excp, bool differential, … … 82 85 * @see chop_filelist 83 86 */ 84 int call_filelist_chopper( struct s_bkpinfo *bkpinfo)87 int call_filelist_chopper() 85 88 { 86 89 /*@ buffers *********************** */ … … 112 115 mr_free(filelist); 113 116 114 estimate_noof_media_required( bkpinfo,noof_sets); // for cosmetic purposes117 estimate_noof_media_required(noof_sets); // for cosmetic purposes 115 118 116 119 mr_asprintf(&tempfile, "%s/biggielist.txt", bkpinfo->tmpdir); … … 155 158 156 159 mr_msg(5, "Sorting file %s", orig_fname); 157 mr_asprintf(&tmp_fname, "/tmp/sort.%d.%d.%d", (int) (random() % 32768), 158 (int) (random() % 32768), (int) (random() % 32768)); 160 mr_asprintf(&tmp_fname, "%s/sortfile", bkpinfo->tmpdir); 159 161 160 162 if (!does_file_exist(orig_fname)) { … … 547 549 return (0); 548 550 } 549 mr_asprintf(&masklist, "/tmp/%d.%d.mask", (int) (random() % 32768), 550 (int) (random() % 32768)); 551 551 mr_asprintf(&masklist, "%s/masklist", bkpinfo->tmpdir); 552 552 mr_asprintf(&command, "cp -f %s %s", orig_msklist, masklist); 553 553 run_program_and_log_output(command, 1); … … 693 693 * @note This function should only be called at restore-time. 694 694 */ 695 int get_last_filelist_number( struct s_bkpinfo *bkpinfo)695 int get_last_filelist_number() 696 696 { 697 697 /*@ buffers ***************************************************** */ … … 1239 1239 * @see mondo_makefilelist 1240 1240 */ 1241 int prepare_filelist( struct s_bkpinfo *bkpinfo)1241 int prepare_filelist() 1242 1242 { 1243 1243 -
branches/stable/mondo/src/common/libmondo-filelist.h
r128 r1663 4 4 5 5 int chop_filelist(char *filelist, char *outdir, long maxsetsizeK); 6 int call_filelist_chopper( struct s_bkpinfo *bkpinfo);6 int call_filelist_chopper(); 7 7 void free_filelist(struct s_node *filelist); 8 int get_last_filelist_number( struct s_bkpinfo *bkpinfo);8 int get_last_filelist_number(); 9 9 int add_string_at_node(struct s_node *startnode, char *string_to_add); 10 10 struct s_node *load_filelist(char *filelist_fname); … … 17 17 bool on_or_off); 18 18 void toggle_node_selection(struct s_node *filelist, bool on_or_off); 19 int prepare_filelist( struct s_bkpinfo *bkpinfo);19 int prepare_filelist(); 20 20 21 21 long save_filelist_entries_in_common(char *needles_list_fname, -
branches/stable/mondo/src/common/libmondo-files-EXT.h
r1113 r1663 29 29 30 30 31 extern long size_of_all_biggiefiles_K(struct s_bkpinfo *bkpinfo); 32 extern void copy_mondo_and_mindi_stuff_to_scratchdir(struct s_bkpinfo 33 *bkpinfo); 34 extern void store_nfs_config(struct s_bkpinfo *bkpinfo); 31 extern long size_of_all_biggiefiles_K(); 32 extern void copy_mondo_and_mindi_stuff_to_scratchdir(); 33 extern void store_nfs_config(); 35 34 36 35 37 extern void estimate_noof_media_required( struct s_bkpinfo *bkpinfo,long);36 extern void estimate_noof_media_required(long); 38 37 39 38 extern bool is_this_file_compressed(char *); -
branches/stable/mondo/src/common/libmondo-files.c
r1594 r1663 30 30 31 31 extern int g_currentY; 32 33 /* Reference to global bkpinfo */ 34 extern struct s_bkpinfo *bkpinfo; 32 35 33 36 /** … … 680 683 * @return The total size of all biggiefiles in KB. 681 684 */ 682 long size_of_all_biggiefiles_K( struct s_bkpinfo *bkpinfo)685 long size_of_all_biggiefiles_K() 683 686 { 684 687 char *fname = NULL; … … 940 943 * - @c bkpinfo->tmpdir 941 944 */ 942 void copy_mondo_and_mindi_stuff_to_scratchdir( struct s_bkpinfo *bkpinfo)945 void copy_mondo_and_mindi_stuff_to_scratchdir() 943 946 { 944 947 /*@ Char buffers ** */ … … 1026 1029 * - @c tmpdir 1027 1030 */ 1028 void store_nfs_config( struct s_bkpinfo *bkpinfo)1031 void store_nfs_config() 1029 1032 { 1030 1033 … … 1156 1159 */ 1157 1160 void 1158 estimate_noof_media_required( struct s_bkpinfo *bkpinfo,long noof_sets)1161 estimate_noof_media_required(long noof_sets) 1159 1162 { 1160 1163 /*@ buffers *************** */ … … 1172 1175 scratchLL = 1173 1176 (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) 1174 + (long long) (size_of_all_biggiefiles_K( bkpinfo));1177 + (long long) (size_of_all_biggiefiles_K()); 1175 1178 scratchLL = (scratchLL / 1024) / bkpinfo->media_size; 1176 1179 scratchLL++; -
branches/stable/mondo/src/common/libmondo-files.h
r1113 r1663 24 24 long noof_lines_that_match_wildcard(char *filelist_fname, char *wildcard); 25 25 void register_pid(pid_t pid, char *name_str); 26 long size_of_all_biggiefiles_K( struct s_bkpinfo *bkpinfo);26 long size_of_all_biggiefiles_K(); 27 27 long long space_occupied_by_cd(char *mountpt); 28 28 int whine_if_not_found(char *fname); 29 29 int write_one_liner_data_file(char *fname, char *contents); 30 30 31 void copy_mondo_and_mindi_stuff_to_scratchdir( struct s_bkpinfo *bkpinfo);32 void store_nfs_config( struct s_bkpinfo *bkpinfo);33 void estimate_noof_media_required( struct s_bkpinfo *bkpinfo,long);31 void copy_mondo_and_mindi_stuff_to_scratchdir(); 32 void store_nfs_config(); 33 void estimate_noof_media_required(long); 34 34 bool is_this_file_compressed(char *); 35 35 -
branches/stable/mondo/src/common/libmondo-fork-EXT.h
r296 r1663 5 5 char *what_i_am_doing); 6 6 extern int run_program_and_log_output(char *program, int); 7 extern int eval_call_to_make_ISO(struct s_bkpinfo *bkpinfo, 8 char *basic_call, char *isofile, 7 extern int eval_call_to_make_ISO(char *basic_call, char *isofile, 9 8 int cd_no, char *logstub, 10 9 char *what_i_am_doing); -
branches/stable/mondo/src/common/libmondo-fork.c
r1626 r1663 23 23 extern bool g_text_mode; 24 24 extern char *MONDO_LOGFILE; 25 26 /* Reference to global bkpinfo */ 27 extern struct s_bkpinfo *bkpinfo; 25 28 pid_t g_buffer_pid = 0; 26 29 extern struct mr_ar_conf *mr_conf; … … 91 94 */ 92 95 int 93 eval_call_to_make_ISO(struct s_bkpinfo *bkpinfo, 94 char *basic_call, char *isofile, 96 eval_call_to_make_ISO(char *basic_call, char *isofile, 95 97 int cd_no, char *logstub, char *what_i_am_doing) 96 98 { … … 211 213 } 212 214 mr_asprintf(&callstr, 213 "%s > /tmp/mondo-run-prog-thing.tmp 2> /tmp/mondo-run-prog-thing.err",214 program);215 "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", 216 program, bkpinfo->tmpdir, bkpinfo->tmpdir); 215 217 while ((p = strchr(callstr, '\r'))) { 216 218 *p = ' '; … … 228 230 mr_free(callstr); 229 231 230 if (log_if_failure 231 && 232 system 233 ("cat /tmp/mondo-run-prog-thing.err >> /tmp/mondo-run-prog-thing.tmp 2> /dev/null")) 234 { 232 mr_asprintf(&callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir); 233 if (log_if_failure && system(callstr)) { 235 234 log_OS_error("Command failed"); 236 235 } 237 unlink("/tmp/mondo-run-prog-thing.err"); 238 fin = fopen("/tmp/mondo-run-prog-thing.tmp", "r"); 236 mr_asprintf(&tmp, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir); 237 unlink(tmp); 238 mr_free(tmp); 239 240 mr_asprintf(&tmp, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir); 241 fin = fopen(tmp, "r"); 239 242 if (fin) { 240 243 for (mr_getline(&incoming, &n, fin); !feof(fin); mr_getline(&incoming, &n, fin)) { … … 252 255 paranoid_fclose(fin); 253 256 } 254 unlink("/tmp/mondo-run-prog-thing.tmp"); 257 unlink(tmp); 258 mr_free(tmp); 259 255 260 if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) { 256 261 mr_msg(0, … … 293 298 assert_string_is_neither_NULL_nor_zerolength(basic_call); 294 299 295 mr_asprintf(&lockfile, "/tmp/mojo-jojo.blah.XXXXXX");296 mkstemp(lockfile); 300 sprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir); 301 297 302 mr_asprintf(&command, 298 303 "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", … … 363 368 char *tmp1 = NULL; 364 369 char *buf = NULL; 370 char filestr[MAX_STR_LEN]; 365 371 long int bytes_to_be_read, bytes_read_in, bytes_written_out = 366 372 0, bufcap, subsliceno = 0; … … 469 475 mr_msg(5, "tmpB is %s", tmp); 470 476 if (!strstr(tmp, PIMP_END_SZ)) { 471 ftmp = fopen("/tmp/out.leftover", "w"); 477 sprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir); 478 ftmp = fopen(filestr, "w"); 472 479 bytes_read_in = fread(tmp, 1, 64L, fin); 473 480 mr_msg(1, "bytes_read_in = %ld", bytes_read_in); … … 539 546 540 547 strcpy(title, tt); 541 strcpy(tempfile, 542 call_program_and_get_last_line_of_output 543 ("mktemp -q /tmp/mondo.XXXXXXXX")); 548 sprintf(tempfile, "%s/mondo.binperc", bkpinfo->tmpdir); 544 549 mr_asprintf(&command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, tempfile, 545 550 tempfile); -
branches/stable/mondo/src/common/libmondo-fork.h
r296 r1663 8 8 int run_program_and_log_to_screen(char *basic_call, char *what_i_am_doing); 9 9 int run_program_and_log_output(char *program, int); 10 int eval_call_to_make_ISO(struct s_bkpinfo *bkpinfo, 11 char *basic_call, char *isofile, 10 int eval_call_to_make_ISO(char *basic_call, char *isofile, 12 11 int cd_no, char *logstub, char *what_i_am_doing); 13 12 -
branches/stable/mondo/src/common/libmondo-mountlist.c
r1548 r1663 24 24 /*@unused@*/ 25 25 //static char cvsid[] = "$Id$"; 26 27 /* Reference to global bkpinfo */ 28 extern struct s_bkpinfo *bkpinfo; 26 29 27 30 /** -
branches/stable/mondo/src/common/libmondo-stream-EXT.h
r684 r1663 3 3 4 4 5 extern int closein_tape( struct s_bkpinfo *bkpinfo);6 extern int closeout_tape( struct s_bkpinfo *bkpinfo);5 extern int closein_tape(); 6 extern int closeout_tape(); 7 7 extern int find_tape_device_and_size(char *dev, char *siz); 8 8 extern void insist_on_this_tape_number(int tapeno); … … 10 10 extern int maintain_collection_of_recent_archives(char *td, 11 11 char *latest_fname); 12 extern int openin_cdstream( struct s_bkpinfo *bkpinfo);13 extern int openin_tape( struct s_bkpinfo *bkpinfo);12 extern int openin_cdstream(); 13 extern int openin_tape(); 14 14 extern int openout_cdstream(char *cddev, int speed); 15 15 extern int openout_tape(char *tapedev, long internal_tape_block_size); 16 extern int read_file_from_stream_to_file( struct s_bkpinfo *bkpinfo,16 extern int read_file_from_stream_to_file( 17 17 char *outfile, long long size); 18 extern int read_file_from_stream_to_stream( struct s_bkpinfo *bkpinfo,18 extern int read_file_from_stream_to_stream( 19 19 FILE * fout, long long size); 20 extern int read_file_from_stream_FULL( struct s_bkpinfo *bkpinfo,20 extern int read_file_from_stream_FULL( 21 21 char *outfname, FILE * foutstream, 22 22 long long orig_size); … … 30 30 extern int skip_incoming_files_until_we_find_this_one(char 31 31 *the_file_I_was_reading); 32 extern int start_to_read_from_next_tape( struct s_bkpinfo *bkpinfo);33 extern int start_to_write_to_next_tape( struct s_bkpinfo *bkpinfo);34 extern int write_backcatalog_to_tape( struct s_bkpinfo *bkpinfo);32 extern int start_to_read_from_next_tape(); 33 extern int start_to_write_to_next_tape(); 34 extern int write_backcatalog_to_tape(); 35 35 extern int write_data_disks_to_stream(char *fname); 36 extern int write_file_to_stream_from_file( struct s_bkpinfo *bkpinfo,36 extern int write_file_to_stream_from_file( 37 37 char *infile); 38 38 extern int write_header_block_to_stream(off_t length_of_incoming_file, 39 39 char *filename, int control_char); 40 40 extern void wrong_marker(int should_be, int it_is); 41 extern int closein_cdstream( struct s_bkpinfo *bkpinfo);42 extern int read_EXAT_files_from_tape( struct s_bkpinfo *bkpinfo,41 extern int closein_cdstream(); 42 extern int read_EXAT_files_from_tape( 43 43 long long *ptmp_size, char *tmp_fname, 44 44 int *pctrl_chr, char *xattr_fname, 45 45 char *acl_fname); 46 extern int write_EXAT_files_to_tape( struct s_bkpinfo *bkpinfo,46 extern int write_EXAT_files_to_tape( 47 47 char *xattr_fname, char *acl_fname); -
branches/stable/mondo/src/common/libmondo-stream.c
r1639 r1663 42 42 extern struct mr_ar_conf *mr_conf; 43 43 44 /* Reference to global bkpinfo */ 45 extern struct s_bkpinfo *bkpinfo; 46 44 47 /** 45 48 * @addtogroup globalGroup … … 127 130 * @note This should be called by restore processes only. 128 131 */ 129 int closein_cdstream( struct s_bkpinfo *bkpinfo)130 { 131 return (closein_tape( bkpinfo));132 int closein_cdstream() 133 { 134 return (closein_tape()); 132 135 } 133 136 … … 142 145 * @bug @p bkpinfo parameter is unused. 143 146 */ 144 int closein_tape( struct s_bkpinfo *bkpinfo)147 int closein_tape() 145 148 { 146 149 /*@ int's ******************************************************* */ … … 195 198 * @note This should be called by backup processes only. 196 199 */ 197 int closeout_tape( struct s_bkpinfo *bkpinfo)200 int closeout_tape() 198 201 { 199 202 /*@ int's ******************************************************* */ … … 224 227 if (should_we_write_to_next_tape 225 228 (bkpinfo->media_size, (off_t)256 * 1024)) { 226 start_to_write_to_next_tape( bkpinfo);229 start_to_write_to_next_tape(); 227 230 } 228 231 } … … 354 357 355 358 356 int read_EXAT_files_from_tape(struct s_bkpinfo *bkpinfo, 357 long long *ptmp_size, char *tmp_fname, 359 int read_EXAT_files_from_tape(long long *ptmp_size, char *tmp_fname, 358 360 int *pctrl_chr, char *xattr_fname, 359 361 char *acl_fname) … … 372 374 fatal_error("Wrong order, sunshine."); 373 375 } 374 read_file_from_stream_to_file( bkpinfo,xattr_fname, *ptmp_size);376 read_file_from_stream_to_file(xattr_fname, *ptmp_size); 375 377 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 376 378 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { … … 388 390 wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr); 389 391 } 390 read_file_from_stream_to_file( bkpinfo,acl_fname, *ptmp_size);392 read_file_from_stream_to_file(acl_fname, *ptmp_size); 391 393 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 392 394 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { … … 406 408 407 409 408 int write_EXAT_files_to_tape( struct s_bkpinfo *bkpinfo,char *xattr_fname,410 int write_EXAT_files_to_tape(char *xattr_fname, 409 411 char *acl_fname) 410 412 { … … 416 418 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 417 419 BLK_START_EXAT_FILE); 418 write_file_to_stream_from_file( bkpinfo,xattr_fname);420 write_file_to_stream_from_file(xattr_fname); 419 421 write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE); 420 422 } … … 423 425 write_header_block_to_stream(length_of_file(acl_fname), acl_fname, 424 426 BLK_START_EXAT_FILE); 425 write_file_to_stream_from_file( bkpinfo,acl_fname);427 write_file_to_stream_from_file(acl_fname); 426 428 write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE); 427 429 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, … … 570 572 * @note Equivalent to openin_tape() for now, but don't count on this behavior. 571 573 */ 572 int openin_cdstream( struct s_bkpinfo *bkpinfo)573 { 574 return (openin_tape( bkpinfo));574 int openin_cdstream() 575 { 576 return (openin_tape()); 575 577 } 576 578 … … 603 605 * @note This will also work with a cdstream for now, but don't count on this behavior. 604 606 */ 605 int openin_tape( struct s_bkpinfo *bkpinfo)607 int openin_tape() 606 608 { 607 609 /*@ buffer ***************************************************** */ … … 778 780 */ 779 781 int 780 read_file_from_stream_to_file(struct s_bkpinfo *bkpinfo, char *outfile, 781 long long size) 782 read_file_from_stream_to_file(char *outfile, long long size) 782 783 { 783 784 … … 787 788 /*@ end vars *************************************************** */ 788 789 789 res = read_file_from_stream_FULL( bkpinfo,outfile, NULL, size);790 res = read_file_from_stream_FULL(outfile, NULL, size); 790 791 791 792 return (res); … … 802 803 */ 803 804 int 804 read_file_from_stream_to_stream(struct s_bkpinfo *bkpinfo, FILE * fout, 805 long long size) 805 read_file_from_stream_to_stream(FILE * fout, long long size) 806 806 { 807 807 … … 811 811 /*@ end vars *************************************************** */ 812 812 813 res = read_file_from_stream_FULL( bkpinfo,NULL, fout, size);813 res = read_file_from_stream_FULL(NULL, fout, size); 814 814 return (res); 815 815 } … … 829 829 */ 830 830 int 831 read_file_from_stream_FULL(struct s_bkpinfo *bkpinfo, char *outfname, 832 FILE * foutstream, long long orig_size) 831 read_file_from_stream_FULL(char *outfname, FILE * foutstream, long long orig_size) 833 832 { 834 833 /*@ buffers ***************************************************** */ … … 915 914 mr_msg(4, "where_I_was_... = %lld", 916 915 where_I_was_before_tape_change); 917 start_to_read_from_next_tape( bkpinfo);916 start_to_read_from_next_tape(); 918 917 mr_msg(4, "Started reading from next tape."); 919 918 skip_incoming_files_until_we_find_this_one(temp_fname); … … 1238 1237 * @return 0 for success, nonzero for failure. 1239 1238 */ 1240 int start_to_read_from_next_tape( struct s_bkpinfo *bkpinfo)1239 int start_to_read_from_next_tape() 1241 1240 { 1242 1241 /*@ int ********************************************************* */ … … 1284 1283 * @return 0 for success, nonzero for failure. 1285 1284 */ 1286 int start_to_write_to_next_tape( struct s_bkpinfo *bkpinfo)1285 int start_to_write_to_next_tape() 1287 1286 { 1288 1287 int res = 0; … … 1339 1338 * @return 0 for success, nonzero for failure. 1340 1339 */ 1341 int write_backcatalog_to_tape( struct s_bkpinfo *bkpinfo)1340 int write_backcatalog_to_tape() 1342 1341 { 1343 1342 int res = 0; … … 1358 1357 BLK_START_AN_AFIO_OR_SLICE); 1359 1358 mr_msg(2, "Writing %s", fname); 1360 if (write_file_to_stream_from_file( bkpinfo,fname)) {1359 if (write_file_to_stream_from_file(fname)) { 1361 1360 res++; 1362 1361 mr_msg(2, "%s failed", fname); … … 1443 1442 * @return 0 for success, nonzero for failure. 1444 1443 */ 1445 int write_file_to_stream_from_file( struct s_bkpinfo *bkpinfo,char *infile)1444 int write_file_to_stream_from_file(char *infile) 1446 1445 { 1447 1446 /*@ buffers **************************************************** */ … … 1489 1488 if (should_we_write_to_next_tape 1490 1489 (bkpinfo->media_size, filesize)) { 1491 start_to_write_to_next_tape( bkpinfo);1492 write_backcatalog_to_tape( bkpinfo);1490 start_to_write_to_next_tape(); 1491 write_backcatalog_to_tape(); 1493 1492 } 1494 1493 p = strrchr(infile, '/'); … … 1528 1527 fclose(fin); 1529 1528 g_sigpipe = FALSE; 1530 start_to_write_to_next_tape( bkpinfo);1531 write_backcatalog_to_tape( bkpinfo); // kinda-sorta recursive :)1529 start_to_write_to_next_tape(); 1530 write_backcatalog_to_tape(); // kinda-sorta recursive :) 1532 1531 return (0); 1533 1532 } -
branches/stable/mondo/src/common/libmondo-stream.h
r684 r1663 5 5 6 6 7 int closein_tape( struct s_bkpinfo *bkpinfo);8 int closeout_tape( struct s_bkpinfo *bkpinfo);7 int closein_tape(); 8 int closeout_tape(); 9 9 int find_tape_device_and_size(char *dev, char *siz); 10 10 void insist_on_this_tape_number(int tapeno); 11 11 void log_tape_pos(void); 12 12 int maintain_collection_of_recent_archives(char *td, char *latest_fname); 13 int openin_cdstream( struct s_bkpinfo *bkpinfo);14 int openin_tape( struct s_bkpinfo *bkpinfo);13 int openin_cdstream(); 14 int openin_tape(); 15 15 int openout_cdstream(char *cddev, int speed); 16 16 int openout_tape(char *tapedev, long internal_tape_block_size); 17 int read_file_from_stream_to_file( struct s_bkpinfo *bkpinfo,char *outfile,17 int read_file_from_stream_to_file(char *outfile, 18 18 long long size); 19 int read_file_from_stream_to_stream( struct s_bkpinfo *bkpinfo,FILE * fout,19 int read_file_from_stream_to_stream(FILE * fout, 20 20 long long size); 21 int read_file_from_stream_FULL( struct s_bkpinfo *bkpinfo,char *outfname,21 int read_file_from_stream_FULL(char *outfname, 22 22 FILE * foutstream, long long orig_size); 23 23 int read_header_block_from_stream(long long *plen, char *filename, … … 29 29 int skip_incoming_files_until_we_find_this_one(char 30 30 *the_file_I_was_reading); 31 int start_to_read_from_next_tape( struct s_bkpinfo *bkpinfo);32 int start_to_write_to_next_tape( struct s_bkpinfo *bkpinfo);33 int write_backcatalog_to_tape( struct s_bkpinfo *bkpinfo);31 int start_to_read_from_next_tape(); 32 int start_to_write_to_next_tape(); 33 int write_backcatalog_to_tape(); 34 34 int write_data_disks_to_stream(char *fname); 35 int write_file_to_stream_from_file( struct s_bkpinfo *bkpinfo,35 int write_file_to_stream_from_file( 36 36 char *infile); 37 37 int write_header_block_to_stream(off_t length_of_incoming_file, 38 38 char *filename, int control_char); 39 39 void wrong_marker(int should_be, int it_is); 40 int closein_cdstream( struct s_bkpinfo *bkpinfo);41 int read_EXAT_files_from_tape( struct s_bkpinfo *bkpinfo,40 int closein_cdstream(); 41 int read_EXAT_files_from_tape( 42 42 long long *ptmp_size, char *tmp_fname, 43 43 int *pctrl_chr, char *xattr_fname, 44 44 char *acl_fname); 45 int write_EXAT_files_to_tape( struct s_bkpinfo *bkpinfo,char *xattr_fname,45 int write_EXAT_files_to_tape(char *xattr_fname, 46 46 char *acl_fname); -
branches/stable/mondo/src/common/libmondo-string-EXT.h
r1241 r1663 35 35 extern int severity_of_difference(char *filename, char *out_reason); 36 36 37 extern char *percent_media_full_comment( struct s_bkpinfo *bkpinfo);37 extern char *percent_media_full_comment(); 38 38 39 39 -
branches/stable/mondo/src/common/libmondo-string.c
r1591 r1663 25 25 extern int g_current_media_number; 26 26 extern long long g_tape_posK; 27 28 /* Reference to global bkpinfo */ 29 extern struct s_bkpinfo *bkpinfo; 27 30 28 31 /** … … 865 868 * @note The returned string points to static storage that will be overwritten with each call. 866 869 */ 867 char *percent_media_full_comment( struct s_bkpinfo *bkpinfo)870 char *percent_media_full_comment() 868 871 { 869 872 /*@ int *********************************************** */ -
branches/stable/mondo/src/common/libmondo-string.h
r1241 r1663 30 30 int severity_of_difference(char *filename, char *out_reason); 31 31 32 char *percent_media_full_comment( struct s_bkpinfo *bkpinfo);32 char *percent_media_full_comment(); 33 33 char *media_descriptor_string(t_bkptype); -
branches/stable/mondo/src/common/libmondo-tools-EXT.h
r1625 r1663 8 8 extern int read_cfg_var(char *config_file, char *label, char *value); 9 9 extern int write_cfg_var(char *config_file, char *label, char *value); 10 extern void reset_bkpinfo( struct s_bkpinfo *bkpinfo);10 extern void reset_bkpinfo(); 11 11 #ifdef __FreeBSD__ 12 12 extern void initialize_raidrec(struct vinum_volume *vv); … … 23 23 extern void remount_supermounts_if_necessary(void); 24 24 25 extern int post_param_configuration( struct s_bkpinfo *bkpinfo);25 extern int post_param_configuration(); 26 26 27 27 28 extern int pre_param_configuration( struct s_bkpinfo *bkpinfo);28 extern int pre_param_configuration(); 29 29 30 30 -
branches/stable/mondo/src/common/libmondo-tools.c
r1639 r1663 23 23 #include <sys/socket.h> 24 24 #include <netdb.h> 25 #include <stdlib.h> 25 26 #include <netinet/in.h> 26 27 #include <arpa/inet.h> … … 39 40 40 41 extern struct mr_ar_conf *mr_conf; 42 43 /* Reference to global bkpinfo */ 44 extern struct s_bkpinfo *bkpinfo; 41 45 42 46 /** … … 347 351 * do not exist. 348 352 */ 349 int post_param_configuration( struct s_bkpinfo *bkpinfo)353 int post_param_configuration() 350 354 { 351 355 char *extra_cdrom_params = NULL; … … 383 387 } 384 388 make_hole_for_dir(bkpinfo->scratchdir); 385 make_hole_for_dir(bkpinfo->tmpdir);386 389 if (bkpinfo->backup_media_type == iso) 387 390 make_hole_for_dir(bkpinfo->isodir); … … 620 623 } 621 624 } 622 store_nfs_config( bkpinfo);625 store_nfs_config(); 623 626 mr_free(hostname); 624 627 } … … 638 641 } 639 642 chmod(bkpinfo->scratchdir, 0700); 640 chmod(bkpinfo->tmpdir, 0700);641 643 g_backup_media_type = bkpinfo->backup_media_type; 642 644 g_backup_media_string = bkpinfo->backup_media_string; … … 652 654 * @return number of errors (0 for success) 653 655 */ 654 int pre_param_configuration( struct s_bkpinfo *bkpinfo)656 int pre_param_configuration() 655 657 { 656 658 int res = 0; 659 char *tmp = NULL; 657 660 658 661 make_hole_for_dir(MNT_CDROM); … … 660 663 srandom((unsigned long) (time(NULL))); 661 664 insmod_crucial_modules(); 662 reset_bkpinfo(bkpinfo); // also sets defaults ('/'=backup path, 3=compression level)663 665 if (bkpinfo->disaster_recovery) { 664 666 if (!does_nonMS_partition_exist()) { … … 668 670 } 669 671 670 run_program_and_log_output("rm -Rf /tmp/changed.files*", FALSE); 672 asprintf(&tmp,"rm -Rf %s/changed.files*",MINDI_CACHE); 673 run_program_and_log_output(tmp, FALSE); 674 paranoid_free(tmp); 671 675 res += some_basic_system_sanity_checks(); 672 676 if (res) { … … 678 682 } 679 683 680 684 void setup_tmpdir(char *path) { 685 686 char *tmp = NULL; 687 char *p = NULL; 688 689 if (bkpinfo->tmpdir != NULL) { 690 /* purging a potential old tmpdir */ 691 asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir); 692 system(tmp); 693 paranoid_free(tmp); 694 } 695 696 if (path != NULL) { 697 asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path); 698 } else if (getenv("TMPDIR")) { 699 asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR")); 700 } else if (getenv("TMP")) { 701 asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP")); 702 } else { 703 asprintf(&tmp, "/tmp/mondo.tmp.XXXXXX"); 704 } 705 p = mkdtemp(tmp); 706 if (p == NULL) { 707 log_it("Failed to create global tmp directory %s for Mondo.",tmp); 708 finish(-1); 709 } 710 strcpy(bkpinfo->tmpdir,p); 711 paranoid_free(tmp); 712 713 //sprintf(bkpinfo->tmpdir, "%s/tmpfs/mondo.tmp.%d", "/tmp", (int) (random() % 32768)); // for mondorestore 714 } 681 715 682 716 … … 685 719 * @param bkpinfo The @c bkpinfo to reset. 686 720 */ 687 void reset_bkpinfo( struct s_bkpinfo *bkpinfo)721 void reset_bkpinfo() 688 722 { 689 723 char *tmp = NULL; … … 694 728 /* BERLIOS : Useless ?? */ 695 729 memset((void *) bkpinfo, 0, sizeof(struct s_bkpinfo)); 730 731 /* special case for tmpdir as used eveywhere after */ 732 setup_tmpdir(NULL); 696 733 697 734 bkpinfo->manual_tray = mr_conf->manual_tray; … … 726 763 bkpinfo->scratchdir[0] = '\0'; 727 764 bkpinfo->make_filelist = TRUE; // unless -J supplied to mondoarchive 728 sprintf(bkpinfo->tmpdir, "/tmp/tmpfs/mondo.tmp.%d", (int) (random() % 32768)); // for mondorestore729 765 bkpinfo->optimal_set_size = 0; 730 766 bkpinfo->backup_media_type = none; … … 952 988 fatal_error("Please reinstall Mondo and Mindi."); 953 989 } 954 if (run_program_and_log_output 955 ("mindi --makemountlist /tmp/mountlist.txt.test", 5)) { 990 mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir); 991 if (run_program_and_log_output(tmp, 5)) { 992 log_to_screen(tmp); 956 993 log_to_screen 957 (_(" Mindi --makemountlist /tmp/mountlist.txt.testfailed for some reason."));994 (_("failed for some reason.")); 958 995 log_to_screen 959 996 (_("Please run that command by hand and examine /var/log/mindi.log")); … … 964 1001 retval++; 965 1002 } 1003 mr_free(tmp); 966 1004 967 1005 if (!run_program_and_log_output("parted2fdisk -l | grep -i raid", 1) … … 1156 1194 return (1); 1157 1195 } 1158 mr_asprintf(&tempfile, 1159 call_program_and_get_last_line_of_output 1160 ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX")); 1196 mr_asprintf(&tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir); 1161 1197 if (does_file_exist(config_file)) { 1162 1198 mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s", … … 1185 1221 { 1186 1222 if (mal) { 1187 iamhere("Malloc'ing globals");1188 1223 malloc_string(g_boot_mountpt); 1189 1224 malloc_string(g_tmpfs_mountpt); … … 1192 1227 malloc_string(g_magicdev_command); 1193 1228 } else { 1194 iamhere("Freeing globals");1195 1229 mr_free(g_boot_mountpt); 1196 1230 mr_free(g_tmpfs_mountpt); -
branches/stable/mondo/src/common/libmondo-tools.h
r1384 r1663 11 11 int read_cfg_var(char *config_file, char *label, char *value); 12 12 int write_cfg_var(char *config_file, char *label, char *value); 13 void reset_bkpinfo( struct s_bkpinfo *bkpinfo);13 void reset_bkpinfo(); 14 14 #ifdef __FreeBSD__ 15 15 void initialize_raidrec(struct vinum_volume *vv); … … 27 27 void remount_supermounts_if_necessary(void); 28 28 29 int post_param_configuration( struct s_bkpinfo *bkpinfo);29 int post_param_configuration(); 30 30 31 31 32 int pre_param_configuration( struct s_bkpinfo *bkpinfo);32 int pre_param_configuration(); 33 33 34 34 long free_space_on_given_partition(char *partition); -
branches/stable/mondo/src/common/libmondo-verify-EXT.h
r128 r1663 2 2 3 3 4 extern int verify_cd_image( struct s_bkpinfo *);5 extern int verify_a_tarball( struct s_bkpinfo *,char *);6 extern int verify_an_afioball_from_CD( struct s_bkpinfo *,char *);7 extern int verify_an_afioball_from_tape( struct s_bkpinfo *,char *,4 extern int verify_cd_image(); 5 extern int verify_a_tarball(char *); 6 extern int verify_an_afioball_from_CD(char *); 7 extern int verify_an_afioball_from_tape(char *, 8 8 long long); 9 extern int verify_a_biggiefile_from_tape( struct s_bkpinfo *,char *,9 extern int verify_a_biggiefile_from_tape(char *, 10 10 long long); 11 int verify_afioballs_from_CD( struct s_bkpinfo *);12 extern int verify_afioballs_from_tape( struct s_bkpinfo *);13 extern int verify_biggiefiles_from_tape( struct s_bkpinfo *);14 extern int verify_tape_backups( struct s_bkpinfo *);15 extern char *vfy_tball_fname( struct s_bkpinfo *,char *, int);11 int verify_afioballs_from_CD(); 12 extern int verify_afioballs_from_tape(); 13 extern int verify_biggiefiles_from_tape(); 14 extern int verify_tape_backups(); 15 extern char *vfy_tball_fname(char *, int); -
branches/stable/mondo/src/common/libmondo-verify.c
r1609 r1663 25 25 //static char cvsid[] = "$Id$"; 26 26 27 char *vfy_tball_fname(struct s_bkpinfo *, char *, int);28 29 30 27 /** 31 28 * The number of the most recently verified afioball. … … 37 34 extern char *g_getfattr; 38 35 extern char *MONDO_LOGFILE; 36 37 /* Reference to global bkpinfo */ 38 extern struct s_bkpinfo *bkpinfo; 39 40 41 /** 42 * Generate the filename of a tarball to verify. 43 * @param bkpinfo The backup information structure. @c bkpinfo->zip_suffix is the only field used. 44 * @param mountpoint The directory where the CD/DVD/ISO is mounted. 45 * @param setno The afioball number to get the location of. 46 * @return The absolute path to the afioball. 47 * @note The returned string points to static data that will be overwritten with each call. 48 * @ingroup stringGroup 49 */ 50 char *vfy_tball_fname(char *mountpoint, int setno) 51 { 52 /*@ buffers ******************************************************* */ 53 static char output[MAX_STR_LEN]; 54 55 assert(bkpinfo != NULL); 56 assert_string_is_neither_NULL_nor_zerolength(mountpoint); 57 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno, 58 bkpinfo->zip_suffix); 59 if (!does_file_exist(output)) { 60 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno, 61 bkpinfo->zip_suffix); 62 } 63 return (output); 64 } 65 39 66 40 67 /** … … 116 143 * @return The number of sets containing differences (0 for success). 117 144 */ 118 int verify_afioballs_on_CD( struct s_bkpinfo *bkpinfo,char *mountpoint)145 int verify_afioballs_on_CD(char *mountpoint) 119 146 { 120 147 … … 134 161 set_number < 9999 135 162 && 136 !does_file_exist(vfy_tball_fname 137 (bkpinfo, mountpoint, set_number)); 163 !does_file_exist(vfy_tball_fname(mountpoint, set_number)); 138 164 set_number++); 139 if (!does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, set_number))) {165 if (!does_file_exist(vfy_tball_fname(mountpoint, set_number))) { 140 166 return (0); 141 167 } … … 160 186 161 187 for (total_sets = set_number; 162 does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, total_sets));188 does_file_exist(vfy_tball_fname(mountpoint, total_sets)); 163 189 total_sets++) { 164 190 mr_msg(1, "total_sets = %d", total_sets); 165 191 } 166 192 for (; 167 does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, set_number));193 does_file_exist(vfy_tball_fname(mountpoint, set_number)); 168 194 set_number++) { 169 195 percentage = … … 173 199 mr_msg(1, "set = %d", set_number); 174 200 retval += 175 verify_an_afioball_from_CD(bkpinfo, 176 vfy_tball_fname(bkpinfo, mountpoint, 177 set_number)); 201 verify_an_afioball_from_CD(vfy_tball_fname(mountpoint, set_number)); 178 202 } 179 203 g_last_afioball_number = set_number - 1; … … 192 216 * @return The number of differences (0 for perfect biggiefiles). 193 217 */ 194 int verify_all_slices_on_CD( struct s_bkpinfo *bkpinfo,char *mtpt)218 int verify_all_slices_on_CD(char *mtpt) 195 219 { 196 220 … … 291 315 bkpinfo->restore_path, 292 316 biggiestruct.filename); 293 mr_asprintf(&tmp, "echo \"%s/%s not found\" >> /tmp/biggies.changed",317 mr_asprintf(&tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", 294 318 bkpinfo->restore_path, 295 biggiestruct.filename); 319 biggiestruct.filename, 320 bkpinfo->tmpdir); 296 321 system(tmp); 297 322 mr_free(tmp); … … 396 421 * @return 0, always. 397 422 */ 398 int verify_a_tarball( struct s_bkpinfo *bkpinfo,char *tarball_fname)423 int verify_a_tarball(char *tarball_fname) 399 424 { 400 425 /*@ buffers ********************************************************* */ … … 522 547 */ 523 548 int 524 verify_an_afioball_from_CD( struct s_bkpinfo *bkpinfo,char *tarball_fname)549 verify_an_afioball_from_CD(char *tarball_fname) 525 550 { 526 551 … … 528 553 int res = 0; 529 554 530 assert(bkpinfo != NULL);531 555 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 532 556 … … 535 559 fatal_error("Cannot verify nonexistent afioball"); 536 560 } 537 res = verify_a_tarball( bkpinfo,tarball_fname);561 res = verify_a_tarball(tarball_fname); 538 562 return (res); 539 563 } … … 550 574 */ 551 575 int 552 verify_an_afioball_from_stream(struct s_bkpinfo *bkpinfo, char *orig_fname, 553 long long size) 576 verify_an_afioball_from_stream(char *orig_fname, long long size) 554 577 { 555 578 … … 579 602 580 603 mr_asprintf(&tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p); 581 read_file_from_stream_to_file( bkpinfo,tarball_fname, size);582 res = verify_a_tarball( bkpinfo,tarball_fname);604 read_file_from_stream_to_file(tarball_fname, size); 605 res = verify_a_tarball(tarball_fname); 583 606 if (res) { 584 607 mr_msg(0, "Afioball '%s' no longer matches your live filesystem", p); … … 599 622 */ 600 623 int 601 verify_a_biggiefile_from_stream(struct s_bkpinfo *bkpinfo, 602 char *biggie_fname, long long size) 624 verify_a_biggiefile_from_stream(char *biggie_fname, long long size) 603 625 { 604 626 … … 642 664 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 643 665 } 644 res = read_file_from_stream_to_file( bkpinfo,test_file, slice_siz);666 res = read_file_from_stream_to_file(test_file, slice_siz); 645 667 unlink(test_file); 646 668 res = … … 672 694 mr_free(tmp); 673 695 674 mr_asprintf(&tmp, "echo \"%s\" >> /tmp/biggies.changed",675 biggie_fname);696 mr_asprintf(&tmp, "echo \"%s\" >> %s/biggies.changed", 697 biggie_fname, bkpinfo->tmpdir); 676 698 system(tmp); 677 699 mr_free(tmp); … … 692 714 * @return 0 for success (even if there are differences); nonzero for a tape error. 693 715 */ 694 int verify_afioballs_from_stream( struct s_bkpinfo *bkpinfo)716 int verify_afioballs_from_stream() 695 717 { 696 718 /*@ int ********************************************************** */ … … 722 744 } 723 745 log_to_screen(_("Verifying regular archives on tape")); 724 total_afioballs = get_last_filelist_number( bkpinfo) + 1;746 total_afioballs = get_last_filelist_number() + 1; 725 747 open_progress_form(_("Verifying filesystem"), 726 748 _("I am verifying archives against your live filesystem now."), … … 733 755 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 734 756 res = 735 read_EXAT_files_from_tape( bkpinfo,&size, fname, &ctrl_chr,757 read_EXAT_files_from_tape(&size, fname, &ctrl_chr, 736 758 curr_xattr_list_fname, 737 759 curr_acl_list_fname); … … 758 780 iamhere("Reading EXAT files from tape"); 759 781 res = 760 read_EXAT_files_from_tape( bkpinfo,&size, fname, &ctrl_chr,782 read_EXAT_files_from_tape(&size, fname, &ctrl_chr, 761 783 curr_xattr_list_fname, 762 784 curr_acl_list_fname); … … 772 794 mr_free(tmp); 773 795 774 res = verify_an_afioball_from_stream( bkpinfo,fname, size);796 res = verify_an_afioball_from_stream(fname, size); 775 797 if (res) { 776 798 mr_asprintf(&tmp, _("Afioball %ld differs from live filesystem"), … … 801 823 * @return 0 for success (even if there are differences); nonzero for a tape error. 802 824 */ 803 int verify_biggiefiles_from_stream( struct s_bkpinfo *bkpinfo)825 int verify_biggiefiles_from_stream() 804 826 { 805 827 … … 843 865 iamhere("Grabbing the EXAT biggiefiles"); 844 866 res = 845 read_EXAT_files_from_tape( bkpinfo,&size, orig_fname,867 read_EXAT_files_from_tape(&size, orig_fname, 846 868 &ctrl_chr, curr_xattr_list_fname, 847 869 curr_acl_list_fname); … … 883 905 orig_fname); 884 906 res = 885 verify_a_biggiefile_from_stream( bkpinfo,logical_fname, size);907 verify_a_biggiefile_from_stream(logical_fname, size); 886 908 mr_free(logical_fname); 887 909 retval += res; … … 911 933 * @ingroup verifyGroup 912 934 */ 913 int verify_cd_image( struct s_bkpinfo *bkpinfo)935 int verify_cd_image() 914 936 { 915 937 … … 949 971 popup_and_OK(_("Please push CD tray closed.")); 950 972 } 951 if (find_and_mount_actual_cd( bkpinfo,mountpoint)) {973 if (find_and_mount_actual_cd(mountpoint)) { 952 974 log_to_screen(_("failed to mount actual CD")); 953 975 return (1); … … 998 1020 mr_free(tmp); 999 1021 1000 verify_afioballs_on_CD( bkpinfo,mountpoint);1022 verify_afioballs_on_CD(mountpoint); 1001 1023 iamhere("before verify_all_slices"); 1002 verify_all_slices_on_CD( bkpinfo,mountpoint);1024 verify_all_slices_on_CD(mountpoint); 1003 1025 1004 1026 mr_asprintf(&command, "umount %s", mountpoint); … … 1045 1067 * @ingroup verifyGroup 1046 1068 */ 1047 int verify_tape_backups( struct s_bkpinfo *bkpinfo)1069 int verify_tape_backups() 1048 1070 { 1049 1071 … … 1062 1084 mr_msg(3, "verify_tape_backups --- starting"); 1063 1085 log_to_screen(_("Verifying backups")); 1064 openin_tape( bkpinfo);1086 openin_tape(); 1065 1087 1066 1088 /* verify archives themselves */ 1067 retval += verify_afioballs_from_stream( bkpinfo);1068 retval += verify_biggiefiles_from_stream( bkpinfo);1089 retval += verify_afioballs_from_stream(); 1090 retval += verify_biggiefiles_from_stream(); 1069 1091 1070 1092 /* find the final blocks */ 1071 1093 sync(); 1072 1094 sleep(2); 1073 closein_tape( bkpinfo);1095 closein_tape(); 1074 1096 1075 1097 /* close tape; exit */ 1076 paranoid_system 1077 ("rm -f /tmp/biggies.changed /tmp/changed.files.[0-9]* 2> /dev/null"); 1078 mr_asprintf(&changed_files_fname, "/tmp/changed.files.%d", 1079 (int) (random() % 32767)); 1098 mr_asprintf(&tmp,"rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir); 1099 paranoid_system(tmp); 1100 mr_free(tmp); 1101 1102 mr_asprintf(&changed_files_fname, "%s/changed.files", bkpinfo->tmpdir); 1080 1103 mr_asprintf(&tmp, 1081 1104 "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$' > %s", … … 1096 1119 mr_free(tmp); 1097 1120 1098 mr_asprintf(&tmp, "cat /tmp/biggies.changed >> %s", changed_files_fname);1121 mr_asprintf(&tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname); 1099 1122 paranoid_system(tmp); 1100 1123 mr_free(tmp); … … 1102 1125 diffs = count_lines_in_file(changed_files_fname); 1103 1126 if (diffs > 0) { 1104 mr_asprintf(&tmp, "cp -f %s %s", changed_files_fname, 1105 "/tmp/changed.files"); 1127 mr_asprintf(&tmp, "cp -f %s %s/changed.files", changed_files_fname, MINDI_CACHE); 1106 1128 run_program_and_log_output(tmp, FALSE); 1107 1129 mr_free(tmp); 1108 1130 1109 1131 mr_asprintf(&tmp, 1110 "%ld files differed from live filesystem; type less %s or less %s to see",1111 diffs, changed_files_fname, "/tmp/changed.files");1132 "%ld files differed from live filesystem; type less %s or less %s/changed.files to see", 1133 diffs, changed_files_fname, MINDI_CACHE); 1112 1134 mr_msg(0, tmp); 1113 1135 mr_free(tmp); 1114 1136 1115 1137 log_to_screen 1116 (_("See /tmp/changed.files for a list of nonmatching files."));1138 (_("See "MINDI_CACHE"/changed.files for a list of nonmatching files.")); 1117 1139 log_to_screen 1118 1140 (_("The files probably changed on filesystem, not on backup media.")); … … 1124 1146 1125 1147 1126 /**1127 * Generate the filename of a tarball to verify.1128 * @param bkpinfo The backup information structure. @c bkpinfo->zip_suffix is the only field used.1129 * @param mountpoint The directory where the CD/DVD/ISO is mounted.1130 * @param setno The afioball number to get the location of.1131 * @return The absolute path to the afioball.1132 * @note The returned string points to static data that will be overwritten with each call.1133 * @ingroup stringGroup1134 */1135 char *vfy_tball_fname(struct s_bkpinfo *bkpinfo, char *mountpoint,1136 int setno)1137 {1138 /*@ buffers ******************************************************* */1139 static char output[MAX_STR_LEN];1140 1141 assert(bkpinfo != NULL);1142 assert_string_is_neither_NULL_nor_zerolength(mountpoint);1143 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno,1144 bkpinfo->zip_suffix);1145 if (!does_file_exist(output)) {1146 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno,1147 bkpinfo->zip_suffix);1148 }1149 return (output);1150 } -
branches/stable/mondo/src/common/libmondo-verify.h
r684 r1663 21 21 22 22 /** externals *************************************************************/ 23 int close_tape( struct s_bkpinfo *);23 int close_tape(); 24 24 extern void close_progress_form(void); 25 25 extern long count_lines_in_file(char *); … … 27 27 extern void exclude_nonexistent_files(char *); 28 28 extern void fatal_error(char *); 29 extern int find_and_mount_actual_cd( struct s_bkpinfo *,char *);29 extern int find_and_mount_actual_cd(char *); 30 30 extern int find_cdrom_device(char *, bool); 31 31 extern void finish(int); 32 extern int get_last_filelist_number( struct s_bkpinfo *);32 extern int get_last_filelist_number(); 33 33 extern long get_time(void); 34 34 extern int grab_percentage_from_last_line_of_file(char *); … … 40 40 extern void open_evalcall_form(char *); 41 41 extern void open_progress_form(char *, char *, char *, char *, long); 42 extern int openin_tape( struct s_bkpinfo *);42 extern int openin_tape(); 43 43 extern void popup_and_OK(char *); 44 44 extern bool popup_and_get_string(char *, char *, char *, int); 45 extern int read_file_from_tape_to_file( struct s_bkpinfo *,char *,45 extern int read_file_from_tape_to_file(char *, 46 46 long long); 47 47 extern int read_header_block_from_tape(long long *, char *, int *); … … 62 62 63 63 64 int verify_cd_image( struct s_bkpinfo *);65 int verify_a_tarball( struct s_bkpinfo *,char *);66 int verify_an_afioball_from_CD( struct s_bkpinfo *,char *);67 int verify_an_afioball_from_tape( struct s_bkpinfo *,char *, long long);68 int verify_a_biggiefile_from_tape( struct s_bkpinfo *,char *, long long);69 int verify_afioballs_from_CD( struct s_bkpinfo *);70 int verify_afioballs_from_tape( struct s_bkpinfo *);71 int verify_biggiefiles_from_tape( struct s_bkpinfo *);72 int verify_tape_backups( struct s_bkpinfo *);73 char *vfy_tball_fname( struct s_bkpinfo *,char *, int);64 int verify_cd_image(); 65 int verify_a_tarball(char *); 66 int verify_an_afioball_from_CD(char *); 67 int verify_an_afioball_from_tape(char *, long long); 68 int verify_a_biggiefile_from_tape(char *, long long); 69 int verify_afioballs_from_CD(); 70 int verify_afioballs_from_tape(); 71 int verify_biggiefiles_from_tape(); 72 int verify_tape_backups(); 73 char *vfy_tball_fname(char *, int); 74 74 75 75 … … 92 92 extern void center_string(char *, int); 93 93 extern void close_evalcall_form(void); 94 extern int closein_tape( struct s_bkpinfo *);94 extern int closein_tape(); -
branches/stable/mondo/src/common/newt-specific.c
r1627 r1663 1282 1282 char *source_file) { 1283 1283 int i; 1284 int j = 0; 1284 1285 bool done; 1285 1286 char *tmp = NULL; 1287 char *tmp1 = NULL; 1286 1288 size_t n = 0; 1287 1289 FILE *fin = NULL; … … 1298 1300 return (1); 1299 1301 } 1302 1303 asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir); 1304 if (!(fout = fopen(tmp1, "a"))) { 1305 mr_msg(2, "Can't write to %s", tmp1); 1306 return(1); 1307 } 1308 1300 1309 mr_msg(2, "Loading %s", source_file); 1301 1310 for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM; … … 1316 1325 goto god_i_hate_gotos; 1317 1326 } 1318 if (!does_file_exist(tmp)) { 1327 if (!does_file_exist(tmp) && !feof(fin)) { 1328 fprintf(fout, "%s\n", tmp); 1329 j++; 1319 1330 goto god_i_hate_gotos; 1320 1331 } … … 1329 1340 1330 1341 paranoid_fclose(fin); 1342 paranoid_fclose(fout); 1343 1344 if (j > 0) { 1345 log_to_screen("%d files listed in %s/changed.files have been deleted since backup was made\nand are referenced in %s", j, bkpinfo->tmpdir,tmp1); 1346 } 1347 mr_free(tmp1); 1348 1331 1349 if (filelist->entries >= ARBITRARY_MAXIMUM) { 1332 1350 log_to_screen(_("Arbitrary limits suck, man!")); -
branches/stable/mondo/src/include/my-stuff.h
r1639 r1663 160 160 * Log the file, line, Mondo error message, and OS error message (errno). 161 161 */ 162 #define log_OS_error(x) {mr_msg(1, "%s, line %ld: %s (%s)", __FILE__, __LINE__, x, strerror(errno));}162 #define log_OS_error(x) {mr_msg(1, "%s, (%s)", x, strerror(errno));} 163 163 164 164 /** … … 190 190 * Free variables and call finish(@p x). 191 191 */ 192 #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (bkpinfo) mr_free (bkpinfo);finish(x); }192 #define paranoid_MR_finish(x) {free_MR_global_filenames (); finish(x); } 193 193 194 194 /** -
branches/stable/mondo/src/mondoarchive/mondo-cli-EXT.h
r1264 r1663 1 1 /* mondo-cli-EXT.h */ 2 2 3 extern int handle_incoming_parameters(int argc, char *argv[], 4 struct s_bkpinfo *bkpinfo); 5 extern int process_the_s_switch(struct s_bkpinfo *bkpinfo, char *value); 6 extern int process_switches(struct s_bkpinfo *bkpinfo, 7 char flag_val[128][MAX_STR_LEN], 3 extern int handle_incoming_parameters(int argc, char *argv[]); 4 extern int process_the_s_switch(char *value); 5 extern int process_switches(char flag_val[128][MAX_STR_LEN], 8 6 bool flag_set[128]); 9 7 extern int retrieve_switches_from_command_line(int argc, char *argv[], -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1639 r1663 25 25 extern bool g_text_mode; 26 26 extern char g_startdir[MAX_STR_LEN]; ///< ????? @bug ????? 27 extern char g_erase_tmpdir_and_scratchdir[MAX_STR_LEN];28 27 extern char g_tmpfs_mountpt[MAX_STR_LEN]; 29 28 extern bool g_sigpipe; … … 44 43 bool g_running_live = FALSE; ///< ????? @bug ????? @ingroup globalGroup 45 44 extern bool g_cd_recovery; 45 46 extern void setup_tmpdir(char *path); 46 47 47 48 /** … … 63 64 char *g_getfacl = NULL; 64 65 char *g_getfattr = NULL; 66 67 /* Reference to global bkpinfo */ 68 extern struct s_bkpinfo *bkpinfo; 65 69 66 70 /** … … 76 80 */ 77 81 int 78 handle_incoming_parameters(int argc, char *argv[], 79 struct s_bkpinfo *bkpinfo) 82 handle_incoming_parameters(int argc, char *argv[]) 80 83 { 81 84 /*@ int *** */ … … 89 92 bool flag_set[128]; 90 93 91 sensibly_set_tmpdir_and_scratchdir( bkpinfo);94 sensibly_set_tmpdir_and_scratchdir(); 92 95 93 96 for (i = 0; i < 128; i++) { … … 99 102 retval += res; 100 103 if (!retval) { 101 res = process_switches( bkpinfo,flag_val, flag_set);104 res = process_switches(flag_val, flag_set); 102 105 retval += res; 103 106 } … … 121 124 mr_free(tmp); 122 125 123 sprintf(bkpinfo->tmpdir + strlen(bkpinfo->tmpdir), "/tmp.mondo.%ld",124 random() % 32767);125 126 sprintf(bkpinfo->scratchdir + strlen(bkpinfo->scratchdir), 126 127 "/mondo.scratch.%ld", random() % 32767); … … 144 145 * @bug Return code not needed. 145 146 */ 146 int process_the_s_switch( struct s_bkpinfo *bkpinfo,char *value)147 int process_the_s_switch(char *value) 147 148 { 148 149 char *tmp = NULL; … … 180 181 */ 181 182 int 182 process_switches(struct s_bkpinfo *bkpinfo, 183 char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 183 process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 184 184 { 185 185 … … 425 425 ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 426 426 } 427 if (process_the_s_switch( bkpinfo,flag_val['s'])) {427 if (process_the_s_switch(flag_val['s'])) { 428 428 fatal_error("Bad -s switch"); 429 429 } … … 438 438 } else { /* CD|USB size */ 439 439 if (flag_set['s']) { 440 if (process_the_s_switch( bkpinfo,flag_val['s'])) {440 if (process_the_s_switch(flag_val['s'])) { 441 441 fatal_error("Bad -s switch"); 442 442 } … … 672 672 } 673 673 if (flag_set['T']) { 674 sprintf(bkpinfo->tmpdir, "%s/tmp.mondo.%ld", flag_val['T'], 675 random() % 32768); 674 setup_tmpdir(flag_val['T']); 676 675 mr_asprintf(&tmp2, "touch %s/.foo.dat", flag_val['T']); 677 676 if (run_program_and_log_output(tmp2, 1)) { … … 683 682 mr_free(tmp2); 684 683 685 mr_asprintf(&tmp2, "ln -sf %s/.foo.dat %s/.bar.dat", flag_val['T'], 686 flag_val['T']); 684 mr_asprintf(&tmp2, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir); 687 685 if (run_program_and_log_output(tmp2, 1)) { 688 686 retval++; -
branches/stable/mondo/src/mondoarchive/mondo-cli.h
r1264 r1663 3 3 */ 4 4 5 int handle_incoming_parameters(int argc, char *argv[], 6 struct s_bkpinfo *bkpinfo); 7 int process_the_s_switch(struct s_bkpinfo *bkpinfo, char *value); 8 int process_switches(struct s_bkpinfo *bkpinfo, 9 char flag_val[128][MAX_STR_LEN], bool flag_set[128]); 5 int handle_incoming_parameters(int argc, char *argv[]); 6 int process_the_s_switch(char *value); 7 int process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128]); 10 8 int retrieve_switches_from_command_line(int argc, char *argv[], 11 9 char flag_val[128][MAX_STR_LEN], -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1639 r1663 62 62 /****************** subroutines used only here ******************/ 63 63 64 /* Reference to global bkpinfo */ 65 struct s_bkpinfo *bkpinfo; 66 67 /****************** subroutines used only by main.c ******************/ 64 68 65 69 /** … … 386 390 int main(int argc, char *argv[]) 387 391 { 388 struct s_bkpinfo *bkpinfo = NULL;389 392 struct stat stbuf; 390 393 char *tmp = NULL; … … 399 402 #endif 400 403 printf(_("Initializing...\n")); 404 405 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo)); 406 reset_bkpinfo(); 401 407 402 408 /* Reference a dummy cleanup function for mr_exit temporarily */ … … 463 469 malloc_libmondo_global_strings(); 464 470 diffs = 0; 465 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));466 471 if (stat(MONDO_CACHE, &stbuf) != 0) { 467 472 mr_mkdir(MONDO_CACHE,0x755); … … 580 585 } 581 586 582 if (pre_param_configuration( bkpinfo)) {587 if (pre_param_configuration()) { 583 588 fatal_error 584 589 ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting..."); … … 591 596 g_text_mode = FALSE; 592 597 setup_newt_stuff(); 593 res = interactively_obtain_media_parameters_from_user( bkpinfo,TRUE); /* yes, archiving */598 res = interactively_obtain_media_parameters_from_user(TRUE); /* yes, archiving */ 594 599 if (res) { 595 600 fatal_error … … 597 602 } 598 603 } else { 599 res = handle_incoming_parameters(argc, argv , bkpinfo);604 res = handle_incoming_parameters(argc, argv); 600 605 if (res) { 601 606 mr_msg(1, … … 609 614 610 615 /* Finish configuring global structures */ 611 if (post_param_configuration( bkpinfo)) {616 if (post_param_configuration()) { 612 617 fatal_error 613 618 ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting..."); … … 622 627 /* If we're meant to backup then backup */ 623 628 if (bkpinfo->backup_data) { 624 res = backup_data( bkpinfo);629 res = backup_data(); 625 630 retval += res; 626 631 if (res) { … … 634 639 /* If we're meant to verify then verify */ 635 640 if (bkpinfo->verify_data) { 636 res = verify_data( bkpinfo);641 res = verify_data(); 637 642 if (res < 0) { 638 643 mr_asprintf(&say_at_end2, _("%d difference%c found."), -res, … … 657 662 } 658 663 659 660 if (length_of_file("/tmp/changed.files") > 2) { 664 if (length_of_file(MINDI_CACHE"/changed.files") > 2) { 661 665 if (g_text_mode) { 662 666 log_to_screen 663 (_("Type 'less /tmp/changed.files' to see which files don't match the archives"));667 (_("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives")); 664 668 } else { 665 669 mr_msg(1, 666 _("Type 'less /tmp/changed.files' to see which files don't match the archives"));670 _("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives")); 667 671 mr_msg(2, "Calling popup_changelist_from_file()"); 668 popup_changelist_from_file( "/tmp/changed.files");672 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 669 673 mr_msg(2, "Returned from popup_changelist_from_file()"); 670 674 } 671 675 } else { 672 unlink( "/tmp/changed.files");676 unlink(MINDI_CACHE"/changed.files"); 673 677 } 674 678 log_to_screen(say_at_end); … … 687 691 688 692 system("rm -f /var/cache/mondo-archive/last-backup.aborted"); 689 system("rm -Rf /tmp.mondo.* /mondo.scratch.*");690 693 if (!retval) { 691 694 printf(_("Mondoarchive ran OK.\n")); … … 698 701 chdir("/tmp"); // just in case there's something wrong with g_erase_tmpdir_and_scratchdir 699 702 system(g_erase_tmpdir_and_scratchdir); 703 704 /* assemble command string for deletion of Mondo's tmp directory */ 705 sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 706 700 707 free_libmondo_global_strings(); 701 708 mr_free(bkpinfo); 702 703 unlink("/tmp/filelist.full");704 unlink("/tmp/filelist.full.gz");705 709 706 710 if (!g_cdrom_drive_is_here) { … … 714 718 mr_msg(1, "Time finished: %s", mr_date()); 715 719 mr_msg_close(); 720 721 /* remove Mondo's tmp directory */ 722 system(tmp); 723 paranoid_free(tmp); 716 724 717 725 if (!g_text_mode) { -
branches/stable/mondo/src/mondorestore/mondo-restore-EXT.h
r1213 r1663 25 25 26 26 extern void ask_about_these_imagedevs(char *, char *); 27 extern int catchall_mode(struct s_bkpinfo *, structmountlist_itself *,27 extern int catchall_mode(struct mountlist_itself *, 28 28 struct raidlist_itself *); 29 29 extern void sort_mountlist_by_device(struct mountlist_itself *); 30 extern int interactive_mode(struct s_bkpinfo *, structmountlist_itself *,30 extern int interactive_mode(struct mountlist_itself *, 31 31 struct raidlist_itself *); 32 extern int nuke_mode(struct s_bkpinfo *, structmountlist_itself *,32 extern int nuke_mode(struct mountlist_itself *, 33 33 struct raidlist_itself *); 34 extern int compare_mode(struct s_bkpinfo *, structmountlist_itself *,34 extern int compare_mode(struct mountlist_itself *, 35 35 struct raidlist_itself *); 36 extern int iso_mode( struct s_bkpinfo *bkpinfo,36 extern int iso_mode( 37 37 struct mountlist_itself *mountlist, 38 38 struct raidlist_itself *raidlist, bool nuke_me_please); 39 39 extern int load_mountlist(struct mountlist_itself *, char *); 40 40 extern int load_raidtab_into_raidlist(struct raidlist_itself *, char *); 41 extern int restore_mode(struct s_bkpinfo *, structmountlist_itself *,41 extern int restore_mode(struct mountlist_itself *, 42 42 struct raidlist_itself *); 43 43 extern int save_raidlist_to_raidtab(struct raidlist_itself *, char *); 44 44 extern void process_raidtab_line(FILE *, struct raid_device_record *, 45 45 char *, char *); 46 extern int restore_a_biggiefile_from_CD( struct s_bkpinfo *,long,46 extern int restore_a_biggiefile_from_CD(long, 47 47 struct s_node *); 48 extern int restore_a_biggiefile_from_stream( struct s_bkpinfo *,char *,48 extern int restore_a_biggiefile_from_stream(char *, 49 49 long, char *, long long, 50 50 struct s_node *); 51 51 extern int restore_a_tarball_from_CD(char *, int, struct s_node *, struct s_bkpinfo *); 52 extern int restore_a_tarball_from_stream( struct s_bkpinfo *,char *, int,52 extern int restore_a_tarball_from_stream(char *, int, 53 53 struct s_node *, long long); 54 extern int restore_all_biggiefiles_from_CD( struct s_bkpinfo *,54 extern int restore_all_biggiefiles_from_CD( 55 55 struct s_node *); 56 extern int restore_all_biggiefiles_from_stream( struct s_bkpinfo *,56 extern int restore_all_biggiefiles_from_stream( 57 57 struct s_node *); 58 extern int restore_all_tarballs_from_CD( struct s_bkpinfo *,58 extern int restore_all_tarballs_from_CD( 59 59 struct s_node *); 60 extern int restore_all_tarballs_from_stream( struct s_bkpinfo *,60 extern int restore_all_tarballs_from_stream( 61 61 struct s_node *); 62 extern int restore_everything(struct s_ bkpinfo *, struct s_node *);63 extern int restore_live_from_monitas_server( struct s_bkpinfo *,char *,62 extern int restore_everything(struct s_node *); 63 extern int restore_live_from_monitas_server(char *, 64 64 char *, char *); 65 extern int restore_to_live_filesystem( struct s_bkpinfo *);65 extern int restore_to_live_filesystem(); 66 66 extern void swap_mountlist_entries(struct mountlist_itself *, int, int); 67 67 extern void sort_mountlist_by_mountpoint(struct mountlist_itself *, bool); … … 74 74 extern int save_raidlist_to_raidtab(struct raidlist_itself *raidlist, 75 75 char *fname); 76 extern int what_number_cd_is_this( struct s_bkpinfo *);76 extern int what_number_cd_is_this(); 77 77 78 78 #ifdef __FreeBSD__ -
branches/stable/mondo/src/mondorestore/mondo-restore.h
r1200 r1663 8 8 9 9 void ask_about_these_imagedevs(char *, char *); 10 int catchall_mode(struct s_bkpinfo *, structmountlist_itself *,10 int catchall_mode(struct mountlist_itself *, 11 11 struct raidlist_itself *); 12 int interactive_mode(struct s_bkpinfo *, structmountlist_itself *,12 int interactive_mode(struct mountlist_itself *, 13 13 struct raidlist_itself *); 14 int nuke_mode(struct s_bkpinfo *, structmountlist_itself *,14 int nuke_mode(struct mountlist_itself *, 15 15 struct raidlist_itself *); 16 int compare_mode(struct s_bkpinfo *, structmountlist_itself *,16 int compare_mode(struct mountlist_itself *, 17 17 struct raidlist_itself *); 18 int iso_mode(struct s_bkpinfo *bkpinfo, structmountlist_itself *mountlist,18 int iso_mode(struct mountlist_itself *mountlist, 19 19 struct raidlist_itself *raidlist, bool nuke_me_please); 20 int restore_mode(struct s_bkpinfo *, structmountlist_itself *,20 int restore_mode(struct mountlist_itself *, 21 21 struct raidlist_itself *); 22 int restore_a_biggiefile_from_CD( struct s_bkpinfo *,long, struct s_node *,22 int restore_a_biggiefile_from_CD(long, struct s_node *, 23 23 char *); 24 int restore_a_biggiefile_from_stream( struct s_bkpinfo *,char *, long,24 int restore_a_biggiefile_from_stream(char *, long, 25 25 char *, long long, struct s_node *, 26 26 int, char *); 27 27 int restore_a_tarball_from_CD(char *, long, struct s_node *, struct s_bkpinfo *); 28 int restore_a_tarball_from_stream( struct s_bkpinfo *,char *, long,28 int restore_a_tarball_from_stream(char *, long, 29 29 struct s_node *, long long, char *, 30 30 char *); 31 int restore_all_biggiefiles_from_CD(struct s_ bkpinfo *, struct s_node *);32 int restore_all_biggiefiles_from_stream( struct s_bkpinfo *,31 int restore_all_biggiefiles_from_CD(struct s_node *); 32 int restore_all_biggiefiles_from_stream( 33 33 struct s_node *); 34 int restore_all_tarballs_from_CD(struct s_ bkpinfo *, struct s_node *);35 int restore_all_tarballs_from_stream(struct s_ bkpinfo *, struct s_node *);36 int restore_everything(struct s_ bkpinfo *, struct s_node *);37 int restore_live_from_monitas_server( struct s_bkpinfo *,char *, char *,34 int restore_all_tarballs_from_CD(struct s_node *); 35 int restore_all_tarballs_from_stream(struct s_node *); 36 int restore_everything(struct s_node *); 37 int restore_live_from_monitas_server(char *, char *, 38 38 char *); 39 int restore_to_live_filesystem( struct s_bkpinfo *);39 int restore_to_live_filesystem(); 40 40 void swap_mountlist_entries(struct mountlist_itself *, int, int); 41 41 void sort_mountlist_by_mountpoint(struct mountlist_itself *, bool); 42 42 void sort_mountlist_by_device(struct mountlist_itself *); 43 int what_number_cd_is_this( struct s_bkpinfo *);43 int what_number_cd_is_this(); -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare-EXT.h
r1200 r1663 4 4 5 5 6 extern int compare_to_CD(struct s_bkpinfo *); 7 extern int compare_to_cdstream(struct s_bkpinfo *); 8 extern int compare_to_tape(struct s_bkpinfo *); 9 extern int compare_mode(struct s_bkpinfo *bkpinfo, 10 struct mountlist_itself *mountlist, 6 extern int compare_to_CD(); 7 extern int compare_to_cdstream(); 8 extern int compare_to_tape(); 9 extern int compare_mode(struct mountlist_itself *mountlist, 11 10 struct raidlist_itself *raidlist); -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
r1638 r1663 19 19 extern char *MONDO_LOGFILE; 20 20 21 /* Reference to global bkpinfo */ 22 extern struct s_bkpinfo *bkpinfo; 23 21 24 //static char cvsid[] = "$Id$"; 22 25 … … 34 37 * @note This function uses an MD5 checksum. 35 38 */ 36 int compare_a_biggiefile( struct s_bkpinfo *bkpinfo,long bigfileno)39 int compare_a_biggiefile(long bigfileno) 37 40 { 38 41 … … 58 61 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 59 62 if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 60 insist_on_this_cd_number( bkpinfo,(++g_current_media_number));63 insist_on_this_cd_number((++g_current_media_number)); 61 64 } else { 62 65 mr_msg(2, "No CD's left. No biggiefiles left. No problem."); … … 133 136 134 137 if (retval) { 135 if (!(fout = fopen( "/tmp/changed.txt", "a"))) {138 if (!(fout = fopen(MINDI_CACHE"/changed.txt", "a"))) { 136 139 fatal_error("Cannot openout changed.txt"); 137 140 } … … 151 154 /** 152 155 * Compare all biggiefiles in the backup. 153 * @param bkpinfo The backup information structure. Used only in compare_a_biggiefile().154 156 * @return 0 for success, nonzero for failure. 155 157 */ 156 int compare_all_biggiefiles( struct s_bkpinfo *bkpinfo)158 int compare_all_biggiefiles() 157 159 { 158 160 int retval = 0; … … 161 163 char *tmp = NULL; 162 164 163 assert(bkpinfo != NULL);164 165 mr_msg(1, "Comparing biggiefiles"); 165 166 … … 187 188 mr_free(tmp); 188 189 189 res = compare_a_biggiefile(b kpinfo, bigfileno);190 res = compare_a_biggiefile(bigfileno); 190 191 retval += res; 191 192 g_current_progress++; … … 303 304 if (length_of_file(logfile) > 5) { 304 305 mr_asprintf(&command, 305 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> /tmp/changed.txt",306 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MINDI_CACHE"/changed.txt", 306 307 logfile); 307 308 system(command); … … 330 331 * @return 0 for success, nonzero for failure. 331 332 */ 332 int compare_all_tarballs( struct s_bkpinfo *bkpinfo)333 int compare_all_tarballs() 333 334 { 334 335 int retval = 0; … … 361 362 362 363 for (;;) { 363 insist_on_this_cd_number( bkpinfo,g_current_media_number);364 insist_on_this_cd_number(g_current_media_number); 364 365 update_progress_form(progress_str); 365 366 mr_asprintf(&tarball_fname, … … 441 442 * @return 0 for success, nonzero for failure. 442 443 */ 443 int compare_to_CD( struct s_bkpinfo *bkpinfo)444 int compare_to_CD() 444 445 { 445 446 /** needs malloc *********/ … … 460 461 chdir(bkpinfo->restore_path); 461 462 getcwd(new, MAX_STR_LEN - 1); 462 insist_on_this_cd_number( bkpinfo,g_current_media_number);463 unlink( "/tmp/changed.txt");464 465 resA = compare_all_tarballs( bkpinfo);466 resB = compare_all_biggiefiles( bkpinfo);463 insist_on_this_cd_number(g_current_media_number); 464 unlink(MINDI_CACHE"/changed.txt"); 465 466 resA = compare_all_tarballs(); 467 resB = compare_all_biggiefiles(); 467 468 chdir(cwd); 468 noof_changed_files = count_lines_in_file( "/tmp/changed.txt");469 noof_changed_files = count_lines_in_file(MINDI_CACHE"/changed.txt"); 469 470 if (noof_changed_files) { 470 471 log_to_screen(_("%ld files do not match the backup "), 471 472 noof_changed_files); 472 mr_asprintf(&command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);473 mr_asprintf(&command, "cat "MINDI_CACHE"/changed.txt >> %s", MONDO_LOGFILE); 473 474 paranoid_system(command); 474 475 mr_free(command); … … 501 502 */ 502 503 int 503 compare_mode(struct s_bkpinfo *bkpinfo, 504 struct mountlist_itself *mountlist, 504 compare_mode(struct mountlist_itself *mountlist, 505 505 struct raidlist_itself *raidlist) 506 506 { … … 522 522 assert(raidlist != NULL); 523 523 524 while (get_cfg_file_from_archive( bkpinfo)) {524 while (get_cfg_file_from_archive()) { 525 525 if (!ask_me_yes_or_no 526 526 (_ … … 529 529 fatal_error("Unable to find config file/archives. Aborting."); 530 530 } 531 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);532 } 533 534 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);531 interactively_obtain_media_parameters_from_user(FALSE); 532 } 533 534 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 535 535 g_current_media_number = 1; 536 536 mvaddstr_and_log_it(1, 30, _("Comparing Automatically")); … … 544 544 if (bkpinfo->backup_media_type == tape 545 545 || bkpinfo->backup_media_type == udev) { 546 retval += compare_to_tape( bkpinfo);546 retval += compare_to_tape(); 547 547 } else if (bkpinfo->backup_media_type == cdstream) { 548 retval += compare_to_cdstream( bkpinfo);549 } else { 550 retval += compare_to_CD( bkpinfo);548 retval += compare_to_cdstream(); 549 } else { 550 retval += compare_to_CD(); 551 551 } 552 552 if (retval) { … … 557 557 } 558 558 559 if (count_lines_in_file( "/tmp/changed.txt") > 0) {559 if (count_lines_in_file(MINDI_CACHE"/changed.txt") > 0) { 560 560 mvaddstr_and_log_it(g_currentY++, 0, 561 561 _ 562 562 ("Differences found while files were being compared.")); 563 streamline_changes_file( "/tmp/changed.files", "/tmp/changed.txt");564 if (count_lines_in_file( "/tmp/changed.files") <= 0) {563 streamline_changes_file(MINDI_CACHE"/changed.files", MINDI_CACHE"/changed.txt"); 564 if (count_lines_in_file(MINDI_CACHE"/changed.files") <= 0) { 565 565 mvaddstr_and_log_it(g_currentY++, 0, 566 566 _ … … 569 569 ("The differences were logfiles and temporary files. Your archives are fine.")); 570 570 } else { 571 q = count_lines_in_file( "/tmp/changed.files");571 q = count_lines_in_file(MINDI_CACHE"/changed.files"); 572 572 mr_asprintf(&tmp, _("%ld significant difference%s found."), q, 573 573 (q != 1) ? "s" : ""); … … 586 586 chdir(bkpinfo->restore_path); 587 587 getcwd(new, MAX_STR_LEN - 1); 588 popup_changelist_from_file( "/tmp/changed.files");588 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 589 589 mr_msg(2, "Returning from popup_changelist_from_file()"); 590 590 chdir(cwd); … … 616 616 * @return 0 for success, nonzero for failure. 617 617 */ 618 int compare_to_cdstream( struct s_bkpinfo *bkpinfo)618 int compare_to_cdstream() 619 619 { 620 620 int res; … … 642 642 last_line_of_file("/tmp/CDROM-LIVES-HERE")); 643 643 } 644 res = verify_tape_backups( bkpinfo);644 res = verify_tape_backups(); 645 645 chdir(dir); 646 if (length_of_file( "/tmp/changed.txt") > 2647 && length_of_file( "/tmp/changed.files") > 2) {646 if (length_of_file(MINDI_CACHE"/changed.txt") > 2 647 && length_of_file(MINDI_CACHE"/changed.files") > 2) { 648 648 mr_msg(0, 649 "Type 'less /tmp/changed.files' to see which files don't match the archives");649 "Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives"); 650 650 mr_msg(2, "Calling popup_changelist_from_file()"); 651 popup_changelist_from_file( "/tmp/changed.files");651 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 652 652 mr_msg(2, "Returned from popup_changelist_from_file()"); 653 653 } … … 674 674 * returns: int * 675 675 **************************************************************************/ 676 int compare_to_tape( struct s_bkpinfo *bkpinfo)676 int compare_to_tape() 677 677 { 678 678 int res = 0; … … 692 692 mvaddstr_and_log_it(g_currentY, 693 693 0, _("Verifying archives against filesystem")); 694 res = verify_tape_backups( bkpinfo);694 res = verify_tape_backups(); 695 695 chdir(dir); 696 696 if (res) { -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.h
r1200 r1663 4 4 5 5 6 int compare_to_CD( struct s_bkpinfo *);7 int compare_to_cdstream( struct s_bkpinfo *);8 int compare_to_tape( struct s_bkpinfo *);6 int compare_to_CD(); 7 int compare_to_cdstream(); 8 int compare_to_tape(); 9 9 10 10 int 11 compare_mode(struct s_bkpinfo *bkpinfo, 12 struct mountlist_itself *mountlist, 11 compare_mode(struct mountlist_itself *mountlist, 13 12 struct raidlist_itself *raidlist); -
branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c
r1555 r1663 26 26 27 27 extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN]; 28 29 28 30 29 /** -
branches/stable/mondo/src/mondorestore/mondo-rstr-newt.h
r1297 r1663 43 43 extern struct s_node *find_node_in_filelist(struct s_node *, 44 44 char *filename); 45 extern int what_number_cd_is_this( struct s_bkpinfo *);45 extern int what_number_cd_is_this(); 46 46 //extern void fatal_error (char *); 47 47 extern void sort_mountlist_by_device(struct mountlist_itself *); -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools-EXT.h
r1580 r1663 4 4 5 5 extern void free_MR_global_filenames(void); 6 extern void get_cfg_file_from_archive_or_bust( struct s_bkpinfo *);6 extern void get_cfg_file_from_archive_or_bust(); 7 7 extern bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ 8 extern int iso_fiddly_bits( struct s_bkpinfo *bkpinfo,bool nuke_me_please);8 extern int iso_fiddly_bits(bool nuke_me_please); 9 9 extern void kill_petris(void); 10 extern int mount_cdrom( struct s_bkpinfo *bkpinfo);10 extern int mount_cdrom(); 11 11 extern int mount_all_devices(struct mountlist_itself *, bool); 12 12 extern void protect_against_braindead_sysadmins(void); 13 extern int read_cfg_file_into_bkpinfo(char *cfg_file, 14 struct s_bkpinfo *bkpinfo); 15 struct s_node *process_filelist_and_biggielist(struct s_bkpinfo *); 13 extern int read_cfg_file_into_bkpinfo(char *cfg_file); 14 struct s_node *process_filelist_and_biggielist(); 16 15 extern int backup_crucial_file(char *path_root, char *filename); 17 16 extern int run_boot_loader(bool); … … 24 23 extern void streamline_changes_file(char *, char *); 25 24 extern void set_signals(int on); 26 extern void setup_MR_global_filenames( struct s_bkpinfo *bkpinfo);25 extern void setup_MR_global_filenames(); 27 26 extern void terminate_daemon(int); 28 27 extern void termination_in_progress(int); 29 28 extern int unmount_all_devices(struct mountlist_itself *); 30 extern int get_cfg_file_from_archive( struct s_bkpinfo *bkpinfo);29 extern int get_cfg_file_from_archive(); 31 30 extern int 32 extract_config_file_from_ramdisk( struct s_bkpinfo *bkpinfo,31 extract_config_file_from_ramdisk( 33 32 char *ramdisk_fname, 34 33 char *output_cfg_file, -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1639 r1663 49 49 extern char *MONDO_LOGFILE; 50 50 51 /* Reference to global bkpinfo */ 52 extern struct s_bkpinfo *bkpinfo; 53 51 54 /* Should we use or not extended attributes and acl when restoring */ 52 55 char *g_getfattr = NULL; … … 141 144 */ 142 145 int 143 extract_config_file_from_ramdisk(struct s_bkpinfo *bkpinfo, 144 char *ramdisk_fname, 145 char *output_cfg_file, 146 char *output_mountlist_file) 146 extract_config_file_from_ramdisk(char *ramdisk_fname, 147 char *output_cfg_file, 148 char *output_mountlist_file) 147 149 { 148 150 char *mountpt = NULL; … … 211 213 /** 212 214 * Keep trying to get mondo-restore.cfg from the archive, until the user gives up. 213 * @param bkpinfo The backup information structure. 214 */ 215 void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *bkpinfo) 216 { 217 while (get_cfg_file_from_archive(bkpinfo)) { 215 */ 216 void get_cfg_file_from_archive_or_bust() 217 { 218 while (get_cfg_file_from_archive()) { 218 219 if (!ask_me_yes_or_no 219 220 (_ … … 222 223 fatal_error("Could not find config file/archives. Aborting."); 223 224 } 224 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);225 interactively_obtain_media_parameters_from_user(FALSE); 225 226 } 226 227 } … … 285 286 * @return 0 for success, nonzero for failure. 286 287 */ 287 int iso_fiddly_bits( struct s_bkpinfo *bkpinfo,bool nuke_me_please)288 int iso_fiddly_bits(bool nuke_me_please) 288 289 { 289 290 char *mount_isodir_command = NULL; … … 341 342 } 342 343 if (!IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 343 mount_cdrom( bkpinfo);344 } 345 i = what_number_cd_is_this( bkpinfo); /* has the side-effect of calling mount_cdrom() */344 mount_cdrom(); 345 } 346 i = what_number_cd_is_this(); /* has the side-effect of calling mount_cdrom() */ 346 347 mr_msg(1, "%s #%d has been mounted via loopback mount", 347 348 bkpinfo->backup_media_string, i); … … 601 602 * @return 0 for success, nonzero for failure. 602 603 */ 603 int mount_cdrom( struct s_bkpinfo *bkpinfo)604 int mount_cdrom() 604 605 { 605 606 char *mount_cmd = NULL; … … 750 751 * @return 0 for success, nonzero for failure. 751 752 */ 752 int read_cfg_file_into_bkpinfo(char *cfgf , struct s_bkpinfo *bkpinfo)753 int read_cfg_file_into_bkpinfo(char *cfgf) 753 754 { 754 755 char *value = NULL; … … 1019 1020 mr_asprintf(&iso_mnt, ""); 1020 1021 mr_asprintf(&iso_path, ""); 1021 if (mount_cdrom( bkpinfo)) {1022 if (mount_cdrom()) { 1022 1023 fatal_error 1023 1024 ("Unable to mount isodir. Failed to mount CD-ROM as well."); … … 1043 1044 mr_msg(2, 1044 1045 "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)"); 1045 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);1046 interactively_obtain_media_parameters_from_user(FALSE); 1046 1047 media_specified_by_user = bkpinfo->backup_media_type; 1047 get_cfg_file_from_archive( bkpinfo);1048 get_cfg_file_from_archive(); 1048 1049 } 1049 1050 } … … 1072 1073 */ 1073 1074 struct 1074 s_node *process_filelist_and_biggielist( struct s_bkpinfo *bkpinfo)1075 s_node *process_filelist_and_biggielist() 1075 1076 { 1076 1077 struct s_node *filelist = NULL; … … 1115 1116 "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", 1116 1117 bkpinfo->isodir); 1117 insist_on_this_cd_number( bkpinfo,1);1118 insist_on_this_cd_number(1); 1118 1119 mr_msg(2, "Back from iotcn"); 1119 1120 run_program_and_log_output("mount", 1); … … 1125 1126 FILELIST_FULL_STUB, 1126 1127 "tmp/i-want-my-lvm", MONDO_CFG_FILE_STUB); 1127 1128 1128 mr_msg(1, "tarcommand = %s", command); 1129 1129 run_program_and_log_output(command, 1); … … 1790 1790 * - @c bkpinfo->disaster_recovery 1791 1791 */ 1792 void setup_MR_global_filenames( struct s_bkpinfo *bkpinfo)1792 void setup_MR_global_filenames() 1793 1793 { 1794 1794 char *temppath; … … 2081 2081 * @return 0 for success, nonzero for failure. 2082 2082 */ 2083 int get_cfg_file_from_archive( struct s_bkpinfo *bkpinfo)2083 int get_cfg_file_from_archive() 2084 2084 { 2085 2085 int retval = 0; … … 2125 2125 } else { 2126 2126 mr_msg(2, "gcffa --- calling mount_cdrom now :)"); 2127 if (!mount_cdrom( bkpinfo)) {2127 if (!mount_cdrom()) { 2128 2128 mr_msg(2, 2129 2129 "gcffa --- managed to mount CD; so, no need for Plan B"); … … 2132 2132 try_plan_B = TRUE; 2133 2133 } 2134 if (what_number_cd_is_this(bkpinfo) > 1) { 2135 insist_on_this_cd_number(bkpinfo, 2136 (g_current_media_number = 1)); 2134 if (what_number_cd_is_this() > 1) { 2135 insist_on_this_cd_number((g_current_media_number = 1)); 2137 2136 } 2138 2137 } -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.h
r1580 r1663 4 4 5 5 void free_global_filenames(void); 6 void get_cfg_file_from_archive_or_bust( struct s_bkpinfo *);6 void get_cfg_file_from_archive_or_bust(); 7 7 bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ 8 int iso_fiddly_bits( struct s_bkpinfo *bkpinfo,bool nuke_me_please);8 int iso_fiddly_bits(bool nuke_me_please); 9 9 void kill_petris(void); 10 int mount_cdrom( struct s_bkpinfo *bkpinfo);10 int mount_cdrom(); 11 11 int mount_device(char *, char *, char *, bool); 12 12 int mount_all_devices(struct mountlist_itself *, bool); 13 13 void protect_against_braindead_sysadmins(void); 14 int read_cfg_file_into_bkpinfo(char *cfg_file , struct s_bkpinfo *bkpinfo);15 struct s_node *process_filelist_and_biggielist( struct s_bkpinfo *);14 int read_cfg_file_into_bkpinfo(char *cfg_file); 15 struct s_node *process_filelist_and_biggielist(); 16 16 int backup_crucial_file(char *path_root, char *filename); 17 17 … … 24 24 void streamline_changes_file(char *, char *); 25 25 void set_signals(int on); 26 void setup_global_filenames( struct s_bkpinfo *bkpinfo);26 void setup_global_filenames(); 27 27 void twenty_seconds_til_yikes(void); 28 28 int run_raw_mbr(bool offer_to_hack_scripts, char *bd); … … 30 30 void termination_in_progress(int); 31 31 int unmount_all_devices(struct mountlist_itself *); 32 int get_cfg_file_from_archive( struct s_bkpinfo *bkpinfo);32 int get_cfg_file_from_archive(); 33 33 void ask_about_these_imagedevs(char *infname, char *outfname); -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1639 r1663 35 35 36 36 extern void twenty_seconds_til_yikes(void); 37 38 /* Reference to global bkpinfo */ 39 struct s_bkpinfo *bkpinfo; 37 40 38 41 /* For use in other programs (ex. XMondo) */ … … 205 208 * @ingroup restoreGuiGroup 206 209 */ 207 int let_user_edit_the_mountlist(struct s_bkpinfo *bkpinfo, 208 struct mountlist_itself *mountlist, 210 int let_user_edit_the_mountlist(struct mountlist_itself *mountlist, 209 211 struct raidlist_itself *raidlist) 210 212 { … … 306 308 */ 307 309 int 308 catchall_mode(struct s_bkpinfo *bkpinfo, 309 struct mountlist_itself *mountlist, 310 catchall_mode(struct mountlist_itself *mountlist, 310 311 struct raidlist_itself *raidlist) 311 312 { … … 321 322 iamhere("post wrm"); 322 323 if (c == 'I' || c == 'N' || c == 'C') { 323 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);324 interactively_obtain_media_parameters_from_user(FALSE); 324 325 } else { 325 326 popup_and_OK(_("No restoring or comparing will take place today.")); … … 338 339 339 340 if (bkpinfo->backup_media_type == iso) { 340 if (iso_fiddly_bits( bkpinfo,(c == 'N') ? TRUE : FALSE)) {341 if (iso_fiddly_bits((c == 'N') ? TRUE : FALSE)) { 341 342 mr_msg(2, 342 343 "catchall_mode --- iso_fiddly_bits returned w/ error"); … … 349 350 if (c == 'I') { 350 351 mr_msg(2, "IM selected"); 351 retval += interactive_mode( bkpinfo,mountlist, raidlist);352 retval += interactive_mode(mountlist, raidlist); 352 353 } else if (c == 'N') { 353 354 mr_msg(2, "NM selected"); 354 retval += nuke_mode( bkpinfo,mountlist, raidlist);355 retval += nuke_mode(mountlist, raidlist); 355 356 } else if (c == 'C') { 356 357 mr_msg(2, "CM selected"); 357 retval += compare_mode( bkpinfo,mountlist, raidlist);358 retval += compare_mode(mountlist, raidlist); 358 359 } 359 360 return (retval); … … 368 369 **************************************************************************/ 369 370 370 static void clean_blkid( struct s_bkpinfo *bkpinfo) {371 static void clean_blkid() { 371 372 372 373 char *tmp1 = NULL; … … 396 397 */ 397 398 int 398 interactive_mode(struct s_bkpinfo *bkpinfo, 399 struct mountlist_itself *mountlist, 399 interactive_mode(struct mountlist_itself *mountlist, 400 400 struct raidlist_itself *raidlist) 401 401 { … … 434 434 435 435 iamhere("About to load config file"); 436 get_cfg_file_from_archive_or_bust( bkpinfo);437 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);436 get_cfg_file_from_archive_or_bust(); 437 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 438 438 iamhere("Done loading config file; resizing ML"); 439 439 mr_asprintf(&tmp,bkpinfo->prefix); … … 560 560 { 561 561 mr_msg(1, "Restoring all data"); 562 retval += restore_everything( bkpinfo,NULL);562 retval += restore_everything(NULL); 563 563 } else if ((restore_all = 564 564 ask_me_yes_or_no … … 567 567 for (done = FALSE; !done;) { 568 568 unlink("/tmp/filelist.full"); 569 filelist = process_filelist_and_biggielist( bkpinfo);569 filelist = process_filelist_and_biggielist(); 570 570 /* Now you have /tmp/tmpfs/filelist.restore-these and /tmp/tmpfs/biggielist.restore-these; 571 571 the former is a list of regular files; the latter, biggiefiles and imagedevs. … … 587 587 strcpy(bkpinfo->restore_path, tmp1); 588 588 mr_msg(1, "Restoring subset"); 589 retval += restore_everything( bkpinfo,filelist);589 retval += restore_everything(filelist); 590 590 free_filelist(filelist); 591 591 } else { … … 622 622 } 623 623 624 clean_blkid( bkpinfo);624 clean_blkid(); 625 625 protect_against_braindead_sysadmins(); 626 626 retval += unmount_all_devices(mountlist); … … 671 671 * Run an arbitrary restore mode (prompt the user), but from ISO images 672 672 * instead of real media. 673 * @param bkpinfo The backup information structure. Most fields are used.674 673 * @param mountlist The mountlist containing information about the user's partitions. 675 674 * @param raidlist The raidlist that goes with @p mountlist. … … 678 677 */ 679 678 int 680 iso_mode(struct s_bkpinfo *bkpinfo, 681 struct mountlist_itself *mountlist, 679 iso_mode(struct mountlist_itself *mountlist, 682 680 struct raidlist_itself *raidlist, bool nuke_me_please) 683 681 { … … 685 683 int retval = 0; 686 684 687 assert(bkpinfo != NULL);688 685 assert(mountlist != NULL); 689 686 assert(raidlist != NULL); 690 if (iso_fiddly_bits( bkpinfo,nuke_me_please)) {687 if (iso_fiddly_bits(nuke_me_please)) { 691 688 mr_msg(1, "iso_mode --- returning w/ error"); 692 689 return (1); … … 694 691 c = which_restore_mode(); 695 692 if (c == 'I' || c == 'N' || c == 'C') { 696 interactively_obtain_media_parameters_from_user(bkpinfo, 697 FALSE); 693 interactively_obtain_media_parameters_from_user(FALSE); 698 694 } 699 695 if (c == 'I') { 700 retval += interactive_mode( bkpinfo,mountlist, raidlist);696 retval += interactive_mode(mountlist, raidlist); 701 697 } else if (c == 'N') { 702 retval += nuke_mode( bkpinfo,mountlist, raidlist);698 retval += nuke_mode(mountlist, raidlist); 703 699 } else if (c == 'C') { 704 retval += compare_mode( bkpinfo,mountlist, raidlist);700 retval += compare_mode(mountlist, raidlist); 705 701 } else { 706 702 log_to_screen(_("OK, I shan't restore/compare any files.")); … … 761 757 */ 762 758 int 763 nuke_mode(struct s_bkpinfo *bkpinfo, 764 struct mountlist_itself *mountlist, 759 nuke_mode(struct mountlist_itself *mountlist, 765 760 struct raidlist_itself *raidlist) 766 761 { … … 778 773 mr_msg(2, "nuke_mode --- starting"); 779 774 780 get_cfg_file_from_archive_or_bust( bkpinfo);775 get_cfg_file_from_archive_or_bust(); 781 776 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo updated the mountlist 782 777 #ifdef __FreeBSD__ … … 796 791 if (ask_me_yes_or_no(tmp)) { 797 792 mr_free(tmp); 798 retval = interactive_mode( bkpinfo,mountlist, raidlist);793 retval = interactive_mode(mountlist, raidlist); 799 794 call_me_after_the_nuke(retval); 800 795 return(retval); … … 852 847 853 848 if (ask_me_yes_or_no(_("Try in interactive mode instead?"))) { 854 retval = interactive_mode( bkpinfo,mountlist, raidlist);849 retval = interactive_mode(mountlist, raidlist); 855 850 call_me_after_the_nuke(retval); 856 851 return(retval); … … 869 864 } 870 865 iamhere("Restoring everything"); 871 retval += restore_everything( bkpinfo,NULL);866 retval += restore_everything(NULL); 872 867 if (!run_boot_loader(FALSE)) { 873 868 mr_msg(1, … … 875 870 boot_loader_installed = TRUE; 876 871 } 877 clean_blkid( bkpinfo);872 clean_blkid(); 878 873 protect_against_braindead_sysadmins(); 879 874 retval += unmount_all_devices(mountlist); … … 910 905 * @return 0 for success, or the number of errors encountered. 911 906 */ 912 int restore_to_live_filesystem( struct s_bkpinfo *bkpinfo)907 int restore_to_live_filesystem() 913 908 { 914 909 int retval = 0; … … 932 927 sleep(1); 933 928 } 934 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);929 interactively_obtain_media_parameters_from_user(FALSE); 935 930 if (!bkpinfo->media_device) { 936 931 mr_msg(2, "Warning - failed to find media dev"); … … 944 939 open_evalcall_form(_("Thinking...")); 945 940 946 get_cfg_file_from_archive_or_bust( bkpinfo);947 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);941 get_cfg_file_from_archive_or_bust(); 942 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 948 943 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo 949 944 … … 951 946 retval = load_mountlist(mountlist, g_mountlist_fname); 952 947 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 953 filelist = process_filelist_and_biggielist( bkpinfo);948 filelist = process_filelist_and_biggielist(); 954 949 if (filelist) { 955 950 save_filelist(filelist, "/tmp/selected-files.txt"); … … 959 954 bkpinfo->restore_path, MAX_STR_LEN)) { 960 955 iamhere("Restoring everything"); 961 retval += restore_everything( bkpinfo,filelist);956 retval += restore_everything(filelist); 962 957 } 963 958 free_filelist(filelist); … … 1006 1001 */ 1007 1002 int 1008 restore_a_biggiefile_from_CD(struct s_bkpinfo *bkpinfo, 1009 long bigfileno, 1003 restore_a_biggiefile_from_CD(long bigfileno, 1010 1004 struct s_node *filelist, 1011 1005 char *pathname_of_last_file_restored) … … 1178 1172 bkpinfo->backup_media_string, 1179 1173 g_current_media_number); 1180 insist_on_this_cd_number( bkpinfo,g_current_media_number);1174 insist_on_this_cd_number(g_current_media_number); 1181 1175 log_to_screen(_("Continuing to restore.")); 1182 1176 } else { … … 1307 1301 * @return 0 for success (or skip), nonzero for failure. 1308 1302 */ 1309 int restore_a_biggiefile_from_stream( struct s_bkpinfo *bkpinfo,char *orig_bf_fname, long biggiefile_number, char *orig_checksum, //UNUSED1303 int restore_a_biggiefile_from_stream(char *orig_bf_fname, long biggiefile_number, char *orig_checksum, //UNUSED 1310 1304 long long biggiefile_size, //UNUSED 1311 1305 struct s_node *filelist, … … 1474 1468 if (current_slice_number == 0) { 1475 1469 res = 1476 read_file_from_stream_to_file(bkpinfo, 1477 "/tmp/biggie-blah.txt", 1470 read_file_from_stream_to_file("/tmp/biggie-blah.txt", 1478 1471 slice_siz); 1479 1472 if (!(fin = fopen("/tmp/biggie-blah.txt", "r"))) { … … 1491 1484 } else { 1492 1485 res = 1493 read_file_from_stream_to_stream( bkpinfo,pout, slice_siz);1486 read_file_from_stream_to_stream(pout, slice_siz); 1494 1487 } 1495 1488 retval += res; … … 1776 1769 */ 1777 1770 int 1778 restore_a_tarball_from_stream(struct s_bkpinfo *bkpinfo, 1779 char *tarball_fname, 1771 restore_a_tarball_from_stream(char *tarball_fname, 1780 1772 long current_tarball_number, 1781 1773 struct s_node *filelist, … … 1817 1809 mr_asprintf(&filelist_subset_fname, "%s/filelist-subset-%ld.tmp", 1818 1810 bkpinfo->tmpdir, current_tarball_number); 1819 res = read_file_from_stream_to_file( bkpinfo,afio_fname, size);1811 res = read_file_from_stream_to_file(afio_fname, size); 1820 1812 if (strstr(tarball_fname, ".star")) { 1821 1813 bkpinfo->use_star = TRUE; … … 1951 1943 */ 1952 1944 int 1953 restore_all_biggiefiles_from_CD(struct s_bkpinfo *bkpinfo, 1954 struct s_node *filelist) 1945 restore_all_biggiefiles_from_CD(struct s_node *filelist) 1955 1946 { 1956 1947 int retval = 0; … … 2018 2009 "I'll continue to scan this CD for bigfiles to be restored."); 2019 2010 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2020 insist_on_this_cd_number(bkpinfo, 2021 ++g_current_media_number); 2011 insist_on_this_cd_number(++g_current_media_number); 2022 2012 log_to_screen(_("Restoring from %s #%d"), 2023 bkpinfo->backup_media_string,2013 media_descriptor_string(bkpinfo->backup_media_type), 2024 2014 g_current_media_number); 2025 2015 just_changed_cds = TRUE; … … 2037 2027 2038 2028 res = 2039 restore_a_biggiefile_from_CD(bkpinfo, bigfileno, filelist, 2040 pathname_of_last_biggie_restored); 2029 restore_a_biggiefile_from_CD(bigfileno, filelist, pathname_of_last_biggie_restored); 2041 2030 iamhere(pathname_of_last_biggie_restored); 2042 2031 if (fbw && pathname_of_last_biggie_restored[0]) { … … 2097 2086 */ 2098 2087 int 2099 restore_all_tarballs_from_CD(struct s_bkpinfo *bkpinfo, 2100 struct s_node *filelist) 2088 restore_all_tarballs_from_CD(struct s_node *filelist) 2101 2089 { 2102 2090 int retval = 0; … … 2126 2114 g_current_media_number = 1; 2127 2115 } 2128 insist_on_this_cd_number( bkpinfo,g_current_media_number);2116 insist_on_this_cd_number(g_current_media_number); 2129 2117 read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp1); 2130 2118 max_val = atol(tmp1) + 1; … … 2140 2128 progress_str, max_val); 2141 2129 for (;;) { 2142 insist_on_this_cd_number( bkpinfo,g_current_media_number);2130 insist_on_this_cd_number(g_current_media_number); 2143 2131 update_progress_form(progress_str); 2144 2132 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", … … 2252 2240 */ 2253 2241 int 2254 restore_all_biggiefiles_from_stream(struct s_bkpinfo *bkpinfo, 2255 struct s_node *filelist) 2242 restore_all_biggiefiles_from_stream(struct s_node *filelist) 2256 2243 { 2257 2244 long noof_biggiefiles = 0L; … … 2306 2293 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2307 2294 res = 2308 read_EXAT_files_from_tape( bkpinfo,&biggie_size, biggie_fname,2295 read_EXAT_files_from_tape(&biggie_size, biggie_fname, 2309 2296 &ctrl_chr, xattr_fname, acl_fname); 2310 2297 } … … 2342 2329 mr_free(tmp); 2343 2330 2344 res = restore_a_biggiefile_from_stream(b kpinfo, biggie_fname,2331 res = restore_a_biggiefile_from_stream(biggie_fname, 2345 2332 current_bigfile_number, 2346 2333 biggie_cksum, … … 2428 2415 */ 2429 2416 int 2430 restore_all_tarballs_from_stream(struct s_bkpinfo *bkpinfo, 2431 struct s_node *filelist) 2417 restore_all_tarballs_from_stream(struct s_node *filelist) 2432 2418 { 2433 2419 int retval = 0; … … 2493 2479 iamhere("Reading EXAT files from tape"); 2494 2480 res = 2495 read_EXAT_files_from_tape( bkpinfo,&tmp_size, tmp_fname,2481 read_EXAT_files_from_tape(&tmp_size, tmp_fname, 2496 2482 &ctrl_chr, xattr_fname, 2497 2483 acl_fname); … … 2506 2492 */ 2507 2493 res = 2508 restore_a_tarball_from_stream( bkpinfo,tmp_fname,2494 restore_a_tarball_from_stream(tmp_fname, 2509 2495 current_afioball_number, 2510 2496 filelist, tmp_size, xattr_fname, … … 2568 2554 * @ingroup restoreGroup 2569 2555 */ 2570 int restore_everything(struct s_ bkpinfo *bkpinfo, struct s_node *filelist)2556 int restore_everything(struct s_node *filelist) 2571 2557 { 2572 2558 int resA; … … 2602 2588 mvaddstr_and_log_it(g_currentY, 0, _("Preparing to read your archives")); 2603 2589 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2604 mount_cdrom( bkpinfo);2590 mount_cdrom(); 2605 2591 mvaddstr_and_log_it(g_currentY++, 0, 2606 2592 _("Restoring OS and data from streaming media")); 2607 2593 if (bkpinfo->backup_media_type == cdstream) { 2608 openin_cdstream( bkpinfo);2594 openin_cdstream(); 2609 2595 } else { 2610 assert_string_is_neither_NULL_nor_zerolength(bkpinfo-> 2611 media_device); 2612 openin_tape(bkpinfo); 2613 } 2614 resA = restore_all_tarballs_from_stream(bkpinfo, filelist); 2615 resB = restore_all_biggiefiles_from_stream(bkpinfo, filelist); 2596 assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device); 2597 openin_tape(); 2598 } 2599 resA = restore_all_tarballs_from_stream(filelist); 2600 resB = restore_all_biggiefiles_from_stream(filelist); 2616 2601 if (bkpinfo->backup_media_type == cdstream) { 2617 closein_cdstream( bkpinfo);2602 closein_cdstream(); 2618 2603 } else { 2619 closein_tape( bkpinfo);2604 closein_tape(); 2620 2605 } 2621 2606 } else { 2622 2607 mvaddstr_and_log_it(g_currentY++, 0, 2623 2608 _("Restoring OS and data from CD ")); 2624 mount_cdrom( bkpinfo);2625 resA = restore_all_tarballs_from_CD( bkpinfo,filelist);2626 resB = restore_all_biggiefiles_from_CD( bkpinfo,filelist);2609 mount_cdrom(); 2610 resA = restore_all_tarballs_from_CD(filelist); 2611 resB = restore_all_biggiefiles_from_CD(filelist); 2627 2612 } 2628 2613 chdir(cwd); … … 2651 2636 */ 2652 2637 int 2653 restore_live_from_monitas_server(struct s_bkpinfo *bkpinfo, 2654 char *monitas_device, 2638 restore_live_from_monitas_server(char *monitas_device, 2655 2639 char *restore_this_directory, 2656 2640 char *restore_here) … … 2724 2708 2725 2709 unlink(datadisks_fname); 2726 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);2710 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 2727 2711 retval = load_mountlist(&the_mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo strcpy(bkpinfo->media_device, monitas_device); 2728 2712 … … 2751 2735 run_program_and_log_output(command, FALSE); 2752 2736 // filelist = load_filelist(g_filelist_restthese); // FIXME --- this probably doesn't work because it doesn't include the biggiefiles 2753 retval += restore_everything( bkpinfo,filelist);2737 retval += restore_everything(filelist); 2754 2738 free_filelist(filelist); 2755 2739 mr_msg(2, "--------End of restore_live_from_monitas_server--------"); … … 2820 2804 struct mountlist_itself *mountlist = NULL; 2821 2805 struct raidlist_itself *raidlist = NULL; 2822 struct s_bkpinfo *bkpinfo = NULL;2823 2806 struct s_node *filelist = NULL; 2824 2807 char *a = NULL, *b = NULL; … … 2840 2823 mr_conf = mr_malloc(sizeof(struct mr_rs_conf)); 2841 2824 mr_rs_reset_conf(mr_conf); 2825 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo)); 2826 reset_bkpinfo(); 2842 2827 2843 2828 mr_conf->log_level = DEFAULT_MR_LOGLEVEL; … … 2859 2844 g_text_mode = FALSE; 2860 2845 } // newt :-) 2861 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));2862 2846 mountlist = mr_malloc(sizeof(struct mountlist_itself)); 2863 2847 raidlist = mr_malloc(sizeof(struct raidlist_itself)); … … 2873 2857 malloc_string(a); 2874 2858 malloc_string(b); 2875 setup_MR_global_filenames(bkpinfo); // malloc() and set globals, using bkpinfo->tmpdir etc. 2876 reset_bkpinfo(bkpinfo); 2859 setup_MR_global_filenames(); // malloc() and set globals, using bkpinfo->tmpdir etc. 2877 2860 bkpinfo->backup_media_type = none; // in case boot disk was made for one backup type but user wants to restore from another backup type 2878 2861 strcpy(bkpinfo->backup_media_string,""); … … 2909 2892 2910 2893 /* Init directories */ 2911 make_hole_for_dir(bkpinfo->tmpdir);2912 mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->tmpdir);2913 run_program_and_log_output(tmp, FALSE);2914 mr_free(tmp);2915 2916 2894 make_hole_for_dir("/var/log"); 2917 2895 make_hole_for_dir("/tmp/tmpfs"); /* just in case... */ … … 2943 2921 strcpy(g_mountlist_fname, "/tmp/mountlist.txt"); 2944 2922 } 2945 res = let_user_edit_the_mountlist( bkpinfo,mountlist, raidlist);2923 res = let_user_edit_the_mountlist(mountlist, raidlist); 2946 2924 #ifdef __FreeBSD__ 2947 2925 system("mv -f /etc/raidtab /tmp/raidconf.txt"); … … 2977 2955 2978 2956 malloc_string(tmp); 2979 restore_a_biggiefile_from_CD( bkpinfo,42, NULL, tmp);2957 restore_a_biggiefile_from_CD(42, NULL, tmp); 2980 2958 mr_free(tmp); 2981 2959 } … … 3077 3055 if (argc == 5 && strcmp(argv[1], "--monitas-live") == 0) { 3078 3056 retval = 3079 restore_live_from_monitas_server(bkpinfo, 3080 argv[2], 3057 restore_live_from_monitas_server(argv[2], 3081 3058 argv[3], argv[4]); 3082 3059 } else { 3083 3060 mr_msg(2, "Calling restore_to_live_filesystem()"); 3084 retval = restore_to_live_filesystem( bkpinfo);3061 retval = restore_to_live_filesystem(); 3085 3062 } 3086 3063 mr_msg(2, "Still here. Yay."); … … 3103 3080 iamhere("About to call load_mountlist and load_raidtab"); 3104 3081 strcpy(bkpinfo->restore_path, MNT_RESTORING); 3105 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);3082 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 3106 3083 retval = load_mountlist(mountlist, g_mountlist_fname); 3107 3084 retval += load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); … … 3163 3140 if (argc == 2 && strcmp(argv[1], "--nuke") == 0) { 3164 3141 iamhere("nuking"); 3165 retval += nuke_mode( bkpinfo,mountlist, raidlist);3142 retval += nuke_mode(mountlist, raidlist); 3166 3143 } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) { 3167 3144 iamhere("catchall"); 3168 retval += catchall_mode( bkpinfo,mountlist, raidlist);3145 retval += catchall_mode(mountlist, raidlist); 3169 3146 } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) { 3170 3147 iamhere("compare"); 3171 retval += compare_mode( bkpinfo,mountlist, raidlist);3148 retval += compare_mode(mountlist, raidlist); 3172 3149 } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) { 3173 3150 iamhere("iso"); 3174 retval = iso_mode( bkpinfo,mountlist, raidlist, FALSE);3151 retval = iso_mode(mountlist, raidlist, FALSE); 3175 3152 } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) { 3176 3153 iamhere("mbr"); … … 3185 3162 } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) { 3186 3163 iamhere("isonuke"); 3187 retval = iso_mode( bkpinfo,mountlist, raidlist, TRUE);3164 retval = iso_mode(mountlist, raidlist, TRUE); 3188 3165 } else if (argc != 1) { 3189 3166 log_to_screen(_("Invalid parameters")); … … 3191 3168 } else { 3192 3169 iamhere("catchall (no mode specified in command-line call"); 3193 retval += catchall_mode( bkpinfo,mountlist, raidlist);3170 retval += catchall_mode(mountlist, raidlist); 3194 3171 } 3195 3172 } … … 3197 3174 /* clean up at the end */ 3198 3175 if (retval) { 3199 if (does_file_exist( "/tmp/changed.files")) {3176 if (does_file_exist(MINDI_CACHE"/changed.files")) { 3200 3177 log_to_screen 3201 (_("See /tmp/changed.files for list of files that have changed."));3178 (_("See "MINDI_CACHE"/changed.files for list of files that have changed.")); 3202 3179 } 3203 3180 mvaddstr_and_log_it(g_currentY++, -
branches/stable/mondo/src/mondorestore/mondorestore.h
r1346 r1663 8 8 * Compatibility #define to ease the transition to logfile-in-a-variable. 9 9 */ 10 char *MONDO_LOGFILE = "/ tmp/mondorestore.log";10 char *MONDO_LOGFILE = "/var/log/mondorestore.log"; 11 11 12 12 /* Busybox ps has no option and PID in first pos */ -
branches/stable/mondo/src/mondorestore/mr-externs.h
r1200 r1663 16 16 extern bool ask_me_yes_or_no(char *); 17 17 extern char *calc_checksum_of_file(char *); 18 extern int closein_tape( struct s_bkpinfo *);18 extern int closein_tape(); 19 19 extern void close_evalcall_form(void); 20 20 extern char *call_program_and_get_last_line_of_output(char *); … … 51 51 extern void open_evalcall_form(char *); 52 52 extern void open_progress_form(char *, char *, char *, char *, long); 53 extern int openin_cdstream( struct s_bkpinfo *);54 extern int openin_tape( struct s_bkpinfo *);53 extern int openin_cdstream(); 54 extern int openin_tape(); 55 55 extern int partition_device(char *, int, int, char *, long); 56 56 extern int partition_device_with_fdisk(char *, int, int, char *, long); … … 61 61 extern bool popup_and_get_string(char *, char *, char *, int); 62 62 extern void setup_newt_stuff(void); 63 extern void reset_bkpinfo( struct s_bkpinfo *);63 extern void reset_bkpinfo(); 64 64 extern int read_cfg_var(char *, char *, char *); 65 extern int read_file_from_stream_to_file( struct s_bkpinfo *,char *,65 extern int read_file_from_stream_to_file(char *, 66 66 long long); 67 extern int read_file_from_stream_to_stream( struct s_bkpinfo *,FILE *,67 extern int read_file_from_stream_to_stream(FILE *, 68 68 long long); 69 extern int read_file_from_stream_FULL( struct s_bkpinfo *,char *, FILE *,69 extern int read_file_from_stream_FULL(char *, FILE *, 70 70 long long); 71 71 extern int read_header_block_from_stream(long long *, char *, int *); … … 78 78 extern void update_evalcall_form(int); 79 79 extern void update_progress_form(char *); 80 extern int verify_tape_backups( struct s_bkpinfo *);80 extern int verify_tape_backups(); 81 81 extern char which_restore_mode(void); 82 82 extern int which_format_command_do_i_need(char *, char *); … … 91 91 mountlist_itself 92 92 *mountlist); 93 extern int get_cfg_file_from_archive( struct s_bkpinfo *);93 extern int get_cfg_file_from_archive(); 94 94 95 95
Note:
See TracChangeset
for help on using the changeset viewer.