- Timestamp:
- Sep 24, 2007, 3:04:43 AM (18 years ago)
- Location:
- branches/2.2.5/mondo/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.5/mondo/src/common/libmondo-archive.c
r1644 r1645 239 239 extern char *MONDO_LOGFILE; 240 240 241 /* Reference to global bkpinfo */ 242 extern struct s_bkpinfo *bkpinfo; 243 241 244 242 245 … … 357 360 358 361 int 359 archive_this_fileset_with_star(struct s_bkpinfo *bkpinfo, char *filelist, 360 char *fname, int setno) 362 archive_this_fileset_with_star(char *filelist, char *fname, int setno) 361 363 { 362 364 int retval = 0; … … 452 454 */ 453 455 int 454 archive_this_fileset(struct s_bkpinfo *bkpinfo, char *filelist, 455 char *fname, int setno) 456 archive_this_fileset(char *filelist, char *fname, int setno) 456 457 { 457 458 … … 473 474 474 475 if (bkpinfo->compression_level > 0 && bkpinfo->use_star) { 475 return (archive_this_fileset_with_star 476 (bkpinfo, filelist, fname, setno)); 476 return (archive_this_fileset_with_star(filelist, fname, setno)); 477 477 } 478 478 … … 587 587 * @ingroup archiveGroup 588 588 */ 589 int backup_data( struct s_bkpinfo *bkpinfo)589 int backup_data() 590 590 { 591 591 int retval = 0, res = 0; … … 593 593 594 594 assert(bkpinfo != NULL); 595 set_g_cdrom_and_g_dvd_to_bkpinfo_value( bkpinfo);595 set_g_cdrom_and_g_dvd_to_bkpinfo_value(); 596 596 malloc_string(tmp); 597 597 if (bkpinfo->backup_media_type == dvd) { … … 608 608 } 609 609 610 if ((res = prepare_filelist( bkpinfo))) { /* generate scratchdir/filelist.full */610 if ((res = prepare_filelist())) { /* generate scratchdir/filelist.full */ 611 611 fatal_error("Failed to generate filelist catalog"); 612 612 } 613 if (call_filelist_chopper( bkpinfo)) {613 if (call_filelist_chopper()) { 614 614 fatal_error("Failed to run filelist chopper"); 615 615 } … … 630 630 } 631 631 632 copy_mondo_and_mindi_stuff_to_scratchdir( bkpinfo); // payload, too, if it exists632 copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists 633 633 #if __FreeBSD__ == 5 634 634 strcpy(bkpinfo->kernel_path, "/boot/kernel/kernel"); … … 644 644 #error "I don't know about this system!" 645 645 #endif 646 if ((res = call_mindi_to_supply_boot_disks( bkpinfo))) {646 if ((res = call_mindi_to_supply_boot_disks())) { 647 647 fatal_error("Failed to generate boot+data disks"); 648 648 } 649 retval += do_that_initial_phase( bkpinfo); // prepare649 retval += do_that_initial_phase(); // prepare 650 650 sprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir); 651 651 run_program_and_log_output(tmp, 1); 652 retval += make_those_afios_phase( bkpinfo); // backup regular files653 retval += make_those_slices_phase( bkpinfo); // backup BIG files654 retval += do_that_final_phase( bkpinfo); // clean up652 retval += make_those_afios_phase(); // backup regular files 653 retval += make_those_slices_phase(); // backup BIG files 654 retval += do_that_final_phase(); // clean up 655 655 log_msg(1, "Creation of archives... complete."); 656 656 if (bkpinfo->verify_data) { … … 690 690 * @ingroup MLarchiveGroup 691 691 */ 692 int call_mindi_to_supply_boot_disks( struct s_bkpinfo *bkpinfo)692 int call_mindi_to_supply_boot_disks() 693 693 { 694 694 /*@ buffer ************************************************************ */ … … 1162 1162 char *curr_acl_list_fname; 1163 1163 1164 struct s_bkpinfo *bkpinfo ;1164 struct s_bkpinfo *bkpinfo_bis; 1165 1165 char *tmp; 1166 1166 int res = 0, retval = 0; … … 1180 1180 p_next_set_to_archive = (int *) (inbuf + 8); 1181 1181 p_list_of_fileset_flags = (char *) (inbuf + 12); 1182 bkpinfo = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);1182 bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET); 1183 1183 1184 1184 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, … … 1246 1246 this_thread_no, archiving_set_no); 1247 1247 res = 1248 archive_this_fileset( bkpinfo,archiving_filelist_fname,1248 archive_this_fileset(archiving_filelist_fname, 1249 1249 archiving_afioball_fname, 1250 1250 archiving_set_no); … … 1304 1304 * @ingroup MLarchiveGroup 1305 1305 */ 1306 int do_that_final_phase( struct s_bkpinfo *bkpinfo)1306 int do_that_final_phase() 1307 1307 { 1308 1308 … … 1321 1321 /* write tape/cdstream */ 1322 1322 { 1323 closeout_tape( bkpinfo);1323 closeout_tape(); 1324 1324 } else 1325 1325 /* write final ISO */ 1326 1326 { 1327 res = write_final_iso_if_necessary( bkpinfo);1327 res = write_final_iso_if_necessary(); 1328 1328 retval += res; 1329 1329 if (res) { … … 1365 1365 * @ingroup MLarchiveGroup 1366 1366 */ 1367 int do_that_initial_phase( struct s_bkpinfo *bkpinfo)1367 int do_that_initial_phase() 1368 1368 { 1369 1369 /*@ int *************************************** */ … … 1613 1613 * @return The number of errors encountered (0 for success) 1614 1614 */ 1615 int make_afioballs_and_images( struct s_bkpinfo *bkpinfo)1615 int make_afioballs_and_images() 1616 1616 { 1617 1617 … … 1673 1673 "Please wait. This may take a couple of hours.", 1674 1674 "Working...", 1675 get_last_filelist_number( bkpinfo) + 1);1675 get_last_filelist_number() + 1); 1676 1676 1677 1677 log_msg(5, "We're gonna party like it's your birthday."); … … 1742 1742 sleep(5); 1743 1743 } 1744 strcpy(media_usage_comment, 1745 percent_media_full_comment(bkpinfo)); 1744 strcpy(media_usage_comment, percent_media_full_comment()); 1746 1745 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1747 1746 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { … … 1752 1751 iamhere("Writing EXAT files"); 1753 1752 res += 1754 write_EXAT_files_to_tape(bkpinfo, 1755 curr_xattr_list_fname, 1753 write_EXAT_files_to_tape(curr_xattr_list_fname, 1756 1754 curr_acl_list_fname); 1757 1755 // archives themselves 1758 1756 res += 1759 move_files_to_stream( bkpinfo,storing_afioball_fname,1757 move_files_to_stream(storing_afioball_fname, 1760 1758 NULL); 1761 1759 } else { 1762 1760 if (g_getfacl) { 1763 1761 if (g_getfattr) { 1764 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1762 res = move_files_to_cd(storing_filelist_fname, 1765 1763 curr_xattr_list_fname, 1766 1764 curr_acl_list_fname, 1767 1765 storing_afioball_fname, NULL); 1768 1766 } else { 1769 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1767 res = move_files_to_cd(storing_filelist_fname, 1770 1768 curr_acl_list_fname, 1771 1769 storing_afioball_fname, NULL); … … 1773 1771 } else { 1774 1772 if (g_getfattr) { 1775 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1773 res = move_files_to_cd(storing_filelist_fname, 1776 1774 curr_xattr_list_fname, 1777 1775 storing_afioball_fname, NULL); 1778 1776 } else { 1779 res = move_files_to_cd( bkpinfo,storing_filelist_fname,1777 res = move_files_to_cd(storing_filelist_fname, 1780 1778 storing_afioball_fname, NULL); 1781 1779 } … … 1855 1853 * @return The number of errors encountered (0 for success) 1856 1854 */ 1857 int make_iso_fs( struct s_bkpinfo *bkpinfo,char *destfile)1855 int make_iso_fs(char *destfile) 1858 1856 { 1859 1857 /*@ int ********************************************** */ … … 1932 1930 g_current_media_number); 1933 1931 res = 1934 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_before_iso,1932 eval_call_to_make_ISO(bkpinfo->call_before_iso, 1935 1933 destfile, g_current_media_number, 1936 1934 MONDO_LOGFILE, message_to_screen); … … 1957 1955 } else { 1958 1956 res = 1959 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_make_iso,1957 eval_call_to_make_ISO(bkpinfo->call_make_iso, 1960 1958 bkpinfo->scratchdir, 1961 1959 g_current_media_number, … … 2020 2018 pause_for_N_seconds(5, "Letting DVD drive settle"); 2021 2019 res = 2022 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_make_iso,2020 eval_call_to_make_ISO(bkpinfo->call_make_iso, 2023 2021 bkpinfo->scratchdir, 2024 2022 g_current_media_number, … … 2054 2052 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end 2055 2053 res = 2056 eval_call_to_make_ISO(bkpinfo, 2057 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", 2054 eval_call_to_make_ISO("mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", 2058 2055 destfile, g_current_media_number, 2059 2056 MONDO_LOGFILE, message_to_screen); … … 2074 2071 #ifdef __IA64__ 2075 2072 log_msg(1, "IA64 --> elilo"); 2076 res = eval_call_to_make_ISO(bkpinfo, 2077 //-b images/mindi-boot.2880.img 2078 "mkisofs -no-emul-boot -b images/mindi-bootroot." 2073 res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b images/mindi-bootroot." 2079 2074 IA64_BOOT_SIZE 2080 2075 ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", … … 2088 2083 log_msg(1, "Non-ia64 --> lilo"); 2089 2084 res = 2090 eval_call_to_make_ISO(bkpinfo, 2091 "mkisofs -b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 2085 eval_call_to_make_ISO("mkisofs -b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 2092 2086 destfile, g_current_media_number, 2093 2087 MONDO_LOGFILE, … … 2098 2092 log_msg(1, "Isolinux"); 2099 2093 res = 2100 eval_call_to_make_ISO(bkpinfo, 2101 "mkisofs -no-emul-boot -b isolinux.bin -boot-load-size 4 -boot-info-table -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 2094 eval_call_to_make_ISO("mkisofs -no-emul-boot -b isolinux.bin -boot-load-size 4 -boot-info-table -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 2102 2095 destfile, g_current_media_number, 2103 2096 MONDO_LOGFILE, … … 2132 2125 pause_and_ask_for_cdr(2, &cd_is_mountable); 2133 2126 res = 2134 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_burn_iso,2127 eval_call_to_make_ISO(bkpinfo->call_burn_iso, 2135 2128 destfile, g_current_media_number, 2136 2129 MONDO_LOGFILE, message_to_screen); … … 2149 2142 g_current_media_number); 2150 2143 res = 2151 eval_call_to_make_ISO(bkpinfo , bkpinfo->call_after_iso,2144 eval_call_to_make_ISO(bkpinfo->call_after_iso, 2152 2145 destfile, g_current_media_number, 2153 2146 MONDO_LOGFILE, message_to_screen); … … 2219 2212 */ 2220 2213 int 2221 make_slices_and_images( struct s_bkpinfo *bkpinfo,char *biggielist_fname)2214 make_slices_and_images(char *biggielist_fname) 2222 2215 { 2223 2216 … … 2252 2245 malloc_string(sz_devfile); 2253 2246 estimated_total_noof_slices = 2254 size_of_all_biggiefiles_K( bkpinfo) / bkpinfo->optimal_set_size + 1;2247 size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1; 2255 2248 2256 2249 log_msg(1, "size of all biggiefiles = %ld", 2257 size_of_all_biggiefiles_K( bkpinfo));2250 size_of_all_biggiefiles_K()); 2258 2251 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", 2259 size_of_all_biggiefiles_K( bkpinfo), bkpinfo->optimal_set_size,2252 size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, 2260 2253 estimated_total_noof_slices); 2261 2254 … … 2343 2336 } 2344 2337 res = 2345 slice_up_file_etc(b kpinfo, bigfile_fname,2338 slice_up_file_etc(bigfile_fname, 2346 2339 ntfsprog_fifo, biggie_file_number, 2347 2340 noof_biggie_files, use_ntfsprog); … … 2395 2388 * @see make_afioballs_and_images 2396 2389 */ 2397 int make_afioballs_and_images_OLD( struct s_bkpinfo *bkpinfo)2390 int make_afioballs_and_images_OLD() 2398 2391 { 2399 2392 … … 2427 2420 "Please wait. This may take a couple of hours.", 2428 2421 "Working...", 2429 get_last_filelist_number( bkpinfo) + 1);2422 get_last_filelist_number() + 1); 2430 2423 2431 2424 sprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, … … 2455 2448 log_msg(1, "Archiving set %ld", curr_set_no); 2456 2449 res = 2457 archive_this_fileset( bkpinfo,curr_filelist_fname,2450 archive_this_fileset(curr_filelist_fname, 2458 2451 curr_afioball_fname, curr_set_no); 2459 2452 retval += res; … … 2465 2458 } 2466 2459 2467 strcpy(media_usage_comment, percent_media_full_comment( bkpinfo));2460 strcpy(media_usage_comment, percent_media_full_comment()); 2468 2461 2469 2462 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ … … 2475 2468 iamhere("Writing EXAT files"); 2476 2469 res += 2477 write_EXAT_files_to_tape( bkpinfo,curr_xattr_list_fname,2470 write_EXAT_files_to_tape(curr_xattr_list_fname, 2478 2471 curr_acl_list_fname); 2479 2472 // archives themselves 2480 res = move_files_to_stream( bkpinfo,curr_afioball_fname, NULL);2473 res = move_files_to_stream(curr_afioball_fname, NULL); 2481 2474 } else { 2482 2475 if (g_getfacl) { 2483 2476 if (g_getfattr) { 2484 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2477 res = move_files_to_cd(curr_filelist_fname, 2485 2478 curr_xattr_list_fname, 2486 2479 curr_acl_list_fname, 2487 2480 curr_afioball_fname, NULL); 2488 2481 } else { 2489 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2482 res = move_files_to_cd(curr_filelist_fname, 2490 2483 curr_acl_list_fname, 2491 2484 curr_afioball_fname, NULL); … … 2493 2486 } else { 2494 2487 if (g_getfattr) { 2495 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2488 res = move_files_to_cd(curr_filelist_fname, 2496 2489 curr_xattr_list_fname, 2497 2490 curr_afioball_fname, NULL); 2498 2491 } else { 2499 res = move_files_to_cd( bkpinfo,curr_filelist_fname,2492 res = move_files_to_cd(curr_filelist_fname, 2500 2493 curr_afioball_fname, NULL); 2501 2494 } … … 2542 2535 * @ingroup MLarchiveGroup 2543 2536 */ 2544 int make_those_afios_phase( struct s_bkpinfo *bkpinfo)2537 int make_those_afios_phase() 2545 2538 { 2546 2539 /*@ int ******************************************* */ … … 2559 2552 log_msg(1, 2560 2553 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2561 res = make_afioballs_and_images_OLD( bkpinfo);2554 res = make_afioballs_and_images_OLD(); 2562 2555 #else 2563 res = make_afioballs_and_images_OLD( bkpinfo);2556 res = make_afioballs_and_images_OLD(); 2564 2557 #endif 2565 2558 write_header_block_to_stream((off_t)0, "stop-afioballs", 2566 2559 BLK_STOP_AFIOBALLS); 2567 2560 } else { 2568 res = make_afioballs_and_images( bkpinfo);2561 res = make_afioballs_and_images(); 2569 2562 } 2570 2563 … … 2588 2581 * @ingroup MLarchiveGroup 2589 2582 */ 2590 int make_those_slices_phase( struct s_bkpinfo *bkpinfo)2583 int make_those_slices_phase() 2591 2584 { 2592 2585 … … 2646 2639 2647 2640 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2648 res += write_EXAT_files_to_tape( bkpinfo,xattr_fname, acl_fname);2641 res += write_EXAT_files_to_tape(xattr_fname, acl_fname); 2649 2642 asprintf(&blah, "%ld", count_lines_in_file(biggielist)); 2650 2643 write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES); 2651 2644 paranoid_free(blah); 2652 2645 } 2653 res = make_slices_and_images(b kpinfo, biggielist);2646 res = make_slices_and_images(biggielist); 2654 2647 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2655 2648 write_header_block_to_stream((off_t)0, "end-of-biggiefiles", … … 2681 2674 * transfer files over the network) or leave it as is. 2682 2675 */ 2683 int (*move_files_to_cd) ( struct s_bkpinfo *,char *, ...) =2676 int (*move_files_to_cd) (char *, ...) = 2684 2677 _move_files_to_cd; 2685 2678 … … 2702 2695 * @return The number of errors encountered (0 for success) 2703 2696 */ 2704 int _move_files_to_cd( struct s_bkpinfo *bkpinfo,char *files_to_add, ...)2697 int _move_files_to_cd(char *files_to_add, ...) 2705 2698 { 2706 2699 … … 2741 2734 } 2742 2735 if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) { 2743 res = write_iso_and_go_on( bkpinfo,FALSE); /* FALSE because this is not the last CD we'll write */2736 res = write_iso_and_go_on(FALSE); /* FALSE because this is not the last CD we'll write */ 2744 2737 retval += res; 2745 2738 if (res) { … … 2798 2791 * @ingroup MLarchiveGroup 2799 2792 */ 2800 int offer_to_write_floppies( struct s_bkpinfo *bkpinfo,char *imagesdir)2793 int offer_to_write_floppies(char *imagesdir) 2801 2794 { 2802 2795 /*@ buffer ************************************************************ */ … … 2958 2951 */ 2959 2952 2960 int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo 2961 *bkpinfo) 2953 int offer_to_write_boot_floppies_to_physical_disks() 2962 2954 { 2963 2955 int res = 0; … … 2982 2974 } 2983 2975 } else { 2984 offer_to_write_floppies( bkpinfo,MINDI_CACHE);2976 offer_to_write_floppies(MINDI_CACHE); 2985 2977 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2986 2978 } … … 3005 2997 * transfer files over the network) or leave it as is. 3006 2998 */ 3007 int (*move_files_to_stream) ( struct s_bkpinfo *,char *, ...) =2999 int (*move_files_to_stream) (char *, ...) = 3008 3000 _move_files_to_stream; 3009 3001 … … 3022 3014 */ 3023 3015 int 3024 _move_files_to_stream( struct s_bkpinfo *bkpinfo,char *files_to_add, ...)3016 _move_files_to_stream(char *files_to_add, ...) 3025 3017 { 3026 3018 … … 3066 3058 type = other; 3067 3059 } 3068 res = write_file_to_stream_from_file( bkpinfo,curr_file);3060 res = write_file_to_stream_from_file(curr_file); 3069 3061 retval += res; 3070 3062 unlink(curr_file); … … 3381 3373 */ 3382 3374 int 3383 slice_up_file_etc( struct s_bkpinfo *bkpinfo,char *biggie_filename,3375 slice_up_file_etc(char *biggie_filename, 3384 3376 char *ntfsprog_fifo, long biggie_file_number, 3385 3377 long noof_biggie_files, bool use_ntfsprog) … … 3517 3509 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3518 3510 res = 3519 move_files_to_stream(bkpinfo, 3520 slice_fname(biggie_file_number, 0, 3511 move_files_to_stream(slice_fname(biggie_file_number, 0, 3521 3512 bkpinfo->tmpdir, ""), NULL); 3522 3513 } else { 3523 3514 res = 3524 move_files_to_cd(bkpinfo, 3525 slice_fname(biggie_file_number, 0, 3515 move_files_to_cd(slice_fname(biggie_file_number, 0, 3526 3516 bkpinfo->tmpdir, ""), NULL); 3527 3517 } … … 3535 3525 suffix)); 3536 3526 3537 strcpy(tmp, percent_media_full_comment( bkpinfo));3527 strcpy(tmp, percent_media_full_comment()); 3538 3528 update_progress_form(tmp); 3539 3529 if (!(fout = fopen(curr_slice_fname_uncompressed, "w"))) { … … 3622 3612 maintain_collection_of_recent_archives(bkpinfo->tmpdir, 3623 3613 file_to_archive); 3624 res = move_files_to_stream( bkpinfo,file_to_archive, NULL);3614 res = move_files_to_stream(file_to_archive, NULL); 3625 3615 } else { 3626 res = move_files_to_cd( bkpinfo,file_to_archive, NULL);3616 res = move_files_to_cd(file_to_archive, NULL); 3627 3617 } 3628 3618 retval += res; … … 3716 3706 * however, this occurs rarely. 3717 3707 */ 3718 int write_final_iso_if_necessary( struct s_bkpinfo *bkpinfo)3708 int write_final_iso_if_necessary() 3719 3709 { 3720 3710 /*@ int ***************************************************** */ … … 3737 3727 } 3738 3728 #endif 3739 res = write_iso_and_go_on( bkpinfo,TRUE);3729 res = write_iso_and_go_on(TRUE); 3740 3730 #ifndef _XWIN 3741 3731 if (!g_text_mode) { … … 3766 3756 * @see make_iso_fs 3767 3757 */ 3768 int write_iso_and_go_on( struct s_bkpinfo *bkpinfo,bool last_cd)3758 int write_iso_and_go_on(bool last_cd) 3769 3759 { 3770 3760 /*@ pointers **************************************************** */ … … 3842 3832 g_current_media_number); 3843 3833 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3844 res = make_iso_fs( bkpinfo,isofile);3834 res = make_iso_fs(isofile); 3845 3835 if (g_current_media_number == 1 && !res 3846 3836 && (bkpinfo->backup_media_type == cdr … … 3861 3851 chdir("/"); 3862 3852 iamhere("Before calling verify_cd_image()"); 3863 res += verify_cd_image( bkpinfo);3853 res += verify_cd_image(); 3864 3854 iamhere("After calling verify_cd_image()"); 3865 3855 } … … 3934 3924 * @ingroup verifyGroup 3935 3925 */ 3936 int verify_data( struct s_bkpinfo *bkpinfo)3926 int verify_data() 3937 3927 { 3938 3928 int res = 0, retval = 0, cdno = 0; … … 3949 3939 strcpy(bkpinfo->media_device, "/dev/cdrom"); 3950 3940 } 3951 verify_tape_backups( bkpinfo);3941 verify_tape_backups(); 3952 3942 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 3953 3943 } else if (bkpinfo->backup_data) … … 3972 3962 } 3973 3963 if (bkpinfo->backup_media_type != iso) { 3974 insist_on_this_cd_number( bkpinfo,cdno);3975 } 3976 res = verify_cd_image( bkpinfo); // sets verify_data to FALSE if it's time to stop verifying3964 insist_on_this_cd_number(cdno); 3965 } 3966 res = verify_cd_image(); // sets verify_data to FALSE if it's time to stop verifying 3977 3967 retval += res; 3978 3968 if (res) { 3979 3969 sprintf(tmp, 3980 3970 "Warnings/errors were reported while checking %s #%d", 3981 media_descriptor_string(bkpinfo-> 3982 backup_media_type), 3971 media_descriptor_string(bkpinfo->backup_media_type), 3983 3972 g_current_media_number); 3984 3973 log_to_screen(tmp); -
branches/2.2.5/mondo/src/common/libmondo-devices.c
r1644 r1645 276 276 extern t_bkptype g_backup_media_type; // set by main() 277 277 278 279 280 281 void set_g_cdrom_and_g_dvd_to_bkpinfo_value(struct s_bkpinfo *bkpinfo) 278 /* Reference to global bkpinfo */ 279 extern struct s_bkpinfo *bkpinfo; 280 281 282 283 284 void set_g_cdrom_and_g_dvd_to_bkpinfo_value() 282 285 { 283 286 strcpy(g_cdrom_drive_is_here, bkpinfo->media_device); // just in case … … 664 667 * @see mount_CDROM_here 665 668 */ 666 int find_and_mount_actual_cd( struct s_bkpinfo *bkpinfo,char *mountpoint)669 int find_and_mount_actual_cd(char *mountpoint) 667 670 { 668 671 /*@ buffers ***************************************************** */ … … 1698 1701 */ 1699 1702 void 1700 insist_on_this_cd_number( struct s_bkpinfo *bkpinfo,int cd_number_i_want)1703 insist_on_this_cd_number(int cd_number_i_want) 1701 1704 { 1702 1705 … … 1755 1758 // return; 1756 1759 } 1757 if ((res = what_number_cd_is_this( bkpinfo)) != cd_number_i_want) {1760 if ((res = what_number_cd_is_this()) != cd_number_i_want) { 1758 1761 log_msg(3, "Currently, we hold %d but we want %d", res, 1759 1762 cd_number_i_want); … … 1765 1768 cd_number_i_want); 1766 1769 log_msg(3, tmp); 1767 while (what_number_cd_is_this( bkpinfo) != cd_number_i_want) {1770 while (what_number_cd_is_this() != cd_number_i_want) { 1768 1771 paranoid_system("sync"); 1769 1772 if (is_this_device_mounted(MNT_CDROM)) { … … 1813 1816 * @ingroup archiveGroup 1814 1817 */ 1815 int interactively_obtain_media_parameters_from_user(struct s_bkpinfo 1816 *bkpinfo, 1817 bool 1818 archiving_to_media) 1818 int interactively_obtain_media_parameters_from_user(bool archiving_to_media) 1819 1819 // archiving_to_media is TRUE if I'm being called by mondoarchive 1820 1820 // archiving_to_media is FALSE if I'm being called by mondorestore … … 1852 1852 bkptype_to_string(bkpinfo->backup_media_type)); 1853 1853 if (archiving_to_media) { 1854 sensibly_set_tmpdir_and_scratchdir( bkpinfo);1854 sensibly_set_tmpdir_and_scratchdir(); 1855 1855 } 1856 1856 bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4; … … 1932 1932 sprintf(comment, 1933 1933 "Please specify your %s drive's /dev entry", 1934 media_descriptor_string(bkpinfo-> 1935 backup_media_type)); 1934 media_descriptor_string(bkpinfo->backup_media_type)); 1936 1935 if (!popup_and_get_string 1937 1936 ("Device?", comment, bkpinfo->media_device, … … 1951 1950 sprintf(tmp, 1952 1951 "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", 1953 media_descriptor_string(bkpinfo-> 1954 backup_media_type), 1952 media_descriptor_string(bkpinfo->backup_media_type), 1955 1953 bkpinfo->media_device); 1956 1954 if (!ask_me_yes_or_no(tmp)) { … … 2507 2505 * @ingroup utilityGroup 2508 2506 */ 2509 void sensibly_set_tmpdir_and_scratchdir( struct s_bkpinfo *bkpinfo)2507 void sensibly_set_tmpdir_and_scratchdir() 2510 2508 { 2511 2509 char *tmp, *command, *sz; … … 2609 2607 * (and remain mounted after this function returns). 2610 2608 */ 2611 int what_number_cd_is_this( struct s_bkpinfo *bkpinfo)2609 int what_number_cd_is_this() 2612 2610 { 2613 2611 int cd_number = -1; -
branches/2.2.5/mondo/src/common/libmondo-fifo.c
r1316 r1645 280 280 281 281 int 282 extract_config_file_from_ramdisk(struct s_bkpinfo *bkpinfo, 283 char *ramdisk_fname, 282 extract_config_file_from_ramdisk(char *ramdisk_fname, 284 283 char *output_cfg_file, 285 284 char *output_mountlist_file); -
branches/2.2.5/mondo/src/common/libmondo-filelist.c
r1644 r1645 138 138 extern char *MONDO_LOGFILE; 139 139 140 /* Reference to global bkpinfo */ 141 extern struct s_bkpinfo *bkpinfo; 142 140 143 141 144 int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir, … … 183 186 * @see chop_filelist 184 187 */ 185 int call_filelist_chopper( struct s_bkpinfo *bkpinfo)188 int call_filelist_chopper() 186 189 { 187 190 /*@ buffers *********************** */ … … 219 222 chop_filelist(filelist, bkpinfo->tmpdir, 220 223 bkpinfo->optimal_set_size); 221 estimate_noof_media_required( bkpinfo,noof_sets); // for cosmetic purposes224 estimate_noof_media_required(noof_sets); // for cosmetic purposes 222 225 223 226 sprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir); … … 822 825 * @note This function should only be called at restore-time. 823 826 */ 824 int get_last_filelist_number( struct s_bkpinfo *bkpinfo)827 int get_last_filelist_number() 825 828 { 826 829 /*@ buffers ***************************************************** */ … … 1402 1405 * @see mondo_makefilelist 1403 1406 */ 1404 int prepare_filelist( struct s_bkpinfo *bkpinfo)1407 int prepare_filelist() 1405 1408 { 1406 1409 -
branches/2.2.5/mondo/src/common/libmondo-files.c
r1505 r1645 103 103 extern int g_currentY; 104 104 extern char *g_mondo_home; 105 106 /* Reference to global bkpinfo */ 107 extern struct s_bkpinfo *bkpinfo; 105 108 106 109 /** … … 871 874 * @return The total size of all biggiefiles in KB. 872 875 */ 873 long size_of_all_biggiefiles_K( struct s_bkpinfo *bkpinfo)876 long size_of_all_biggiefiles_K() 874 877 { 875 878 /*@ buffers ***************************************************** */ … … 1137 1140 * - @c bkpinfo->tmpdir 1138 1141 */ 1139 void copy_mondo_and_mindi_stuff_to_scratchdir( struct s_bkpinfo *bkpinfo)1142 void copy_mondo_and_mindi_stuff_to_scratchdir() 1140 1143 { 1141 1144 /*@ Char buffers ** */ … … 1217 1220 * - @c tmpdir 1218 1221 */ 1219 void store_nfs_config( struct s_bkpinfo *bkpinfo)1222 void store_nfs_config() 1220 1223 { 1221 1224 … … 1338 1341 */ 1339 1342 void 1340 estimate_noof_media_required( struct s_bkpinfo *bkpinfo,long noof_sets)1343 estimate_noof_media_required(long noof_sets) 1341 1344 { 1342 1345 /*@ buffers *************** */ … … 1354 1357 scratchLL = 1355 1358 (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) 1356 + (long long) (size_of_all_biggiefiles_K( bkpinfo));1359 + (long long) (size_of_all_biggiefiles_K()); 1357 1360 scratchLL = (scratchLL / 1024) / bkpinfo->media_size[1]; 1358 1361 scratchLL++; -
branches/2.2.5/mondo/src/common/libmondo-fork.c
r1644 r1645 118 118 extern bool g_text_mode; 119 119 extern char *MONDO_LOGFILE; 120 121 /* Reference to global bkpinfo */ 122 extern struct s_bkpinfo *bkpinfo; 120 123 pid_t g_buffer_pid = 0; 121 124 … … 185 188 */ 186 189 int 187 eval_call_to_make_ISO(struct s_bkpinfo *bkpinfo, 188 char *basic_call, char *isofile, 190 eval_call_to_make_ISO(char *basic_call, char *isofile, 189 191 int cd_no, char *logstub, char *what_i_am_doing) 190 192 { -
branches/2.2.5/mondo/src/common/libmondo-mountlist.c
r1439 r1645 68 68 */ 69 69 struct s_bkpinfo *g_bkpinfo_DONTUSETHIS = NULL; 70 71 /* Reference to global bkpinfo */ 72 extern struct s_bkpinfo *bkpinfo; 70 73 71 74 /** -
branches/2.2.5/mondo/src/common/libmondo-stream.c
r1316 r1645 120 120 extern char *MONDO_LOGFILE; 121 121 122 /* Reference to global bkpinfo */ 123 extern struct s_bkpinfo *bkpinfo; 124 122 125 /** 123 126 * @addtogroup globalGroup … … 150 153 /* @} - end of globalGroup */ 151 154 152 int write_backcatalog_to_tape( struct s_bkpinfo *bkpinfo);155 int write_backcatalog_to_tape(); 153 156 154 157 … … 167 170 * @note This should be called by restore processes only. 168 171 */ 169 int closein_cdstream( struct s_bkpinfo *bkpinfo)170 { 171 return (closein_tape( bkpinfo));172 int closein_cdstream() 173 { 174 return (closein_tape()); 172 175 } 173 176 … … 182 185 * @bug @p bkpinfo parameter is unused. 183 186 */ 184 int closein_tape( struct s_bkpinfo *bkpinfo)187 int closein_tape() 185 188 { 186 189 /*@ int's ******************************************************* */ … … 241 244 * @note This should be called by backup processes only. 242 245 */ 243 int closeout_tape( struct s_bkpinfo *bkpinfo)246 int closeout_tape() 244 247 { 245 248 /*@ int's ******************************************************* */ … … 274 277 if (should_we_write_to_next_tape 275 278 (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) { 276 start_to_write_to_next_tape( bkpinfo);279 start_to_write_to_next_tape(); 277 280 } 278 281 } … … 288 291 if (should_we_write_to_next_tape (bkpinfo->media_size[g_current_media_number], 256*1024)) 289 292 { 290 start_to_write_to_next_tape ( bkpinfo);293 start_to_write_to_next_tape (); 291 294 } 292 295 } … … 438 441 439 442 440 int read_EXAT_files_from_tape(struct s_bkpinfo *bkpinfo, 441 long long *ptmp_size, char *tmp_fname, 443 int read_EXAT_files_from_tape(long long *ptmp_size, char *tmp_fname, 442 444 int *pctrl_chr, char *xattr_fname, 443 445 char *acl_fname) … … 456 458 fatal_error("Wrong order, sunshine."); 457 459 } 458 read_file_from_stream_to_file( bkpinfo,xattr_fname, *ptmp_size);460 read_file_from_stream_to_file(xattr_fname, *ptmp_size); 459 461 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 460 462 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { … … 472 474 wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr); 473 475 } 474 read_file_from_stream_to_file( bkpinfo,acl_fname, *ptmp_size);476 read_file_from_stream_to_file(acl_fname, *ptmp_size); 475 477 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 476 478 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { … … 490 492 491 493 492 int write_EXAT_files_to_tape( struct s_bkpinfo *bkpinfo,char *xattr_fname,494 int write_EXAT_files_to_tape(char *xattr_fname, 493 495 char *acl_fname) 494 496 { … … 500 502 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 501 503 BLK_START_EXAT_FILE); 502 write_file_to_stream_from_file( bkpinfo,xattr_fname);504 write_file_to_stream_from_file(xattr_fname); 503 505 write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE); 504 506 } … … 507 509 write_header_block_to_stream(length_of_file(acl_fname), acl_fname, 508 510 BLK_START_EXAT_FILE); 509 write_file_to_stream_from_file( bkpinfo,acl_fname);511 write_file_to_stream_from_file(acl_fname); 510 512 write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE); 511 513 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, … … 655 657 * @note Equivalent to openin_tape() for now, but don't count on this behavior. 656 658 */ 657 int openin_cdstream( struct s_bkpinfo *bkpinfo)658 { 659 return (openin_tape( bkpinfo));659 int openin_cdstream() 660 { 661 return (openin_tape()); 660 662 } 661 663 … … 696 698 * @note This will also work with a cdstream for now, but don't count on this behavior. 697 699 */ 698 int openin_tape( struct s_bkpinfo *bkpinfo)700 int openin_tape() 699 701 { 700 702 /*@ buffer ***************************************************** */ … … 886 888 */ 887 889 int 888 read_file_from_stream_to_file(struct s_bkpinfo *bkpinfo, char *outfile, 889 long long size) 890 read_file_from_stream_to_file(char *outfile, long long size) 890 891 { 891 892 … … 895 896 /*@ end vars *************************************************** */ 896 897 897 res = read_file_from_stream_FULL( bkpinfo,outfile, NULL, size);898 res = read_file_from_stream_FULL(outfile, NULL, size); 898 899 899 900 return (res); … … 911 912 */ 912 913 int 913 read_file_from_stream_to_stream(struct s_bkpinfo *bkpinfo, FILE * fout, 914 long long size) 914 read_file_from_stream_to_stream(FILE * fout, long long size) 915 915 { 916 916 … … 920 920 /*@ end vars *************************************************** */ 921 921 922 res = read_file_from_stream_FULL( bkpinfo,NULL, fout, size);922 res = read_file_from_stream_FULL(NULL, fout, size); 923 923 /* fflush(g_tape_stream); 924 924 fflush(fout);*/ … … 941 941 */ 942 942 int 943 read_file_from_stream_FULL(struct s_bkpinfo *bkpinfo, char *outfname, 944 FILE * foutstream, long long orig_size) 943 read_file_from_stream_FULL(char *outfname, FILE * foutstream, long long orig_size) 945 944 { 946 945 /*@ buffers ***************************************************** */ … … 1029 1028 log_msg(4, "where_I_was_... = %lld", 1030 1029 where_I_was_before_tape_change); 1031 start_to_read_from_next_tape( bkpinfo);1030 start_to_read_from_next_tape(); 1032 1031 log_msg(4, "Started reading from next tape."); 1033 1032 skip_incoming_files_until_we_find_this_one(temp_fname); … … 1362 1361 * @return 0 for success, nonzero for failure. 1363 1362 */ 1364 int start_to_read_from_next_tape( struct s_bkpinfo *bkpinfo)1363 int start_to_read_from_next_tape() 1365 1364 { 1366 1365 /*@ int ********************************************************* */ … … 1410 1409 * @return 0 for success, nonzero for failure. 1411 1410 */ 1412 int start_to_write_to_next_tape( struct s_bkpinfo *bkpinfo)1411 int start_to_write_to_next_tape() 1413 1412 { 1414 1413 int res = 0; … … 1470 1469 * @return 0 for success, nonzero for failure. 1471 1470 */ 1472 int write_backcatalog_to_tape( struct s_bkpinfo *bkpinfo)1471 int write_backcatalog_to_tape() 1473 1472 { 1474 1473 int i, last, res = 0; … … 1488 1487 BLK_START_AN_AFIO_OR_SLICE); 1489 1488 log_msg(2, "Writing %s", fname); 1490 if (write_file_to_stream_from_file( bkpinfo,fname)) {1489 if (write_file_to_stream_from_file(fname)) { 1491 1490 res++; 1492 1491 log_msg(2, "%s failed", fname); … … 1574 1573 * @return 0 for success, nonzero for failure. 1575 1574 */ 1576 int write_file_to_stream_from_file( struct s_bkpinfo *bkpinfo,char *infile)1575 int write_file_to_stream_from_file(char *infile) 1577 1576 { 1578 1577 /*@ buffers **************************************************** */ … … 1621 1620 if (should_we_write_to_next_tape 1622 1621 (bkpinfo->media_size[g_current_media_number], filesize)) { 1623 start_to_write_to_next_tape( bkpinfo);1624 write_backcatalog_to_tape( bkpinfo);1622 start_to_write_to_next_tape(); 1623 write_backcatalog_to_tape(); 1625 1624 } 1626 1625 p = strrchr(infile, '/'); … … 1659 1658 fclose(fin); 1660 1659 g_sigpipe = FALSE; 1661 start_to_write_to_next_tape( bkpinfo);1662 write_backcatalog_to_tape( bkpinfo); // kinda-sorta recursive :)1660 start_to_write_to_next_tape(); 1661 write_backcatalog_to_tape(); // kinda-sorta recursive :) 1663 1662 return (0); 1664 1663 } -
branches/2.2.5/mondo/src/common/libmondo-string.c
r1585 r1645 20 20 extern int g_current_media_number; 21 21 extern long long g_tape_posK; 22 23 /* Reference to global bkpinfo */ 24 extern struct s_bkpinfo *bkpinfo; 22 25 23 26 … … 1062 1065 * @note The returned string points to static storage that will be overwritten with each call. 1063 1066 */ 1064 char *percent_media_full_comment( struct s_bkpinfo *bkpinfo)1067 char *percent_media_full_comment() 1065 1068 { 1066 1069 /*@ int *********************************************** */ -
branches/2.2.5/mondo/src/common/libmondo-tools.c
r1644 r1645 196 196 extern int g_current_media_number; 197 197 extern char *MONDO_LOGFILE; 198 199 /* Reference to global bkpinfo */ 200 extern struct s_bkpinfo *bkpinfo; 198 201 199 202 /** … … 566 569 * do not exist. 567 570 */ 568 int post_param_configuration( struct s_bkpinfo *bkpinfo)571 int post_param_configuration() 569 572 { 570 573 char *extra_cdrom_params; … … 878 881 } 879 882 } 880 store_nfs_config( bkpinfo);883 store_nfs_config(); 881 884 } 882 885 … … 924 927 * @return number of errors (0 for success) 925 928 */ 926 int pre_param_configuration( struct s_bkpinfo *bkpinfo)929 int pre_param_configuration() 927 930 { 928 931 int res = 0; … … 932 935 srandom((unsigned long) (time(NULL))); 933 936 insmod_crucial_modules(); 934 reset_bkpinfo( bkpinfo); // also sets defaults ('/'=backup path, 3=compression level)937 reset_bkpinfo(); // also sets defaults ('/'=backup path, 3=compression level) 935 938 if (bkpinfo->disaster_recovery) { 936 939 if (!does_nonMS_partition_exist()) { … … 964 967 * @param bkpinfo The @c bkpinfo to reset. 965 968 */ 966 void reset_bkpinfo( struct s_bkpinfo *bkpinfo)969 void reset_bkpinfo() 967 970 { 968 971 int i; -
branches/2.2.5/mondo/src/common/libmondo-verify.c
r1644 r1645 128 128 extern char *MONDO_LOGFILE; 129 129 130 /* Reference to global bkpinfo */ 131 extern struct s_bkpinfo *bkpinfo; 132 130 133 /** 131 134 * Generate a list of the files that have changed, based on @c afio @c -r … … 210 213 * @return The number of sets containing differences (0 for success). 211 214 */ 212 int verify_afioballs_on_CD( struct s_bkpinfo *bkpinfo,char *mountpoint)215 int verify_afioballs_on_CD(char *mountpoint) 213 216 { 214 217 … … 229 232 set_number < 9999 230 233 && 231 !does_file_exist(vfy_tball_fname 232 (bkpinfo, mountpoint, set_number)); 234 !does_file_exist(vfy_tball_fname(mountpoint, set_number)); 233 235 set_number++); 234 if (!does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, set_number))) {236 if (!does_file_exist(vfy_tball_fname(mountpoint, set_number))) { 235 237 return (0); 236 238 } … … 253 255 254 256 for (total_sets = set_number; 255 does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, total_sets));257 does_file_exist(vfy_tball_fname(mountpoint, total_sets)); 256 258 total_sets++) { 257 259 log_msg(1, "total_sets = %d", total_sets); 258 260 } 259 261 for (; 260 does_file_exist(vfy_tball_fname( bkpinfo,mountpoint, set_number));262 does_file_exist(vfy_tball_fname(mountpoint, set_number)); 261 263 set_number++) { 262 264 percentage = … … 266 268 log_msg(1, "set = %d", set_number); 267 269 retval += 268 verify_an_afioball_from_CD(bkpinfo, 269 vfy_tball_fname(bkpinfo, mountpoint, 270 set_number)); 270 verify_an_afioball_from_CD(vfy_tball_fname(mountpoint, set_number)); 271 271 } 272 272 g_last_afioball_number = set_number - 1; … … 287 287 * @return The number of differences (0 for perfect biggiefiles). 288 288 */ 289 int verify_all_slices_on_CD( struct s_bkpinfo *bkpinfo,char *mtpt)289 int verify_all_slices_on_CD(char *mtpt) 290 290 { 291 291 … … 501 501 * @return 0, always. 502 502 */ 503 int verify_a_tarball( struct s_bkpinfo *bkpinfo,char *tarball_fname)503 int verify_a_tarball(char *tarball_fname) 504 504 { 505 505 /*@ buffers ********************************************************* */ … … 631 631 */ 632 632 int 633 verify_an_afioball_from_CD( struct s_bkpinfo *bkpinfo,char *tarball_fname)633 verify_an_afioball_from_CD(char *tarball_fname) 634 634 { 635 635 … … 637 637 int res = 0; 638 638 639 assert(bkpinfo != NULL);640 639 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 641 640 … … 644 643 fatal_error("Cannot verify nonexistent afioball"); 645 644 } 646 res = verify_a_tarball( bkpinfo,tarball_fname);645 res = verify_a_tarball(tarball_fname); 647 646 return (res); 648 647 } … … 659 658 */ 660 659 int 661 verify_an_afioball_from_stream(struct s_bkpinfo *bkpinfo, char *orig_fname, 662 long long size) 660 verify_an_afioball_from_stream(char *orig_fname, long long size) 663 661 { 664 662 … … 691 689 tarball_fname); 692 690 /* log_it(tmp); */ 693 read_file_from_stream_to_file( bkpinfo,tarball_fname, size);694 res = verify_a_tarball( bkpinfo,tarball_fname);691 read_file_from_stream_to_file(tarball_fname, size); 692 res = verify_a_tarball(tarball_fname); 695 693 if (res) { 696 694 sprintf(tmp, … … 714 712 */ 715 713 int 716 verify_a_biggiefile_from_stream(struct s_bkpinfo *bkpinfo, 717 char *biggie_fname, long long size) 714 verify_a_biggiefile_from_stream(char *biggie_fname, long long size) 718 715 { 719 716 … … 765 762 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 766 763 } 767 res = read_file_from_stream_to_file( bkpinfo,test_file, slice_siz);764 res = read_file_from_stream_to_file(test_file, slice_siz); 768 765 unlink(test_file); 769 766 res = … … 809 806 * @return 0 for success (even if there are differences); nonzero for a tape error. 810 807 */ 811 int verify_afioballs_from_stream( struct s_bkpinfo *bkpinfo)808 int verify_afioballs_from_stream() 812 809 { 813 810 /*@ int ********************************************************** */ … … 842 839 } 843 840 log_to_screen("Verifying regular archives on tape"); 844 total_afioballs = get_last_filelist_number( bkpinfo) + 1;841 total_afioballs = get_last_filelist_number() + 1; 845 842 open_progress_form("Verifying filesystem", 846 843 "I am verifying archives against your live filesystem now.", … … 853 850 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 854 851 res = 855 read_EXAT_files_from_tape( bkpinfo,&size, fname, &ctrl_chr,852 read_EXAT_files_from_tape(&size, fname, &ctrl_chr, 856 853 curr_xattr_list_fname, 857 854 curr_acl_list_fname); … … 876 873 iamhere("Reading EXAT files from tape"); 877 874 res = 878 read_EXAT_files_from_tape( bkpinfo,&size, fname, &ctrl_chr,875 read_EXAT_files_from_tape(&size, fname, &ctrl_chr, 879 876 curr_xattr_list_fname, 880 877 curr_acl_list_fname); … … 886 883 /*log_it(tmp); */ 887 884 update_progress_form(tmp); 888 res = verify_an_afioball_from_stream( bkpinfo,fname, size);885 res = verify_an_afioball_from_stream(fname, size); 889 886 if (res) { 890 887 sprintf(tmp, "Afioball %ld differs from live filesystem", … … 917 914 * @return 0 for success (even if there are differences); nonzero for a tape error. 918 915 */ 919 int verify_biggiefiles_from_stream( struct s_bkpinfo *bkpinfo)916 int verify_biggiefiles_from_stream() 920 917 { 921 918 … … 966 963 iamhere("Grabbing the EXAT biggiefiles"); 967 964 res = 968 read_EXAT_files_from_tape( bkpinfo,&size, orig_fname,965 read_EXAT_files_from_tape(&size, orig_fname, 969 966 &ctrl_chr, curr_xattr_list_fname, 970 967 curr_acl_list_fname); … … 998 995 sprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 999 996 res = 1000 verify_a_biggiefile_from_stream( bkpinfo,logical_fname, size);997 verify_a_biggiefile_from_stream(logical_fname, size); 1001 998 retval += res; 1002 999 current_biggiefile_number++; … … 1030 1027 * @ingroup verifyGroup 1031 1028 */ 1032 int verify_cd_image( struct s_bkpinfo *bkpinfo)1029 int verify_cd_image() 1033 1030 { 1034 1031 … … 1071 1068 popup_and_OK("Please push CD tray closed."); 1072 1069 } 1073 if (find_and_mount_actual_cd( bkpinfo,mountpoint)) {1070 if (find_and_mount_actual_cd(mountpoint)) { 1074 1071 log_to_screen("failed to mount actual CD"); 1075 1072 return (1); … … 1112 1109 */ 1113 1110 } 1114 verify_afioballs_on_CD( bkpinfo,mountpoint);1111 verify_afioballs_on_CD(mountpoint); 1115 1112 iamhere("before verify_all_slices"); 1116 verify_all_slices_on_CD( bkpinfo,mountpoint);1113 verify_all_slices_on_CD(mountpoint); 1117 1114 1118 1115 #ifdef __FreeBSD__ … … 1155 1152 * @ingroup verifyGroup 1156 1153 */ 1157 int verify_tape_backups( struct s_bkpinfo *bkpinfo)1154 int verify_tape_backups() 1158 1155 { 1159 1156 … … 1172 1169 log_msg(3, "verify_tape_backups --- starting"); 1173 1170 log_to_screen("Verifying backups"); 1174 openin_tape( bkpinfo);1171 openin_tape(); 1175 1172 /* verify archives themselves */ 1176 retval += verify_afioballs_from_stream( bkpinfo);1177 retval += verify_biggiefiles_from_stream( bkpinfo);1173 retval += verify_afioballs_from_stream(); 1174 retval += verify_biggiefiles_from_stream(); 1178 1175 /* find the final blocks */ 1179 1176 paranoid_system("sync"); 1180 1177 sleep(2); 1181 closein_tape( bkpinfo);1178 closein_tape(); 1182 1179 /* close tape; exit */ 1183 1180 // fclose(g_tape_stream); <-- not needed; is handled by closein_tape() … … 1231 1228 * @ingroup stringGroup 1232 1229 */ 1233 char *vfy_tball_fname(struct s_bkpinfo *bkpinfo, char *mountpoint, 1234 int setno) 1230 char *vfy_tball_fname(char *mountpoint, int setno) 1235 1231 { 1236 1232 /*@ buffers ******************************************************* */ -
branches/2.2.5/mondo/src/mondoarchive/main.c
r1644 r1645 146 146 extern int g_loglevel; 147 147 148 /* Reference to global bkpinfo */ 149 struct s_bkpinfo *bkpinfo; 150 148 151 /****************** subroutines used only by main.c ******************/ 149 152 … … 261 264 int main(int argc, char *argv[]) 262 265 { 263 struct s_bkpinfo *bkpinfo;264 266 char *tmp; 265 267 int res, retval; … … 422 424 } 423 425 424 if (pre_param_configuration( bkpinfo)) {426 if (pre_param_configuration()) { 425 427 fatal_error 426 428 ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting..."); … … 431 433 g_text_mode = FALSE; 432 434 setup_newt_stuff(); 433 res = interactively_obtain_media_parameters_from_user( bkpinfo,TRUE); /* yes, archiving */435 res = interactively_obtain_media_parameters_from_user(TRUE); /* yes, archiving */ 434 436 if (res) { 435 437 fatal_error … … 437 439 } 438 440 } else { 439 res = handle_incoming_parameters(argc, argv , bkpinfo);441 res = handle_incoming_parameters(argc, argv); 440 442 if (res) { 441 443 printf … … 449 451 450 452 /* Finish configuring global structures */ 451 if (post_param_configuration( bkpinfo)) {453 if (post_param_configuration()) { 452 454 fatal_error 453 455 ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting..."); … … 461 463 /* If we're meant to backup then backup */ 462 464 if (bkpinfo->backup_data) { 463 res = backup_data( bkpinfo);465 res = backup_data(); 464 466 retval += res; 465 467 if (res) { … … 473 475 /* If we're meant to verify then verify */ 474 476 if (bkpinfo->verify_data) { 475 res = verify_data( bkpinfo);477 res = verify_data(); 476 478 if (res < 0) { 477 479 sprintf(tmp, "%d difference%c found.", -res, … … 486 488 /* Offer to write floppy disk images to physical disks */ 487 489 if (bkpinfo->backup_data && !g_skip_floppies) { 488 res = offer_to_write_boot_floppies_to_physical_disks( bkpinfo);490 res = offer_to_write_boot_floppies_to_physical_disks(); 489 491 retval += res; 490 // res = offer_to_write_boot_ISO_to_physical_CD( bkpinfo);492 // res = offer_to_write_boot_ISO_to_physical_CD(); 491 493 // retval += res; 492 494 } -
branches/2.2.5/mondo/src/mondoarchive/mondo-cli.c
r1540 r1645 210 210 char *g_getfacl = NULL; 211 211 char *g_getfattr = NULL; 212 213 /* Reference to global bkpinfo */ 214 extern struct s_bkpinfo *bkpinfo; 212 215 213 216 /** … … 223 226 */ 224 227 int 225 handle_incoming_parameters(int argc, char *argv[], 226 struct s_bkpinfo *bkpinfo) 228 handle_incoming_parameters(int argc, char *argv[]) 227 229 { 228 230 /*@ int *** */ … … 237 239 238 240 malloc_string(tmp); 239 sensibly_set_tmpdir_and_scratchdir( bkpinfo);241 sensibly_set_tmpdir_and_scratchdir(); 240 242 for (i = 0; i < 128; i++) { 241 243 flag_val[i][0] = '\0'; … … 252 254 retval += res; 253 255 if (!retval) { 254 res = process_switches( bkpinfo,flag_val, flag_set);256 res = process_switches(flag_val, flag_set); 255 257 retval += res; 256 258 } … … 293 295 * @bug Return code not needed. 294 296 */ 295 int process_the_s_switch( struct s_bkpinfo *bkpinfo,char *value)297 int process_the_s_switch(char *value) 296 298 { 297 299 int j; … … 337 339 */ 338 340 int 339 process_switches(struct s_bkpinfo *bkpinfo, 340 char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 341 process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 341 342 { 342 343 … … 602 603 ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 603 604 } 604 if (process_the_s_switch( bkpinfo,flag_val['s'])) {605 if (process_the_s_switch(flag_val['s'])) { 605 606 fatal_error("Bad -s switch"); 606 607 } … … 616 617 } else { /* CD size */ 617 618 if (flag_set['s']) { 618 if (process_the_s_switch( bkpinfo,flag_val['s'])) {619 if (process_the_s_switch(flag_val['s'])) { 619 620 fatal_error("Bad -s switch"); 620 621 } -
branches/2.2.5/mondo/src/mondorestore/mondo-prep.c
r1497 r1645 190 190 extern void pause_for_N_seconds(int, char *); 191 191 extern char *MONDO_LOGFILE; 192 193 192 194 193 FILE *g_fprep = NULL; -
branches/2.2.5/mondo/src/mondorestore/mondo-restore.c
r1644 r1645 24 24 extern void twenty_seconds_til_yikes(void); 25 25 26 /* Reference to global bkpinfo */ 27 struct s_bkpinfo *bkpinfo; 28 26 29 27 30 /* For use in other programs (ex. XMondo) */ … … 153 156 * @ingroup restoreGuiGroup 154 157 */ 155 int let_user_edit_the_mountlist(struct s_bkpinfo *bkpinfo, 156 struct mountlist_itself *mountlist, 158 int let_user_edit_the_mountlist(struct mountlist_itself *mountlist, 157 159 struct raidlist_itself *raidlist) 158 160 { … … 259 261 */ 260 262 int 261 catchall_mode(struct s_bkpinfo *bkpinfo, 262 struct mountlist_itself *mountlist, 263 catchall_mode(struct mountlist_itself *mountlist, 263 264 struct raidlist_itself *raidlist) 264 265 { … … 275 276 iamhere("post wrm"); 276 277 if (c == 'I' || c == 'N' || c == 'C') { 277 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);278 interactively_obtain_media_parameters_from_user(FALSE); 278 279 } else { 279 280 popup_and_OK("No restoring or comparing will take place today."); … … 302 303 if (c == 'I') { 303 304 log_msg(2, "IM selected"); 304 retval += interactive_mode( bkpinfo,mountlist, raidlist);305 retval += interactive_mode(mountlist, raidlist); 305 306 } else if (c == 'N') { 306 307 log_msg(2, "NM selected"); 307 retval += nuke_mode( bkpinfo,mountlist, raidlist);308 retval += nuke_mode(mountlist, raidlist); 308 309 } else if (c == 'C') { 309 310 log_msg(2, "CM selected"); 310 retval += compare_mode( bkpinfo,mountlist, raidlist);311 retval += compare_mode(mountlist, raidlist); 311 312 } 312 313 paranoid_free(tmp); … … 358 359 **************************************************************************/ 359 360 360 static void clean_blkid( struct s_bkpinfo *bkpinfo) {361 static void clean_blkid() { 361 362 362 363 char *tmp1 = NULL; … … 388 389 */ 389 390 int 390 interactive_mode(struct s_bkpinfo *bkpinfo, 391 struct mountlist_itself *mountlist, 391 interactive_mode(struct mountlist_itself *mountlist, 392 392 struct raidlist_itself *raidlist) 393 393 { … … 429 429 430 430 iamhere("About to load config file"); 431 get_cfg_file_from_archive_or_bust( bkpinfo);432 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);431 get_cfg_file_from_archive_or_bust(); 432 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 433 433 iamhere("Done loading config file; resizing ML"); 434 434 strcpy(tmp, bkpinfo->prefix); … … 551 551 { 552 552 log_msg(1, "Restoring all data"); 553 retval += restore_everything( bkpinfo,NULL);553 retval += restore_everything(NULL); 554 554 } else 555 555 if ((restore_all = … … 559 559 for (done = FALSE; !done;) { 560 560 unlink("/tmp/filelist.full"); 561 filelist = process_filelist_and_biggielist( bkpinfo);561 filelist = process_filelist_and_biggielist(); 562 562 /* Now you have /tmp/tmpfs/filelist.restore-these and /tmp/tmpfs/biggielist.restore-these; 563 563 the former is a list of regular files; the latter, biggiefiles and imagedevs. … … 578 578 strcpy(bkpinfo->restore_path, tmp); 579 579 log_msg(1, "Restoring subset"); 580 retval += restore_everything( bkpinfo,filelist);580 retval += restore_everything(filelist); 581 581 free_filelist(filelist); 582 582 } else { … … 612 612 } 613 613 614 clean_blkid( bkpinfo);614 clean_blkid(); 615 615 protect_against_braindead_sysadmins(); 616 616 retval += unmount_all_devices(mountlist); … … 663 663 * Run an arbitrary restore mode (prompt the user), but from ISO images 664 664 * instead of real media. 665 * @param bkpinfo The backup information structure. Most fields are used.666 665 * @param mountlist The mountlist containing information about the user's partitions. 667 666 * @param raidlist The raidlist that goes with @p mountlist. … … 670 669 */ 671 670 int 672 iso_mode(struct s_bkpinfo *bkpinfo, 673 struct mountlist_itself *mountlist, 671 iso_mode(struct mountlist_itself *mountlist, 674 672 struct raidlist_itself *raidlist, bool nuke_me_please) 675 673 { … … 677 675 int retval = 0; 678 676 679 assert(bkpinfo != NULL);680 677 assert(mountlist != NULL); 681 678 assert(raidlist != NULL); 682 if (iso_fiddly_bits( bkpinfo,nuke_me_please)) {679 if (iso_fiddly_bits(nuke_me_please)) { 683 680 log_msg(1, "iso_mode --- returning w/ error"); 684 681 return (1); … … 686 683 c = which_restore_mode(); 687 684 if (c == 'I' || c == 'N' || c == 'C') { 688 interactively_obtain_media_parameters_from_user(bkpinfo, 689 FALSE); 685 interactively_obtain_media_parameters_from_user(FALSE); 690 686 } 691 687 if (c == 'I') { 692 retval += interactive_mode( bkpinfo,mountlist, raidlist);688 retval += interactive_mode(mountlist, raidlist); 693 689 } else if (c == 'N') { 694 retval += nuke_mode( bkpinfo,mountlist, raidlist);690 retval += nuke_mode(mountlist, raidlist); 695 691 } else if (c == 'C') { 696 retval += compare_mode( bkpinfo,mountlist, raidlist);692 retval += compare_mode(mountlist, raidlist); 697 693 } else { 698 694 log_to_screen("OK, I shan't restore/compare any files."); … … 732 728 */ 733 729 int 734 nuke_mode(struct s_bkpinfo *bkpinfo, 735 struct mountlist_itself *mountlist, 730 nuke_mode(struct mountlist_itself *mountlist, 736 731 struct raidlist_itself *raidlist) 737 732 { … … 749 744 log_msg(2, "nuke_mode --- starting"); 750 745 751 get_cfg_file_from_archive_or_bust( bkpinfo);746 get_cfg_file_from_archive_or_bust(); 752 747 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo updated the mountlist 753 748 #ifdef __FreeBSD__ … … 770 765 tmpA, tmpB, tmpC); 771 766 if (ask_me_yes_or_no(tmp)) { 772 retval = interactive_mode( bkpinfo,mountlist, raidlist);767 retval = interactive_mode(mountlist, raidlist); 773 768 goto after_the_nuke; 774 769 } else { … … 828 823 829 824 if (ask_me_yes_or_no("Try in interactive mode instead?")) { 830 retval = interactive_mode( bkpinfo,mountlist, raidlist);825 retval = interactive_mode(mountlist, raidlist); 831 826 goto after_the_nuke; 832 827 } else … … 844 839 } 845 840 iamhere("Restoring everything"); 846 retval += restore_everything( bkpinfo,NULL);841 retval += restore_everything(NULL); 847 842 if (!run_boot_loader(FALSE)) { 848 843 log_msg(1, … … 850 845 boot_loader_installed = TRUE; 851 846 } 852 clean_blkid( bkpinfo);847 clean_blkid(); 853 848 protect_against_braindead_sysadmins(); 854 849 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; … … 937 932 sleep(1); 938 933 } 939 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);934 interactively_obtain_media_parameters_from_user(FALSE); 940 935 log_msg(2, "bkpinfo->media_device = %s", bkpinfo->media_device); 941 936 if (!bkpinfo->media_device[0]) { … … 948 943 open_evalcall_form("Thinking..."); 949 944 950 get_cfg_file_from_archive_or_bust( bkpinfo);951 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);945 get_cfg_file_from_archive_or_bust(); 946 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 952 947 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo 953 948 … … 955 950 retval = load_mountlist(mountlist, g_mountlist_fname); 956 951 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 957 filelist = process_filelist_and_biggielist( bkpinfo);952 filelist = process_filelist_and_biggielist(); 958 953 if (filelist) { 959 954 save_filelist(filelist, "/tmp/selected-files.txt"); … … 963 958 bkpinfo->restore_path, MAX_STR_LEN / 4)) { 964 959 iamhere("Restoring everything"); 965 retval += restore_everything( bkpinfo,filelist);960 retval += restore_everything(filelist); 966 961 free_filelist(filelist); 967 962 strcpy(bkpinfo->restore_path, old_restpath); … … 1014 1009 */ 1015 1010 int 1016 restore_a_biggiefile_from_CD(struct s_bkpinfo *bkpinfo, 1017 long bigfileno, 1011 restore_a_biggiefile_from_CD(long bigfileno, 1018 1012 struct s_node *filelist, 1019 1013 char *pathname_of_last_file_restored) … … 1204 1198 g_current_media_number); 1205 1199 log_to_screen(tmp); 1206 insist_on_this_cd_number( bkpinfo,g_current_media_number);1200 insist_on_this_cd_number(g_current_media_number); 1207 1201 log_to_screen("Continuing to restore."); 1208 1202 } else { … … 1345 1339 * @bug orig_checksum and biggiefile_size are unused (except to check that they are non-NULL). 1346 1340 */ 1347 int restore_a_biggiefile_from_stream( struct s_bkpinfo *bkpinfo,char *orig_bf_fname, long biggiefile_number, char *orig_checksum, //UNUSED1341 int restore_a_biggiefile_from_stream(char *orig_bf_fname, long biggiefile_number, char *orig_checksum, //UNUSED 1348 1342 long long biggiefile_size, //UNUSED 1349 1343 struct s_node *filelist, … … 1518 1512 if (current_slice_number == 0) { 1519 1513 res = 1520 read_file_from_stream_to_file(bkpinfo, 1521 "/tmp/biggie-blah.txt", 1514 read_file_from_stream_to_file("/tmp/biggie-blah.txt", 1522 1515 slice_siz); 1523 1516 if (!(fin = fopen("/tmp/biggie-blah.txt", "r"))) { … … 1535 1528 } else { 1536 1529 res = 1537 read_file_from_stream_to_stream( bkpinfo,pout, slice_siz);1530 read_file_from_stream_to_stream(pout, slice_siz); 1538 1531 } 1539 1532 retval += res; … … 1837 1830 */ 1838 1831 int 1839 restore_a_tarball_from_stream(struct s_bkpinfo *bkpinfo, 1840 char *tarball_fname, 1832 restore_a_tarball_from_stream(char *tarball_fname, 1841 1833 long current_tarball_number, 1842 1834 struct s_node *filelist, … … 1890 1882 bkpinfo->tmpdir, current_tarball_number); 1891 1883 // sprintf(filelist_fname, "/tmp/tmpfs/temp-filelist.%ld", current_tarball_number); 1892 res = read_file_from_stream_to_file( bkpinfo,afio_fname, size);1884 res = read_file_from_stream_to_file(afio_fname, size); 1893 1885 if (strstr(tarball_fname, ".star")) { 1894 1886 bkpinfo->use_star = TRUE; … … 2031 2023 */ 2032 2024 int 2033 restore_all_biggiefiles_from_CD(struct s_bkpinfo *bkpinfo, 2034 struct s_node *filelist) 2025 restore_all_biggiefiles_from_CD(struct s_node *filelist) 2035 2026 { 2036 2027 int retval = 0; … … 2099 2090 "I'll continue to scan this CD for bigfiles to be restored."); 2100 2091 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2101 insist_on_this_cd_number(bkpinfo, 2102 ++g_current_media_number); 2092 insist_on_this_cd_number(++g_current_media_number); 2103 2093 sprintf(tmp, "Restoring from %s #%d", 2104 media_descriptor_string(bkpinfo-> 2105 backup_media_type), 2094 media_descriptor_string(bkpinfo->backup_media_type), 2106 2095 g_current_media_number); 2107 2096 log_to_screen(tmp); … … 2118 2107 update_progress_form(tmp); 2119 2108 res = 2120 restore_a_biggiefile_from_CD(bkpinfo, bigfileno, filelist, 2121 pathname_of_last_biggie_restored); 2109 restore_a_biggiefile_from_CD(bigfileno, filelist, pathname_of_last_biggie_restored); 2122 2110 iamhere(pathname_of_last_biggie_restored); 2123 2111 if (fbw && pathname_of_last_biggie_restored[0]) { … … 2180 2168 */ 2181 2169 int 2182 restore_all_tarballs_from_CD(struct s_bkpinfo *bkpinfo, 2183 struct s_node *filelist) 2170 restore_all_tarballs_from_CD(struct s_node *filelist) 2184 2171 { 2185 2172 int retval = 0; … … 2208 2195 g_current_media_number = 1; 2209 2196 } 2210 insist_on_this_cd_number( bkpinfo,g_current_media_number);2197 insist_on_this_cd_number(g_current_media_number); 2211 2198 read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp); 2212 2199 max_val = atol(tmp) + 1; … … 2220 2207 progress_str, max_val); 2221 2208 for (;;) { 2222 insist_on_this_cd_number( bkpinfo,g_current_media_number);2209 insist_on_this_cd_number(g_current_media_number); 2223 2210 update_progress_form(progress_str); 2224 2211 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", … … 2326 2313 */ 2327 2314 int 2328 restore_all_biggiefiles_from_stream(struct s_bkpinfo *bkpinfo, 2329 struct s_node *filelist) 2315 restore_all_biggiefiles_from_stream(struct s_node *filelist) 2330 2316 { 2331 2317 long noof_biggiefiles; … … 2381 2367 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2382 2368 res = 2383 read_EXAT_files_from_tape( bkpinfo,&biggie_size, biggie_fname,2369 read_EXAT_files_from_tape(&biggie_size, biggie_fname, 2384 2370 &ctrl_chr, xattr_fname, acl_fname); 2385 2371 } … … 2414 2400 current_bigfile_number + 1, biggie_size / 1024); 2415 2401 update_progress_form(tmp); 2416 res = restore_a_biggiefile_from_stream(b kpinfo, biggie_fname,2402 res = restore_a_biggiefile_from_stream(biggie_fname, 2417 2403 current_bigfile_number, 2418 2404 biggie_cksum, … … 2505 2491 */ 2506 2492 int 2507 restore_all_tarballs_from_stream(struct s_bkpinfo *bkpinfo, 2508 struct s_node *filelist) 2493 restore_all_tarballs_from_stream(struct s_node *filelist) 2509 2494 { 2510 2495 int retval = 0; … … 2572 2557 iamhere("Reading EXAT files from tape"); 2573 2558 res = 2574 read_EXAT_files_from_tape( bkpinfo,&tmp_size, tmp_fname,2559 read_EXAT_files_from_tape(&tmp_size, tmp_fname, 2575 2560 &ctrl_chr, xattr_fname, 2576 2561 acl_fname); … … 2583 2568 current_afioball_number, tmp_fname, (long) tmp_size >> 10); 2584 2569 res = 2585 restore_a_tarball_from_stream( bkpinfo,tmp_fname,2570 restore_a_tarball_from_stream(tmp_fname, 2586 2571 current_afioball_number, 2587 2572 filelist, tmp_size, xattr_fname, … … 2644 2629 * @ingroup restoreGroup 2645 2630 */ 2646 int restore_everything(struct s_ bkpinfo *bkpinfo, struct s_node *filelist)2631 int restore_everything(struct s_node *filelist) 2647 2632 { 2648 2633 int resA; … … 2675 2660 mvaddstr_and_log_it(g_currentY, 0, "Preparing to read your archives"); 2676 2661 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2677 mount_cdrom( bkpinfo);2662 mount_cdrom(); 2678 2663 mvaddstr_and_log_it(g_currentY++, 0, 2679 2664 "Restoring OS and data from streaming media"); 2680 2665 if (bkpinfo->backup_media_type == cdstream) { 2681 openin_cdstream( bkpinfo);2666 openin_cdstream(); 2682 2667 } else { 2683 assert_string_is_neither_NULL_nor_zerolength(bkpinfo-> 2684 media_device); 2685 openin_tape(bkpinfo); 2686 } 2687 resA = restore_all_tarballs_from_stream(bkpinfo, filelist); 2688 resB = restore_all_biggiefiles_from_stream(bkpinfo, filelist); 2668 assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device); 2669 openin_tape(); 2670 } 2671 resA = restore_all_tarballs_from_stream(filelist); 2672 resB = restore_all_biggiefiles_from_stream(filelist); 2689 2673 if (bkpinfo->backup_media_type == cdstream) { 2690 closein_cdstream( bkpinfo);2674 closein_cdstream(); 2691 2675 } else { 2692 closein_tape( bkpinfo);2676 closein_tape(); 2693 2677 } 2694 2678 } else { 2695 2679 mvaddstr_and_log_it(g_currentY++, 0, 2696 2680 "Restoring OS and data from CD "); 2697 mount_cdrom( bkpinfo);2698 resA = restore_all_tarballs_from_CD( bkpinfo,filelist);2699 resB = restore_all_biggiefiles_from_CD( bkpinfo,filelist);2681 mount_cdrom(); 2682 resA = restore_all_tarballs_from_CD(filelist); 2683 resB = restore_all_biggiefiles_from_CD(filelist); 2700 2684 } 2701 2685 chdir(cwd); … … 2726 2710 */ 2727 2711 int 2728 restore_live_from_monitas_server(struct s_bkpinfo *bkpinfo, 2729 char *monitas_device, 2712 restore_live_from_monitas_server(char *monitas_device, 2730 2713 char *restore_this_directory, 2731 2714 char *restore_here) … … 2799 2782 2800 2783 unlink(datadisks_fname); 2801 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);2784 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 2802 2785 retval = load_mountlist(&the_mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo strcpy(bkpinfo->media_device, monitas_device); 2803 2786 … … 2826 2809 run_program_and_log_output(command, FALSE); 2827 2810 // filelist = load_filelist(g_filelist_restthese); // FIXME --- this probably doesn't work because it doesn't include the biggiefiles 2828 retval += restore_everything( bkpinfo,filelist);2811 retval += restore_everything(filelist); 2829 2812 free_filelist(filelist); 2830 2813 log_msg(2, "--------End of restore_live_from_monitas_server--------"); … … 2898 2881 struct mountlist_itself *mountlist; 2899 2882 struct raidlist_itself *raidlist; 2900 struct s_bkpinfo *bkpinfo;2901 2883 struct s_node *filelist; 2902 2884 char *a, *b; … … 2958 2940 malloc_string(a); 2959 2941 malloc_string(b); 2960 setup_MR_global_filenames( bkpinfo); // malloc() and set globals, using bkpinfo->tmpdir etc.2961 reset_bkpinfo( bkpinfo);2942 setup_MR_global_filenames(); // malloc() and set globals, using bkpinfo->tmpdir etc. 2943 reset_bkpinfo(); 2962 2944 bkpinfo->backup_media_type = none; // in case boot disk was made for one backup type but user wants to restore from another backup type 2963 2945 bkpinfo->restore_data = TRUE; // Well, yeah :-) … … 3027 3009 strcpy(g_mountlist_fname, "/tmp/mountlist.txt"); 3028 3010 } 3029 res = let_user_edit_the_mountlist( bkpinfo,mountlist, raidlist);3011 res = let_user_edit_the_mountlist(mountlist, raidlist); 3030 3012 #ifdef __FreeBSD__ 3031 3013 system("mv -f /etc/raidtab /tmp/raidconf.txt"); … … 3060 3042 system("rm -Rf /tmp/*pih*"); 3061 3043 3062 restore_a_biggiefile_from_CD( bkpinfo,42, NULL, tmp);3044 restore_a_biggiefile_from_CD(42, NULL, tmp); 3063 3045 } 3064 3046 … … 3161 3143 if (argc == 5 && strcmp(argv[1], "--monitas-live") == 0) { 3162 3144 retval = 3163 restore_live_from_monitas_server(bkpinfo, 3164 argv[2], 3145 restore_live_from_monitas_server(argv[2], 3165 3146 argv[3], argv[4]); 3166 3147 } else { 3167 3148 log_msg(2, "Calling restore_to_live_filesystem()"); 3168 retval = restore_to_live_filesystem( bkpinfo);3149 retval = restore_to_live_filesystem(); 3169 3150 } 3170 3151 log_msg(2, "Still here. Yay."); … … 3186 3167 iamhere("About to call load_mountlist and load_raidtab"); 3187 3168 strcpy(bkpinfo->restore_path, MNT_RESTORING); 3188 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);3169 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 3189 3170 retval = load_mountlist(mountlist, g_mountlist_fname); 3190 3171 retval += load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); … … 3245 3226 if (argc == 2 && strcmp(argv[1], "--nuke") == 0) { 3246 3227 iamhere("nuking"); 3247 retval += nuke_mode( bkpinfo,mountlist, raidlist);3228 retval += nuke_mode(mountlist, raidlist); 3248 3229 } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) { 3249 3230 iamhere("catchall"); 3250 retval += catchall_mode( bkpinfo,mountlist, raidlist);3231 retval += catchall_mode(mountlist, raidlist); 3251 3232 } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) { 3252 3233 iamhere("compare"); 3253 retval += compare_mode( bkpinfo,mountlist, raidlist);3234 retval += compare_mode(mountlist, raidlist); 3254 3235 } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) { 3255 3236 iamhere("iso"); 3256 retval = iso_mode( bkpinfo,mountlist, raidlist, FALSE);3237 retval = iso_mode(mountlist, raidlist, FALSE); 3257 3238 } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) { 3258 3239 iamhere("mbr"); … … 3267 3248 } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) { 3268 3249 iamhere("isonuke"); 3269 retval = iso_mode( bkpinfo,mountlist, raidlist, TRUE);3250 retval = iso_mode(mountlist, raidlist, TRUE); 3270 3251 } else if (argc != 1) { 3271 3252 log_to_screen("Invalid paremeters"); … … 3273 3254 } else { 3274 3255 iamhere("catchall (no mode specified in command-line call"); 3275 retval += catchall_mode( bkpinfo,mountlist, raidlist);3256 retval += catchall_mode(mountlist, raidlist); 3276 3257 } 3277 3258 } -
branches/2.2.5/mondo/src/mondorestore/mondo-rstr-compare.c
r1644 r1645 67 67 extern char *MONDO_LOGFILE; 68 68 69 /* Reference to global bkpinfo */ 70 extern struct s_bkpinfo *bkpinfo; 71 69 72 //static char cvsid[] = "$Id$"; 70 73 … … 82 85 * @note This function uses an MD5 checksum. 83 86 */ 84 int compare_a_biggiefile( struct s_bkpinfo *bkpinfo,long bigfileno)87 int compare_a_biggiefile(long bigfileno) 85 88 { 86 89 … … 127 130 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 128 131 if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 129 insist_on_this_cd_number( bkpinfo,(++g_current_media_number));132 insist_on_this_cd_number((++g_current_media_number)); 130 133 } else { 131 134 sprintf(tmp_ptr, … … 230 233 /** 231 234 * Compare all biggiefiles in the backup. 232 * @param bkpinfo The backup information structure. Used only in compare_a_biggiefile().233 235 * @return 0 for success, nonzero for failure. 234 236 */ 235 int compare_all_biggiefiles( struct s_bkpinfo *bkpinfo)237 int compare_all_biggiefiles() 236 238 { 237 239 int retval = 0; … … 240 242 char tmp[MAX_STR_LEN]; 241 243 242 assert(bkpinfo != NULL);243 244 log_msg(1, "Comparing biggiefiles"); 244 245 … … 263 264 log_msg(1, tmp); 264 265 update_progress_form(tmp); 265 res = compare_a_biggiefile(b kpinfo, bigfileno);266 res = compare_a_biggiefile(bigfileno); 266 267 retval += res; 267 268 g_current_progress++; … … 417 418 * @return 0 for success, nonzero for failure. 418 419 */ 419 int compare_all_tarballs( struct s_bkpinfo *bkpinfo)420 int compare_all_tarballs() 420 421 { 421 422 int retval = 0; … … 449 450 450 451 for (;;) { 451 insist_on_this_cd_number( bkpinfo,g_current_media_number);452 insist_on_this_cd_number(g_current_media_number); 452 453 update_progress_form(progress_str); 453 454 sprintf(tarball_fname, … … 523 524 * @return 0 for success, nonzero for failure. 524 525 */ 525 int compare_to_CD( struct s_bkpinfo *bkpinfo)526 int compare_to_CD() 526 527 { 527 528 /** needs malloc *********/ … … 541 542 chdir(bkpinfo->restore_path); 542 543 getcwd(new, MAX_STR_LEN - 1); 543 insist_on_this_cd_number( bkpinfo,g_current_media_number);544 insist_on_this_cd_number(g_current_media_number); 544 545 unlink(MINDI_CACHE"/changed.txt"); 545 546 546 resA = compare_all_tarballs( bkpinfo);547 resB = compare_all_biggiefiles( bkpinfo);547 resA = compare_all_tarballs(); 548 resB = compare_all_biggiefiles(); 548 549 chdir(cwd); 549 550 noof_changed_files = count_lines_in_file(MINDI_CACHE"/changed.txt"); … … 586 587 */ 587 588 int 588 compare_mode(struct s_bkpinfo *bkpinfo, 589 struct mountlist_itself *mountlist, 589 compare_mode(struct mountlist_itself *mountlist, 590 590 struct raidlist_itself *raidlist) 591 591 { … … 608 608 assert(raidlist != NULL); 609 609 610 while (get_cfg_file_from_archive( bkpinfo)) {610 while (get_cfg_file_from_archive()) { 611 611 if (!ask_me_yes_or_no 612 612 ("Failed to find config file/archives. Choose another source?")) … … 614 614 fatal_error("Unable to find config file/archives. Aborting."); 615 615 } 616 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);617 } 618 619 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);616 interactively_obtain_media_parameters_from_user(FALSE); 617 } 618 619 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 620 620 g_current_media_number = 1; 621 621 mvaddstr_and_log_it(1, 30, "Comparing Automatically"); … … 629 629 if (bkpinfo->backup_media_type == tape 630 630 || bkpinfo->backup_media_type == udev) { 631 retval += compare_to_tape( bkpinfo);631 retval += compare_to_tape(); 632 632 } else if (bkpinfo->backup_media_type == cdstream) { 633 retval += compare_to_cdstream( bkpinfo);634 } else { 635 retval += compare_to_CD( bkpinfo);633 retval += compare_to_cdstream(); 634 } else { 635 retval += compare_to_CD(); 636 636 } 637 637 if (retval) { … … 695 695 * @return 0 for success, nonzero for failure. 696 696 */ 697 int compare_to_cdstream( struct s_bkpinfo *bkpinfo)697 int compare_to_cdstream() 698 698 { 699 699 int res; … … 721 721 find_cdrom_device(bkpinfo->media_device, FALSE); 722 722 } 723 res = verify_tape_backups( bkpinfo);723 res = verify_tape_backups(); 724 724 chdir(dir); 725 725 if (length_of_file(MINDI_CACHE"/changed.txt") > 2 … … 754 754 * returns: int * 755 755 **************************************************************************/ 756 int compare_to_tape( struct s_bkpinfo *bkpinfo)756 int compare_to_tape() 757 757 { 758 758 int res; … … 770 770 mvaddstr_and_log_it(g_currentY, 771 771 0, "Verifying archives against filesystem"); 772 res = verify_tape_backups( bkpinfo);772 res = verify_tape_backups(); 773 773 chdir(dir); 774 774 if (res) { -
branches/2.2.5/mondo/src/mondorestore/mondo-rstr-newt.c
r738 r1645 95 95 96 96 extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN]; 97 98 97 99 98 /** -
branches/2.2.5/mondo/src/mondorestore/mondo-rstr-tools.c
r1640 r1645 162 162 extern char *MONDO_LOGFILE; 163 163 164 /* Reference to global bkpinfo */ 165 extern struct s_bkpinfo *bkpinfo; 166 164 167 /* Should we use or not extended attributes and acl when restoring */ 165 168 char *g_getfattr = NULL; … … 285 288 */ 286 289 int 287 extract_config_file_from_ramdisk(struct s_bkpinfo *bkpinfo, 288 char *ramdisk_fname, 290 extract_config_file_from_ramdisk(char *ramdisk_fname, 289 291 char *output_cfg_file, 290 292 char *output_mountlist_file) … … 354 356 /** 355 357 * Keep trying to get mondo-restore.cfg from the archive, until the user gives up. 356 * @param bkpinfo The backup information structure.357 358 */ 358 void get_cfg_file_from_archive_or_bust( struct s_bkpinfo *bkpinfo)359 { 360 while (get_cfg_file_from_archive( bkpinfo)) {359 void get_cfg_file_from_archive_or_bust() 360 { 361 while (get_cfg_file_from_archive()) { 361 362 if (!ask_me_yes_or_no 362 363 ("Failed to find config file/archives. Choose another source?")) … … 364 365 fatal_error("Could not find config file/archives. Aborting."); 365 366 } 366 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);367 interactively_obtain_media_parameters_from_user(FALSE); 367 368 } 368 369 } … … 432 433 * @return 0 for success, nonzero for failure. 433 434 */ 434 int iso_fiddly_bits( struct s_bkpinfo *bkpinfo,bool nuke_me_please)435 int iso_fiddly_bits(bool nuke_me_please) 435 436 { 436 437 char *mount_isodir_command, *tmp, *command; … … 488 489 } 489 490 if (!IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 490 mount_cdrom( bkpinfo);491 } 492 i = what_number_cd_is_this( bkpinfo); /* has the side-effect of calling mount_cdrom() */491 mount_cdrom(); 492 } 493 i = what_number_cd_is_this(); /* has the side-effect of calling mount_cdrom() */ 493 494 sprintf(tmp, "%s #%d has been mounted via loopback mount", 494 495 media_descriptor_string(bkpinfo->backup_media_type), i); … … 637 638 * @return 0 for success, nonzero for failure. 638 639 */ 639 int mount_cdrom( struct s_bkpinfo *bkpinfo)640 int mount_cdrom() 640 641 { 641 642 char *mount_cmd; … … 906 907 * @return 0 for success, nonzero for failure. 907 908 */ 908 int read_cfg_file_into_bkpinfo(char *cfgf , struct s_bkpinfo *bkpinfo)909 int read_cfg_file_into_bkpinfo(char *cfgf) 909 910 { 910 911 /** add mallocs **/ … … 1188 1189 strcpy(bkpinfo->media_device, "/dev/cdrom"); /* superfluous */ 1189 1190 bkpinfo->isodir[0] = iso_mnt[0] = iso_path[0] = '\0'; 1190 if (mount_cdrom( bkpinfo)) {1191 if (mount_cdrom()) { 1191 1192 fatal_error 1192 1193 ("Unable to mount isodir. Failed to mount CD-ROM as well."); … … 1209 1210 log_msg(2, 1210 1211 "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)"); 1211 interactively_obtain_media_parameters_from_user(bkpinfo, 1212 FALSE); 1212 interactively_obtain_media_parameters_from_user(FALSE); 1213 1213 media_specified_by_user = bkpinfo->backup_media_type; 1214 get_cfg_file_from_archive( bkpinfo);1214 get_cfg_file_from_archive(); 1215 1215 /* 1216 1216 if (media_specified_by_user != cdr && media_specified_by_user == cdrw) … … 1250 1250 */ 1251 1251 struct 1252 s_node *process_filelist_and_biggielist( struct s_bkpinfo *bkpinfo)1252 s_node *process_filelist_and_biggielist() 1253 1253 { 1254 1254 struct s_node *filelist; … … 1293 1293 "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", 1294 1294 bkpinfo->isodir); 1295 insist_on_this_cd_number( bkpinfo,1);1295 insist_on_this_cd_number(1); 1296 1296 log_msg(2, "Back from iotcn"); 1297 1297 run_program_and_log_output("mount", 1); … … 1989 1989 * - @c bkpinfo->disaster_recovery 1990 1990 */ 1991 void setup_MR_global_filenames( struct s_bkpinfo *bkpinfo)1991 void setup_MR_global_filenames() 1992 1992 { 1993 1993 char *temppath; … … 2292 2292 * @return 0 for success, nonzero for failure. 2293 2293 */ 2294 int get_cfg_file_from_archive( struct s_bkpinfo *bkpinfo)2294 int get_cfg_file_from_archive() 2295 2295 { 2296 2296 int retval = 0; … … 2379 2379 "Cannot find ramdisk file on mountpoint. Are you sure that's a boot disk in the drive?"); 2380 2380 } 2381 if (extract_config_file_from_ramdisk 2382 (bkpinfo, ramdisk_fname, cfg_file, mountlist_file)) { 2381 if (extract_config_file_from_ramdisk(ramdisk_fname, cfg_file, mountlist_file)) { 2383 2382 log_msg(2, 2384 2383 "Warning - failed to extract config file from ramdisk. I think this boot disk is mangled."); … … 2394 2393 } else { 2395 2394 log_msg(2, "gcffa --- calling mount_cdrom now :)"); 2396 if (!mount_cdrom( bkpinfo)) {2395 if (!mount_cdrom()) { 2397 2396 log_msg(2, 2398 2397 "gcffa --- managed to mount CD; so, no need for Plan B"); … … 2401 2400 try_plan_B = TRUE; 2402 2401 } 2403 if (what_number_cd_is_this(bkpinfo) > 1) { 2404 insist_on_this_cd_number(bkpinfo, 2405 (g_current_media_number = 1)); 2402 if (what_number_cd_is_this() > 1) { 2403 insist_on_this_cd_number((g_current_media_number = 1)); 2406 2404 } 2407 2405 }
Note:
See TracChangeset
for help on using the changeset viewer.