Changeset 1645


Ignore:
Timestamp:
Sep 24, 2007, 3:04:43 AM (12 years ago)
Author:
bruno
Message:

Render bkpinfo global (potential issue on thread, but should not be a problem as that structure is indeed static during archive)
Should solve the tmpdir issue from previous rev.
May still not compile

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  
    239239extern char *MONDO_LOGFILE;
    240240
     241/* Reference to global bkpinfo */
     242extern struct s_bkpinfo *bkpinfo;
     243
    241244
    242245
     
    357360
    358361int
    359 archive_this_fileset_with_star(struct s_bkpinfo *bkpinfo, char *filelist,
    360                                char *fname, int setno)
     362archive_this_fileset_with_star(char *filelist, char *fname, int setno)
    361363{
    362364    int retval = 0;
     
    452454 */
    453455int
    454 archive_this_fileset(struct s_bkpinfo *bkpinfo, char *filelist,
    455                      char *fname, int setno)
     456archive_this_fileset(char *filelist, char *fname, int setno)
    456457{
    457458
     
    473474
    474475    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));
    477477    }
    478478
     
    587587 * @ingroup archiveGroup
    588588 */
    589 int backup_data(struct s_bkpinfo *bkpinfo)
     589int backup_data()
    590590{
    591591    int retval = 0, res = 0;
     
    593593
    594594    assert(bkpinfo != NULL);
    595     set_g_cdrom_and_g_dvd_to_bkpinfo_value(bkpinfo);
     595    set_g_cdrom_and_g_dvd_to_bkpinfo_value();
    596596    malloc_string(tmp);
    597597    if (bkpinfo->backup_media_type == dvd) {
     
    608608    }
    609609
    610     if ((res = prepare_filelist(bkpinfo))) {    /* generate scratchdir/filelist.full */
     610    if ((res = prepare_filelist())) {   /* generate scratchdir/filelist.full */
    611611        fatal_error("Failed to generate filelist catalog");
    612612    }
    613     if (call_filelist_chopper(bkpinfo)) {
     613    if (call_filelist_chopper()) {
    614614        fatal_error("Failed to run filelist chopper");
    615615    }
     
    630630    }
    631631
    632     copy_mondo_and_mindi_stuff_to_scratchdir(bkpinfo);  // payload, too, if it exists
     632    copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists
    633633#if __FreeBSD__ == 5
    634634    strcpy(bkpinfo->kernel_path, "/boot/kernel/kernel");
     
    644644#error "I don't know about this system!"
    645645#endif
    646     if ((res = call_mindi_to_supply_boot_disks(bkpinfo))) {
     646    if ((res = call_mindi_to_supply_boot_disks())) {
    647647        fatal_error("Failed to generate boot+data disks");
    648648    }
    649     retval += do_that_initial_phase(bkpinfo);   // prepare
     649    retval += do_that_initial_phase();  // prepare
    650650    sprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
    651651    run_program_and_log_output(tmp, 1);
    652     retval += make_those_afios_phase(bkpinfo);  // backup regular files
    653     retval += make_those_slices_phase(bkpinfo); // backup BIG files
    654     retval += do_that_final_phase(bkpinfo); // clean up
     652    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
    655655    log_msg(1, "Creation of archives... complete.");
    656656    if (bkpinfo->verify_data) {
     
    690690 * @ingroup MLarchiveGroup
    691691 */
    692 int call_mindi_to_supply_boot_disks(struct s_bkpinfo *bkpinfo)
     692int call_mindi_to_supply_boot_disks()
    693693{
    694694    /*@ buffer ************************************************************ */
     
    11621162    char *curr_acl_list_fname;
    11631163
    1164     struct s_bkpinfo *bkpinfo;
     1164    struct s_bkpinfo *bkpinfo_bis;
    11651165    char *tmp;
    11661166    int res = 0, retval = 0;
     
    11801180    p_next_set_to_archive = (int *) (inbuf + 8);
    11811181    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);
    11831183
    11841184    sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
     
    12461246                this_thread_no, archiving_set_no);
    12471247        res =
    1248             archive_this_fileset(bkpinfo, archiving_filelist_fname,
     1248            archive_this_fileset(archiving_filelist_fname,
    12491249                                 archiving_afioball_fname,
    12501250                                 archiving_set_no);
     
    13041304 * @ingroup MLarchiveGroup
    13051305 */
    1306 int do_that_final_phase(struct s_bkpinfo *bkpinfo)
     1306int do_that_final_phase()
    13071307{
    13081308
     
    13211321        /* write tape/cdstream */
    13221322    {
    1323         closeout_tape(bkpinfo);
     1323        closeout_tape();
    13241324    } else
    13251325        /* write final ISO */
    13261326    {
    1327         res = write_final_iso_if_necessary(bkpinfo);
     1327        res = write_final_iso_if_necessary();
    13281328        retval += res;
    13291329        if (res) {
     
    13651365 * @ingroup MLarchiveGroup
    13661366 */
    1367 int do_that_initial_phase(struct s_bkpinfo *bkpinfo)
     1367int do_that_initial_phase()
    13681368{
    13691369    /*@ int *************************************** */
     
    16131613 * @return The number of errors encountered (0 for success)
    16141614 */
    1615 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo)
     1615int make_afioballs_and_images()
    16161616{
    16171617
     
    16731673                       "Please wait. This may take a couple of hours.",
    16741674                       "Working...",
    1675                        get_last_filelist_number(bkpinfo) + 1);
     1675                       get_last_filelist_number() + 1);
    16761676
    16771677    log_msg(5, "We're gonna party like it's your birthday.");
     
    17421742                sleep(5);
    17431743            }
    1744             strcpy(media_usage_comment,
    1745                    percent_media_full_comment(bkpinfo));
     1744            strcpy(media_usage_comment, percent_media_full_comment());
    17461745            /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    17471746            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     
    17521751                iamhere("Writing EXAT files");
    17531752                res +=
    1754                     write_EXAT_files_to_tape(bkpinfo,
    1755                                              curr_xattr_list_fname,
     1753                    write_EXAT_files_to_tape(curr_xattr_list_fname,
    17561754                                             curr_acl_list_fname);
    17571755// archives themselves
    17581756                res +=
    1759                     move_files_to_stream(bkpinfo, storing_afioball_fname,
     1757                    move_files_to_stream(storing_afioball_fname,
    17601758                                         NULL);
    17611759            } else {
    17621760                if (g_getfacl) {
    17631761                    if (g_getfattr) {
    1764                         res = move_files_to_cd(bkpinfo, storing_filelist_fname,
     1762                        res = move_files_to_cd(storing_filelist_fname,
    17651763                                     curr_xattr_list_fname,
    17661764                                     curr_acl_list_fname,
    17671765                                     storing_afioball_fname, NULL);
    17681766                    } else {
    1769                         res = move_files_to_cd(bkpinfo, storing_filelist_fname,
     1767                        res = move_files_to_cd(storing_filelist_fname,
    17701768                                    curr_acl_list_fname,
    17711769                                    storing_afioball_fname, NULL);
     
    17731771                } else {
    17741772                    if (g_getfattr) {
    1775                             res = move_files_to_cd(bkpinfo, storing_filelist_fname,
     1773                            res = move_files_to_cd(storing_filelist_fname,
    17761774                                    curr_xattr_list_fname,
    17771775                                    storing_afioball_fname, NULL);
    17781776                    } else {
    1779                             res = move_files_to_cd(bkpinfo, storing_filelist_fname,
     1777                            res = move_files_to_cd(storing_filelist_fname,
    17801778                                    storing_afioball_fname, NULL);
    17811779                    }
     
    18551853 * @return The number of errors encountered (0 for success)
    18561854 */
    1857 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile)
     1855int make_iso_fs(char *destfile)
    18581856{
    18591857    /*@ int ********************************************** */
     
    19321930                g_current_media_number);
    19331931        res =
    1934             eval_call_to_make_ISO(bkpinfo, bkpinfo->call_before_iso,
     1932            eval_call_to_make_ISO(bkpinfo->call_before_iso,
    19351933                                  destfile, g_current_media_number,
    19361934                                  MONDO_LOGFILE, message_to_screen);
     
    19571955        } else {
    19581956            res =
    1959                 eval_call_to_make_ISO(bkpinfo, bkpinfo->call_make_iso,
     1957                eval_call_to_make_ISO(bkpinfo->call_make_iso,
    19601958                                      bkpinfo->scratchdir,
    19611959                                      g_current_media_number,
     
    20202018                pause_for_N_seconds(5, "Letting DVD drive settle");
    20212019                res =
    2022                     eval_call_to_make_ISO(bkpinfo, bkpinfo->call_make_iso,
     2020                    eval_call_to_make_ISO(bkpinfo->call_make_iso,
    20232021                                          bkpinfo->scratchdir,
    20242022                                          g_current_media_number,
     
    20542052// FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end
    20552053            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#_ .",
    20582055                                      destfile, g_current_media_number,
    20592056                                      MONDO_LOGFILE, message_to_screen);
     
    20742071#ifdef __IA64__
    20752072                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."
    20792074                                            IA64_BOOT_SIZE
    20802075                                            ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
     
    20882083                log_msg(1, "Non-ia64 --> lilo");
    20892084                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#_ .",
    20922086                                          destfile, g_current_media_number,
    20932087                                          MONDO_LOGFILE,
     
    20982092                log_msg(1, "Isolinux");
    20992093                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#_ .",
    21022095                                          destfile, g_current_media_number,
    21032096                                          MONDO_LOGFILE,
     
    21322125        pause_and_ask_for_cdr(2, &cd_is_mountable);
    21332126        res =
    2134             eval_call_to_make_ISO(bkpinfo, bkpinfo->call_burn_iso,
     2127            eval_call_to_make_ISO(bkpinfo->call_burn_iso,
    21352128                                  destfile, g_current_media_number,
    21362129                                  MONDO_LOGFILE, message_to_screen);
     
    21492142                g_current_media_number);
    21502143        res =
    2151             eval_call_to_make_ISO(bkpinfo, bkpinfo->call_after_iso,
     2144            eval_call_to_make_ISO(bkpinfo->call_after_iso,
    21522145                                  destfile, g_current_media_number,
    21532146                                  MONDO_LOGFILE, message_to_screen);
     
    22192212 */
    22202213int
    2221 make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname)
     2214make_slices_and_images(char *biggielist_fname)
    22222215{
    22232216
     
    22522245    malloc_string(sz_devfile);
    22532246    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;
    22552248
    22562249    log_msg(1, "size of all biggiefiles = %ld",
    2257             size_of_all_biggiefiles_K(bkpinfo));
     2250            size_of_all_biggiefiles_K());
    22582251    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,
    22602253            estimated_total_noof_slices);
    22612254
     
    23432336            }
    23442337            res =
    2345                 slice_up_file_etc(bkpinfo, bigfile_fname,
     2338                slice_up_file_etc(bigfile_fname,
    23462339                                  ntfsprog_fifo, biggie_file_number,
    23472340                                  noof_biggie_files, use_ntfsprog);
     
    23952388 * @see make_afioballs_and_images
    23962389 */
    2397 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo)
     2390int make_afioballs_and_images_OLD()
    23982391{
    23992392
     
    24272420                       "Please wait. This may take a couple of hours.",
    24282421                       "Working...",
    2429                        get_last_filelist_number(bkpinfo) + 1);
     2422                       get_last_filelist_number() + 1);
    24302423
    24312424    sprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir,
     
    24552448        log_msg(1, "Archiving set %ld", curr_set_no);
    24562449        res =
    2457             archive_this_fileset(bkpinfo, curr_filelist_fname,
     2450            archive_this_fileset(curr_filelist_fname,
    24582451                                 curr_afioball_fname, curr_set_no);
    24592452        retval += res;
     
    24652458        }
    24662459
    2467         strcpy(media_usage_comment, percent_media_full_comment(bkpinfo));
     2460        strcpy(media_usage_comment, percent_media_full_comment());
    24682461
    24692462        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
     
    24752468            iamhere("Writing EXAT files");
    24762469            res +=
    2477                 write_EXAT_files_to_tape(bkpinfo, curr_xattr_list_fname,
     2470                write_EXAT_files_to_tape(curr_xattr_list_fname,
    24782471                                         curr_acl_list_fname);
    24792472// archives themselves
    2480             res = move_files_to_stream(bkpinfo, curr_afioball_fname, NULL);
     2473            res = move_files_to_stream(curr_afioball_fname, NULL);
    24812474        } else {
    24822475                if (g_getfacl) {
    24832476                    if (g_getfattr) {
    2484                         res = move_files_to_cd(bkpinfo, curr_filelist_fname,
     2477                        res = move_files_to_cd(curr_filelist_fname,
    24852478                                     curr_xattr_list_fname,
    24862479                                     curr_acl_list_fname,
    24872480                                     curr_afioball_fname, NULL);
    24882481                    } else {
    2489                         res = move_files_to_cd(bkpinfo, curr_filelist_fname,
     2482                        res = move_files_to_cd(curr_filelist_fname,
    24902483                                    curr_acl_list_fname,
    24912484                                    curr_afioball_fname, NULL);
     
    24932486                } else {
    24942487                    if (g_getfattr) {
    2495                             res = move_files_to_cd(bkpinfo, curr_filelist_fname,
     2488                            res = move_files_to_cd(curr_filelist_fname,
    24962489                                    curr_xattr_list_fname,
    24972490                                    curr_afioball_fname, NULL);
    24982491                    } else {
    2499                             res = move_files_to_cd(bkpinfo, curr_filelist_fname,
     2492                            res = move_files_to_cd(curr_filelist_fname,
    25002493                                    curr_afioball_fname, NULL);
    25012494                    }
     
    25422535 * @ingroup MLarchiveGroup
    25432536 */
    2544 int make_those_afios_phase(struct s_bkpinfo *bkpinfo)
     2537int make_those_afios_phase()
    25452538{
    25462539    /*@ int ******************************************* */
     
    25592552        log_msg(1,
    25602553                "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();
    25622555#else
    2563         res = make_afioballs_and_images_OLD(bkpinfo);
     2556        res = make_afioballs_and_images_OLD();
    25642557#endif
    25652558        write_header_block_to_stream((off_t)0, "stop-afioballs",
    25662559                                     BLK_STOP_AFIOBALLS);
    25672560    } else {
    2568         res = make_afioballs_and_images(bkpinfo);
     2561        res = make_afioballs_and_images();
    25692562    }
    25702563
     
    25882581 * @ingroup MLarchiveGroup
    25892582 */
    2590 int make_those_slices_phase(struct s_bkpinfo *bkpinfo)
     2583int make_those_slices_phase()
    25912584{
    25922585
     
    26462639
    26472640    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);
    26492642        asprintf(&blah, "%ld", count_lines_in_file(biggielist));
    26502643        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    26512644        paranoid_free(blah);
    26522645    }
    2653     res = make_slices_and_images(bkpinfo, biggielist);
     2646    res = make_slices_and_images(biggielist);
    26542647    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    26552648        write_header_block_to_stream((off_t)0, "end-of-biggiefiles",
     
    26812674 * transfer files over the network) or leave it as is.
    26822675 */
    2683 int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) =
     2676int (*move_files_to_cd) (char *, ...) =
    26842677    _move_files_to_cd;
    26852678
     
    27022695 * @return The number of errors encountered (0 for success)
    27032696 */
    2704 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)
     2697int _move_files_to_cd(char *files_to_add, ...)
    27052698{
    27062699
     
    27412734    }
    27422735    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 */
    27442737        retval += res;
    27452738        if (res) {
     
    27982791 * @ingroup MLarchiveGroup
    27992792 */
    2800 int offer_to_write_floppies(struct s_bkpinfo *bkpinfo, char *imagesdir)
     2793int offer_to_write_floppies(char *imagesdir)
    28012794{
    28022795    /*@ buffer ************************************************************ */
     
    29582951 */
    29592952
    2960 int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo
    2961                                                    *bkpinfo)
     2953int offer_to_write_boot_floppies_to_physical_disks()
    29622954{
    29632955    int res = 0;
     
    29822974            }
    29832975        } else {
    2984             offer_to_write_floppies(bkpinfo, MINDI_CACHE);
     2976            offer_to_write_floppies(MINDI_CACHE);
    29852977            mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    29862978        }
     
    30052997 * transfer files over the network) or leave it as is.
    30062998 */
    3007 int (*move_files_to_stream) (struct s_bkpinfo *, char *, ...) =
     2999int (*move_files_to_stream) (char *, ...) =
    30083000    _move_files_to_stream;
    30093001
     
    30223014 */
    30233015int
    3024 _move_files_to_stream(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)
     3016_move_files_to_stream(char *files_to_add, ...)
    30253017{
    30263018
     
    30663058            type = other;
    30673059        }
    3068         res = write_file_to_stream_from_file(bkpinfo, curr_file);
     3060        res = write_file_to_stream_from_file(curr_file);
    30693061        retval += res;
    30703062        unlink(curr_file);
     
    33813373 */
    33823374int
    3383 slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
     3375slice_up_file_etc(char *biggie_filename,
    33843376                  char *ntfsprog_fifo, long biggie_file_number,
    33853377                  long noof_biggie_files, bool use_ntfsprog)
     
    35173509    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    35183510        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,
    35213512                                             bkpinfo->tmpdir, ""), NULL);
    35223513    } else {
    35233514        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,
    35263516                                         bkpinfo->tmpdir, ""), NULL);
    35273517    }
     
    35353525                           suffix));
    35363526
    3537         strcpy(tmp, percent_media_full_comment(bkpinfo));
     3527        strcpy(tmp, percent_media_full_comment());
    35383528        update_progress_form(tmp);
    35393529        if (!(fout = fopen(curr_slice_fname_uncompressed, "w"))) {
     
    36223612            maintain_collection_of_recent_archives(bkpinfo->tmpdir,
    36233613                                                   file_to_archive);
    3624             res = move_files_to_stream(bkpinfo, file_to_archive, NULL);
     3614            res = move_files_to_stream(file_to_archive, NULL);
    36253615        } else {
    3626             res = move_files_to_cd(bkpinfo, file_to_archive, NULL);
     3616            res = move_files_to_cd(file_to_archive, NULL);
    36273617        }
    36283618        retval += res;
     
    37163706 * however, this occurs rarely.
    37173707 */
    3718 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo)
     3708int write_final_iso_if_necessary()
    37193709{
    37203710    /*@ int ***************************************************** */
     
    37373727    }
    37383728#endif
    3739     res = write_iso_and_go_on(bkpinfo, TRUE);
     3729    res = write_iso_and_go_on(TRUE);
    37403730#ifndef _XWIN
    37413731    if (!g_text_mode) {
     
    37663756 * @see make_iso_fs
    37673757 */
    3768 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd)
     3758int write_iso_and_go_on(bool last_cd)
    37693759{
    37703760    /*@ pointers **************************************************** */
     
    38423832            g_current_media_number);
    38433833    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    3844         res = make_iso_fs(bkpinfo, isofile);
     3834        res = make_iso_fs(isofile);
    38453835        if (g_current_media_number == 1 && !res
    38463836            && (bkpinfo->backup_media_type == cdr
     
    38613851            chdir("/");
    38623852            iamhere("Before calling verify_cd_image()");
    3863             res += verify_cd_image(bkpinfo);
     3853            res += verify_cd_image();
    38643854            iamhere("After calling verify_cd_image()");
    38653855        }
     
    39343924 * @ingroup verifyGroup
    39353925 */
    3936 int verify_data(struct s_bkpinfo *bkpinfo)
     3926int verify_data()
    39373927{
    39383928    int res = 0, retval = 0, cdno = 0;
     
    39493939            strcpy(bkpinfo->media_device, "/dev/cdrom");
    39503940        }
    3951         verify_tape_backups(bkpinfo);
     3941        verify_tape_backups();
    39523942        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    39533943    } else if (bkpinfo->backup_data)
     
    39723962            }
    39733963            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 verifying
     3964                insist_on_this_cd_number(cdno);
     3965            }
     3966            res = verify_cd_image();    // sets verify_data to FALSE if it's time to stop verifying
    39773967            retval += res;
    39783968            if (res) {
    39793969                sprintf(tmp,
    39803970                        "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),
    39833972                        g_current_media_number);
    39843973                log_to_screen(tmp);
  • branches/2.2.5/mondo/src/common/libmondo-devices.c

    r1644 r1645  
    276276extern t_bkptype g_backup_media_type;   // set by main()
    277277
    278 
    279 
    280 
    281 void set_g_cdrom_and_g_dvd_to_bkpinfo_value(struct s_bkpinfo *bkpinfo)
     278/* Reference to global bkpinfo */
     279extern struct s_bkpinfo *bkpinfo;
     280
     281
     282
     283
     284void set_g_cdrom_and_g_dvd_to_bkpinfo_value()
    282285{
    283286    strcpy(g_cdrom_drive_is_here, bkpinfo->media_device);   // just in case
     
    664667 * @see mount_CDROM_here
    665668 */
    666 int find_and_mount_actual_cd(struct s_bkpinfo *bkpinfo, char *mountpoint)
     669int find_and_mount_actual_cd(char *mountpoint)
    667670{
    668671    /*@ buffers ***************************************************** */
     
    16981701 */
    16991702void
    1700 insist_on_this_cd_number(struct s_bkpinfo *bkpinfo, int cd_number_i_want)
     1703insist_on_this_cd_number(int cd_number_i_want)
    17011704{
    17021705
     
    17551758//    return;
    17561759    }
    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) {
    17581761        log_msg(3, "Currently, we hold %d but we want %d", res,
    17591762                cd_number_i_want);
     
    17651768                cd_number_i_want);
    17661769        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) {
    17681771            paranoid_system("sync");
    17691772            if (is_this_device_mounted(MNT_CDROM)) {
     
    18131816 * @ingroup archiveGroup
    18141817 */
    1815 int interactively_obtain_media_parameters_from_user(struct s_bkpinfo
    1816                                                     *bkpinfo,
    1817                                                     bool
    1818                                                     archiving_to_media)
     1818int interactively_obtain_media_parameters_from_user(bool archiving_to_media)
    18191819// archiving_to_media is TRUE if I'm being called by mondoarchive
    18201820// archiving_to_media is FALSE if I'm being called by mondorestore
     
    18521852            bkptype_to_string(bkpinfo->backup_media_type));
    18531853    if (archiving_to_media) {
    1854         sensibly_set_tmpdir_and_scratchdir(bkpinfo);
     1854        sensibly_set_tmpdir_and_scratchdir();
    18551855    }
    18561856    bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4;
     
    19321932                sprintf(comment,
    19331933                        "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));
    19361935                if (!popup_and_get_string
    19371936                    ("Device?", comment, bkpinfo->media_device,
     
    19511950                sprintf(tmp,
    19521951                        "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),
    19551953                        bkpinfo->media_device);
    19561954                if (!ask_me_yes_or_no(tmp)) {
     
    25072505 * @ingroup utilityGroup
    25082506 */
    2509 void sensibly_set_tmpdir_and_scratchdir(struct s_bkpinfo *bkpinfo)
     2507void sensibly_set_tmpdir_and_scratchdir()
    25102508{
    25112509    char *tmp, *command, *sz;
     
    26092607 * (and remain mounted after this function returns).
    26102608 */
    2611 int what_number_cd_is_this(struct s_bkpinfo *bkpinfo)
     2609int what_number_cd_is_this()
    26122610{
    26132611    int cd_number = -1;
  • branches/2.2.5/mondo/src/common/libmondo-fifo.c

    r1316 r1645  
    280280
    281281int
    282 extract_config_file_from_ramdisk(struct s_bkpinfo *bkpinfo,
    283                                  char *ramdisk_fname,
     282extract_config_file_from_ramdisk(char *ramdisk_fname,
    284283                                 char *output_cfg_file,
    285284                                 char *output_mountlist_file);
  • branches/2.2.5/mondo/src/common/libmondo-filelist.c

    r1644 r1645  
    138138extern char *MONDO_LOGFILE;
    139139
     140/* Reference to global bkpinfo */
     141extern struct s_bkpinfo *bkpinfo;
     142
    140143
    141144int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir,
     
    183186 * @see chop_filelist
    184187 */
    185 int call_filelist_chopper(struct s_bkpinfo *bkpinfo)
     188int call_filelist_chopper()
    186189{
    187190    /*@ buffers *********************** */
     
    219222        chop_filelist(filelist, bkpinfo->tmpdir,
    220223                      bkpinfo->optimal_set_size);
    221     estimate_noof_media_required(bkpinfo, noof_sets);   // for cosmetic purposes
     224    estimate_noof_media_required(noof_sets);    // for cosmetic purposes
    222225
    223226    sprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
     
    822825 * @note This function should only be called at restore-time.
    823826 */
    824 int get_last_filelist_number(struct s_bkpinfo *bkpinfo)
     827int get_last_filelist_number()
    825828{
    826829    /*@ buffers ***************************************************** */
     
    14021405 * @see mondo_makefilelist
    14031406 */
    1404 int prepare_filelist(struct s_bkpinfo *bkpinfo)
     1407int prepare_filelist()
    14051408{
    14061409
  • branches/2.2.5/mondo/src/common/libmondo-files.c

    r1505 r1645  
    103103extern int g_currentY;
    104104extern char *g_mondo_home;
     105
     106/* Reference to global bkpinfo */
     107extern struct s_bkpinfo *bkpinfo;
    105108
    106109/**
     
    871874 * @return The total size of all biggiefiles in KB.
    872875 */
    873 long size_of_all_biggiefiles_K(struct s_bkpinfo *bkpinfo)
     876long size_of_all_biggiefiles_K()
    874877{
    875878    /*@ buffers ***************************************************** */
     
    11371140 * - @c bkpinfo->tmpdir
    11381141 */
    1139 void copy_mondo_and_mindi_stuff_to_scratchdir(struct s_bkpinfo *bkpinfo)
     1142void copy_mondo_and_mindi_stuff_to_scratchdir()
    11401143{
    11411144    /*@ Char buffers ** */
     
    12171220 * - @c tmpdir
    12181221 */
    1219 void store_nfs_config(struct s_bkpinfo *bkpinfo)
     1222void store_nfs_config()
    12201223{
    12211224
     
    13381341 */
    13391342void
    1340 estimate_noof_media_required(struct s_bkpinfo *bkpinfo, long noof_sets)
     1343estimate_noof_media_required(long noof_sets)
    13411344{
    13421345    /*@ buffers *************** */
     
    13541357    scratchLL =
    13551358        (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());
    13571360    scratchLL = (scratchLL / 1024) / bkpinfo->media_size[1];
    13581361    scratchLL++;
  • branches/2.2.5/mondo/src/common/libmondo-fork.c

    r1644 r1645  
    118118extern bool g_text_mode;
    119119extern char *MONDO_LOGFILE;
     120
     121/* Reference to global bkpinfo */
     122extern struct s_bkpinfo *bkpinfo;
    120123pid_t g_buffer_pid = 0;
    121124
     
    185188 */
    186189int
    187 eval_call_to_make_ISO(struct s_bkpinfo *bkpinfo,
    188                       char *basic_call, char *isofile,
     190eval_call_to_make_ISO(char *basic_call, char *isofile,
    189191                      int cd_no, char *logstub, char *what_i_am_doing)
    190192{
  • branches/2.2.5/mondo/src/common/libmondo-mountlist.c

    r1439 r1645  
    6868 */
    6969struct s_bkpinfo *g_bkpinfo_DONTUSETHIS = NULL;
     70
     71/* Reference to global bkpinfo */
     72extern struct s_bkpinfo *bkpinfo;
    7073
    7174/**
  • branches/2.2.5/mondo/src/common/libmondo-stream.c

    r1316 r1645  
    120120extern char *MONDO_LOGFILE;
    121121
     122/* Reference to global bkpinfo */
     123extern struct s_bkpinfo *bkpinfo;
     124
    122125/**
    123126 * @addtogroup globalGroup
     
    150153/* @} - end of globalGroup */
    151154
    152 int write_backcatalog_to_tape(struct s_bkpinfo *bkpinfo);
     155int write_backcatalog_to_tape();
    153156
    154157
     
    167170 * @note This should be called by restore processes only.
    168171 */
    169 int closein_cdstream(struct s_bkpinfo *bkpinfo)
    170 {
    171     return (closein_tape(bkpinfo));
     172int closein_cdstream()
     173{
     174    return (closein_tape());
    172175}
    173176
     
    182185 * @bug @p bkpinfo parameter is unused.
    183186 */
    184 int closein_tape(struct s_bkpinfo *bkpinfo)
     187int closein_tape()
    185188{
    186189    /*@ int's ******************************************************* */
     
    241244 * @note This should be called by backup processes only.
    242245 */
    243 int closeout_tape(struct s_bkpinfo *bkpinfo)
     246int closeout_tape()
    244247{
    245248    /*@ int's ******************************************************* */
     
    274277        if (should_we_write_to_next_tape
    275278            (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();
    277280        }
    278281    }
     
    288291        if (should_we_write_to_next_tape (bkpinfo->media_size[g_current_media_number], 256*1024))
    289292          {
    290             start_to_write_to_next_tape (bkpinfo);
     293            start_to_write_to_next_tape ();
    291294          }
    292295      }
     
    438441
    439442
    440 int read_EXAT_files_from_tape(struct s_bkpinfo *bkpinfo,
    441                               long long *ptmp_size, char *tmp_fname,
     443int read_EXAT_files_from_tape(long long *ptmp_size, char *tmp_fname,
    442444                              int *pctrl_chr, char *xattr_fname,
    443445                              char *acl_fname)
     
    456458            fatal_error("Wrong order, sunshine.");
    457459        }
    458         read_file_from_stream_to_file(bkpinfo, xattr_fname, *ptmp_size);
     460        read_file_from_stream_to_file(xattr_fname, *ptmp_size);
    459461        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    460462        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     
    472474            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    473475        }
    474         read_file_from_stream_to_file(bkpinfo, acl_fname, *ptmp_size);
     476        read_file_from_stream_to_file(acl_fname, *ptmp_size);
    475477        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    476478        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     
    490492
    491493
    492 int write_EXAT_files_to_tape(struct s_bkpinfo *bkpinfo, char *xattr_fname,
     494int write_EXAT_files_to_tape(char *xattr_fname,
    493495                             char *acl_fname)
    494496{
     
    500502        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    501503                             BLK_START_EXAT_FILE);
    502         write_file_to_stream_from_file(bkpinfo, xattr_fname);
     504        write_file_to_stream_from_file(xattr_fname);
    503505        write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
    504506    }
     
    507509        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    508510                             BLK_START_EXAT_FILE);
    509         write_file_to_stream_from_file(bkpinfo, acl_fname);
     511        write_file_to_stream_from_file(acl_fname);
    510512        write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    511513        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     
    655657 * @note Equivalent to openin_tape() for now, but don't count on this behavior.
    656658 */
    657 int openin_cdstream(struct s_bkpinfo *bkpinfo)
    658 {
    659     return (openin_tape(bkpinfo));
     659int openin_cdstream()
     660{
     661    return (openin_tape());
    660662}
    661663
     
    696698 * @note This will also work with a cdstream for now, but don't count on this behavior.
    697699 */
    698 int openin_tape(struct s_bkpinfo *bkpinfo)
     700int openin_tape()
    699701{
    700702    /*@ buffer ***************************************************** */
     
    886888 */
    887889int
    888 read_file_from_stream_to_file(struct s_bkpinfo *bkpinfo, char *outfile,
    889                               long long size)
     890read_file_from_stream_to_file(char *outfile, long long size)
    890891{
    891892
     
    895896    /*@ end vars *************************************************** */
    896897
    897     res = read_file_from_stream_FULL(bkpinfo, outfile, NULL, size);
     898    res = read_file_from_stream_FULL(outfile, NULL, size);
    898899
    899900    return (res);
     
    911912 */
    912913int
    913 read_file_from_stream_to_stream(struct s_bkpinfo *bkpinfo, FILE * fout,
    914                                 long long size)
     914read_file_from_stream_to_stream(FILE * fout, long long size)
    915915{
    916916
     
    920920    /*@ end vars *************************************************** */
    921921
    922     res = read_file_from_stream_FULL(bkpinfo, NULL, fout, size);
     922    res = read_file_from_stream_FULL(NULL, fout, size);
    923923/*  fflush(g_tape_stream);
    924924  fflush(fout);*/
     
    941941 */
    942942int
    943 read_file_from_stream_FULL(struct s_bkpinfo *bkpinfo, char *outfname,
    944                            FILE * foutstream, long long orig_size)
     943read_file_from_stream_FULL(char *outfname, FILE * foutstream, long long orig_size)
    945944{
    946945    /*@ buffers ***************************************************** */
     
    10291028            log_msg(4, "where_I_was_... = %lld",
    10301029                    where_I_was_before_tape_change);
    1031             start_to_read_from_next_tape(bkpinfo);
     1030            start_to_read_from_next_tape();
    10321031            log_msg(4, "Started reading from next tape.");
    10331032            skip_incoming_files_until_we_find_this_one(temp_fname);
     
    13621361 * @return 0 for success, nonzero for failure.
    13631362 */
    1364 int start_to_read_from_next_tape(struct s_bkpinfo *bkpinfo)
     1363int start_to_read_from_next_tape()
    13651364{
    13661365    /*@ int ********************************************************* */
     
    14101409 * @return 0 for success, nonzero for failure.
    14111410 */
    1412 int start_to_write_to_next_tape(struct s_bkpinfo *bkpinfo)
     1411int start_to_write_to_next_tape()
    14131412{
    14141413    int res = 0;
     
    14701469 * @return 0 for success, nonzero for failure.
    14711470 */
    1472 int write_backcatalog_to_tape(struct s_bkpinfo *bkpinfo)
     1471int write_backcatalog_to_tape()
    14731472{
    14741473    int i, last, res = 0;
     
    14881487                                         BLK_START_AN_AFIO_OR_SLICE);
    14891488            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)) {
    14911490                res++;
    14921491                log_msg(2, "%s failed", fname);
     
    15741573 * @return 0 for success, nonzero for failure.
    15751574 */
    1576 int write_file_to_stream_from_file(struct s_bkpinfo *bkpinfo, char *infile)
     1575int write_file_to_stream_from_file(char *infile)
    15771576{
    15781577    /*@ buffers **************************************************** */
     
    16211620    if (should_we_write_to_next_tape
    16221621        (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();
    16251624    }
    16261625    p = strrchr(infile, '/');
     
    16591658            fclose(fin);
    16601659            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 :)
    16631662            return (0);
    16641663        }
  • branches/2.2.5/mondo/src/common/libmondo-string.c

    r1585 r1645  
    2020extern int g_current_media_number;
    2121extern long long g_tape_posK;
     22
     23/* Reference to global bkpinfo */
     24extern struct s_bkpinfo *bkpinfo;
    2225
    2326
     
    10621065 * @note The returned string points to static storage that will be overwritten with each call.
    10631066 */
    1064 char *percent_media_full_comment(struct s_bkpinfo *bkpinfo)
     1067char *percent_media_full_comment()
    10651068{
    10661069    /*@ int *********************************************** */
  • branches/2.2.5/mondo/src/common/libmondo-tools.c

    r1644 r1645  
    196196extern int g_current_media_number;
    197197extern char *MONDO_LOGFILE;
     198
     199/* Reference to global bkpinfo */
     200extern struct s_bkpinfo *bkpinfo;
    198201
    199202/**
     
    566569 * do not exist.
    567570 */
    568 int post_param_configuration(struct s_bkpinfo *bkpinfo)
     571int post_param_configuration()
    569572{
    570573    char *extra_cdrom_params;
     
    878881            }
    879882        }
    880         store_nfs_config(bkpinfo);
     883        store_nfs_config();
    881884    }
    882885
     
    924927 * @return number of errors (0 for success)
    925928 */
    926 int pre_param_configuration(struct s_bkpinfo *bkpinfo)
     929int pre_param_configuration()
    927930{
    928931    int res = 0;
     
    932935    srandom((unsigned long) (time(NULL)));
    933936    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)
    935938    if (bkpinfo->disaster_recovery) {
    936939        if (!does_nonMS_partition_exist()) {
     
    964967 * @param bkpinfo The @c bkpinfo to reset.
    965968 */
    966 void reset_bkpinfo(struct s_bkpinfo *bkpinfo)
     969void reset_bkpinfo()
    967970{
    968971    int i;
  • branches/2.2.5/mondo/src/common/libmondo-verify.c

    r1644 r1645  
    128128extern char *MONDO_LOGFILE;
    129129
     130/* Reference to global bkpinfo */
     131extern struct s_bkpinfo *bkpinfo;
     132
    130133/**
    131134 * Generate a list of the files that have changed, based on @c afio @c -r
     
    210213 * @return The number of sets containing differences (0 for success).
    211214 */
    212 int verify_afioballs_on_CD(struct s_bkpinfo *bkpinfo, char *mountpoint)
     215int verify_afioballs_on_CD(char *mountpoint)
    213216{
    214217
     
    229232         set_number < 9999
    230233         &&
    231          !does_file_exist(vfy_tball_fname
    232                           (bkpinfo, mountpoint, set_number));
     234         !does_file_exist(vfy_tball_fname(mountpoint, set_number));
    233235         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))) {
    235237        return (0);
    236238    }
     
    253255
    254256    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));
    256258         total_sets++) {
    257259        log_msg(1, "total_sets = %d", total_sets);
    258260    }
    259261    for (;
    260          does_file_exist(vfy_tball_fname(bkpinfo, mountpoint, set_number));
     262         does_file_exist(vfy_tball_fname(mountpoint, set_number));
    261263         set_number++) {
    262264        percentage =
     
    266268        log_msg(1, "set = %d", set_number);
    267269        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));
    271271    }
    272272    g_last_afioball_number = set_number - 1;
     
    287287 * @return The number of differences (0 for perfect biggiefiles).
    288288 */
    289 int verify_all_slices_on_CD(struct s_bkpinfo *bkpinfo, char *mtpt)
     289int verify_all_slices_on_CD(char *mtpt)
    290290{
    291291
     
    501501 * @return 0, always.
    502502 */
    503 int verify_a_tarball(struct s_bkpinfo *bkpinfo, char *tarball_fname)
     503int verify_a_tarball(char *tarball_fname)
    504504{
    505505    /*@ buffers ********************************************************* */
     
    631631 */
    632632int
    633 verify_an_afioball_from_CD(struct s_bkpinfo *bkpinfo, char *tarball_fname)
     633verify_an_afioball_from_CD(char *tarball_fname)
    634634{
    635635
     
    637637    int res = 0;
    638638
    639     assert(bkpinfo != NULL);
    640639    assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
    641640
     
    644643        fatal_error("Cannot verify nonexistent afioball");
    645644    }
    646     res = verify_a_tarball(bkpinfo, tarball_fname);
     645    res = verify_a_tarball(tarball_fname);
    647646    return (res);
    648647}
     
    659658 */
    660659int
    661 verify_an_afioball_from_stream(struct s_bkpinfo *bkpinfo, char *orig_fname,
    662                                long long size)
     660verify_an_afioball_from_stream(char *orig_fname, long long size)
    663661{
    664662
     
    691689            tarball_fname);
    692690/*  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);
    695693    if (res) {
    696694        sprintf(tmp,
     
    714712 */
    715713int
    716 verify_a_biggiefile_from_stream(struct s_bkpinfo *bkpinfo,
    717                                 char *biggie_fname, long long size)
     714verify_a_biggiefile_from_stream(char *biggie_fname, long long size)
    718715{
    719716
     
    765762            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    766763        }
    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);
    768765        unlink(test_file);
    769766        res =
     
    809806 * @return 0 for success (even if there are differences); nonzero for a tape error.
    810807 */
    811 int verify_afioballs_from_stream(struct s_bkpinfo *bkpinfo)
     808int verify_afioballs_from_stream()
    812809{
    813810    /*@ int ********************************************************** */
     
    842839    }
    843840    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;
    845842    open_progress_form("Verifying filesystem",
    846843                       "I am verifying archives against your live filesystem now.",
     
    853850        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    854851            res =
    855                 read_EXAT_files_from_tape(bkpinfo, &size, fname, &ctrl_chr,
     852                read_EXAT_files_from_tape(&size, fname, &ctrl_chr,
    856853                                          curr_xattr_list_fname,
    857854                                          curr_acl_list_fname);
     
    876873            iamhere("Reading EXAT files from tape");
    877874            res =
    878                 read_EXAT_files_from_tape(bkpinfo, &size, fname, &ctrl_chr,
     875                read_EXAT_files_from_tape(&size, fname, &ctrl_chr,
    879876                                          curr_xattr_list_fname,
    880877                                          curr_acl_list_fname);
     
    886883        /*log_it(tmp); */
    887884        update_progress_form(tmp);
    888         res = verify_an_afioball_from_stream(bkpinfo, fname, size);
     885        res = verify_an_afioball_from_stream(fname, size);
    889886        if (res) {
    890887            sprintf(tmp, "Afioball %ld differs from live filesystem",
     
    917914 * @return 0 for success (even if there are differences); nonzero for a tape error.
    918915 */
    919 int verify_biggiefiles_from_stream(struct s_bkpinfo *bkpinfo)
     916int verify_biggiefiles_from_stream()
    920917{
    921918
     
    966963            iamhere("Grabbing the EXAT biggiefiles");
    967964            res =
    968                 read_EXAT_files_from_tape(bkpinfo, &size, orig_fname,
     965                read_EXAT_files_from_tape(&size, orig_fname,
    969966                                          &ctrl_chr, curr_xattr_list_fname,
    970967                                          curr_acl_list_fname);
     
    998995        sprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);
    999996        res =
    1000             verify_a_biggiefile_from_stream(bkpinfo, logical_fname, size);
     997            verify_a_biggiefile_from_stream(logical_fname, size);
    1001998        retval += res;
    1002999        current_biggiefile_number++;
     
    10301027 * @ingroup verifyGroup
    10311028 */
    1032 int verify_cd_image(struct s_bkpinfo *bkpinfo)
     1029int verify_cd_image()
    10331030{
    10341031
     
    10711068            popup_and_OK("Please push CD tray closed.");
    10721069        }
    1073         if (find_and_mount_actual_cd(bkpinfo, mountpoint)) {
     1070        if (find_and_mount_actual_cd(mountpoint)) {
    10741071            log_to_screen("failed to mount actual CD");
    10751072            return (1);
     
    11121109*/
    11131110    }
    1114     verify_afioballs_on_CD(bkpinfo, mountpoint);
     1111    verify_afioballs_on_CD(mountpoint);
    11151112    iamhere("before verify_all_slices");
    1116     verify_all_slices_on_CD(bkpinfo, mountpoint);
     1113    verify_all_slices_on_CD(mountpoint);
    11171114
    11181115#ifdef __FreeBSD__
     
    11551152 * @ingroup verifyGroup
    11561153 */
    1157 int verify_tape_backups(struct s_bkpinfo *bkpinfo)
     1154int verify_tape_backups()
    11581155{
    11591156
     
    11721169    log_msg(3, "verify_tape_backups --- starting");
    11731170    log_to_screen("Verifying backups");
    1174     openin_tape(bkpinfo);
     1171    openin_tape();
    11751172/* 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();
    11781175/* find the final blocks */
    11791176    paranoid_system("sync");
    11801177    sleep(2);
    1181     closein_tape(bkpinfo);
     1178    closein_tape();
    11821179/* close tape; exit */
    11831180//  fclose(g_tape_stream); <-- not needed; is handled by closein_tape()
     
    12311228 * @ingroup stringGroup
    12321229 */
    1233 char *vfy_tball_fname(struct s_bkpinfo *bkpinfo, char *mountpoint,
    1234                       int setno)
     1230char *vfy_tball_fname(char *mountpoint, int setno)
    12351231{
    12361232    /*@ buffers ******************************************************* */
  • branches/2.2.5/mondo/src/mondoarchive/main.c

    r1644 r1645  
    146146extern int g_loglevel;
    147147
     148/* Reference to global bkpinfo */
     149struct s_bkpinfo *bkpinfo;
     150
    148151/****************** subroutines used only by main.c ******************/
    149152
     
    261264int main(int argc, char *argv[])
    262265{
    263     struct s_bkpinfo *bkpinfo;
    264266    char *tmp;
    265267    int res, retval;
     
    422424    }
    423425
    424     if (pre_param_configuration(bkpinfo)) {
     426    if (pre_param_configuration()) {
    425427        fatal_error
    426428            ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
     
    431433        g_text_mode = FALSE;
    432434        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 */
    434436        if (res) {
    435437            fatal_error
     
    437439        }
    438440    } else {
    439         res = handle_incoming_parameters(argc, argv, bkpinfo);
     441        res = handle_incoming_parameters(argc, argv);
    440442        if (res) {
    441443            printf
     
    449451
    450452/* Finish configuring global structures */
    451     if (post_param_configuration(bkpinfo)) {
     453    if (post_param_configuration()) {
    452454        fatal_error
    453455            ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
     
    461463    /* If we're meant to backup then backup */
    462464    if (bkpinfo->backup_data) {
    463         res = backup_data(bkpinfo);
     465        res = backup_data();
    464466        retval += res;
    465467        if (res) {
     
    473475/* If we're meant to verify then verify */
    474476    if (bkpinfo->verify_data) {
    475         res = verify_data(bkpinfo);
     477        res = verify_data();
    476478        if (res < 0) {
    477479            sprintf(tmp, "%d difference%c found.", -res,
     
    486488/* Offer to write floppy disk images to physical disks */
    487489    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();
    489491        retval += res;
    490 //      res = offer_to_write_boot_ISO_to_physical_CD(bkpinfo);
     492//      res = offer_to_write_boot_ISO_to_physical_CD();
    491493//      retval += res;
    492494    }
  • branches/2.2.5/mondo/src/mondoarchive/mondo-cli.c

    r1540 r1645  
    210210char *g_getfacl = NULL;
    211211char *g_getfattr = NULL;
     212
     213/* Reference to global bkpinfo */
     214extern struct s_bkpinfo *bkpinfo;
    212215
    213216/**
     
    223226 */
    224227int
    225 handle_incoming_parameters(int argc, char *argv[],
    226                            struct s_bkpinfo *bkpinfo)
     228handle_incoming_parameters(int argc, char *argv[])
    227229{
    228230    /*@ int *** */
     
    237239
    238240    malloc_string(tmp);
    239     sensibly_set_tmpdir_and_scratchdir(bkpinfo);
     241    sensibly_set_tmpdir_and_scratchdir();
    240242    for (i = 0; i < 128; i++) {
    241243        flag_val[i][0] = '\0';
     
    252254    retval += res;
    253255    if (!retval) {
    254         res = process_switches(bkpinfo, flag_val, flag_set);
     256        res = process_switches(flag_val, flag_set);
    255257        retval += res;
    256258    }
     
    293295 * @bug Return code not needed.
    294296 */
    295 int process_the_s_switch(struct s_bkpinfo *bkpinfo, char *value)
     297int process_the_s_switch(char *value)
    296298{
    297299    int j;
     
    337339 */
    338340int
    339 process_switches(struct s_bkpinfo *bkpinfo,
    340                  char flag_val[128][MAX_STR_LEN], bool flag_set[128])
     341process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128])
    341342{
    342343
     
    602603                        ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway.");
    603604                }
    604                 if (process_the_s_switch(bkpinfo, flag_val['s'])) {
     605                if (process_the_s_switch(flag_val['s'])) {
    605606                    fatal_error("Bad -s switch");
    606607                }
     
    616617    } else {                    /* CD size */
    617618        if (flag_set['s']) {
    618             if (process_the_s_switch(bkpinfo, flag_val['s'])) {
     619            if (process_the_s_switch(flag_val['s'])) {
    619620                fatal_error("Bad -s switch");
    620621            }
  • branches/2.2.5/mondo/src/mondorestore/mondo-prep.c

    r1497 r1645  
    190190extern void pause_for_N_seconds(int, char *);
    191191extern char *MONDO_LOGFILE;
    192 
    193192
    194193FILE *g_fprep = NULL;
  • branches/2.2.5/mondo/src/mondorestore/mondo-restore.c

    r1644 r1645  
    2424extern void twenty_seconds_til_yikes(void);
    2525
     26/* Reference to global bkpinfo */
     27struct s_bkpinfo *bkpinfo;
     28
    2629
    2730/* For use in other programs (ex. XMondo) */
     
    153156 * @ingroup restoreGuiGroup
    154157 */
    155 int let_user_edit_the_mountlist(struct s_bkpinfo *bkpinfo,
    156                                 struct mountlist_itself *mountlist,
     158int let_user_edit_the_mountlist(struct mountlist_itself *mountlist,
    157159                                struct raidlist_itself *raidlist)
    158160{
     
    259261 */
    260262int
    261 catchall_mode(struct s_bkpinfo *bkpinfo,
    262               struct mountlist_itself *mountlist,
     263catchall_mode(struct mountlist_itself *mountlist,
    263264              struct raidlist_itself *raidlist)
    264265{
     
    275276    iamhere("post wrm");
    276277    if (c == 'I' || c == 'N' || c == 'C') {
    277         interactively_obtain_media_parameters_from_user(bkpinfo, FALSE);
     278        interactively_obtain_media_parameters_from_user(FALSE);
    278279    } else {
    279280        popup_and_OK("No restoring or comparing will take place today.");
     
    302303    if (c == 'I') {
    303304        log_msg(2, "IM selected");
    304         retval += interactive_mode(bkpinfo, mountlist, raidlist);
     305        retval += interactive_mode(mountlist, raidlist);
    305306    } else if (c == 'N') {
    306307        log_msg(2, "NM selected");
    307         retval += nuke_mode(bkpinfo, mountlist, raidlist);
     308        retval += nuke_mode(mountlist, raidlist);
    308309    } else if (c == 'C') {
    309310        log_msg(2, "CM selected");
    310         retval += compare_mode(bkpinfo, mountlist, raidlist);
     311        retval += compare_mode(mountlist, raidlist);
    311312    }
    312313    paranoid_free(tmp);
     
    358359 **************************************************************************/
    359360
    360 static void clean_blkid(struct s_bkpinfo *bkpinfo) {
     361static void clean_blkid() {
    361362
    362363    char *tmp1 = NULL;
     
    388389 */
    389390int
    390 interactive_mode(struct s_bkpinfo *bkpinfo,
    391                  struct mountlist_itself *mountlist,
     391interactive_mode(struct mountlist_itself *mountlist,
    392392                 struct raidlist_itself *raidlist)
    393393{
     
    429429
    430430    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);
    433433    iamhere("Done loading config file; resizing ML");
    434434    strcpy(tmp, bkpinfo->prefix);
     
    551551    {
    552552        log_msg(1, "Restoring all data");
    553         retval += restore_everything(bkpinfo, NULL);
     553        retval += restore_everything(NULL);
    554554    } else
    555555        if ((restore_all =
     
    559559        for (done = FALSE; !done;) {
    560560            unlink("/tmp/filelist.full");
    561             filelist = process_filelist_and_biggielist(bkpinfo);
     561            filelist = process_filelist_and_biggielist();
    562562            /* Now you have /tmp/tmpfs/filelist.restore-these and /tmp/tmpfs/biggielist.restore-these;
    563563               the former is a list of regular files; the latter, biggiefiles and imagedevs.
     
    578578                    strcpy(bkpinfo->restore_path, tmp);
    579579                    log_msg(1, "Restoring subset");
    580                     retval += restore_everything(bkpinfo, filelist);
     580                    retval += restore_everything(filelist);
    581581                    free_filelist(filelist);
    582582                } else {
     
    612612    }
    613613
    614     clean_blkid(bkpinfo);
     614    clean_blkid();
    615615    protect_against_braindead_sysadmins();
    616616    retval += unmount_all_devices(mountlist);
     
    663663 * Run an arbitrary restore mode (prompt the user), but from ISO images
    664664 * instead of real media.
    665  * @param bkpinfo The backup information structure. Most fields are used.
    666665 * @param mountlist The mountlist containing information about the user's partitions.
    667666 * @param raidlist The raidlist that goes with @p mountlist.
     
    670669 */
    671670int
    672 iso_mode(struct s_bkpinfo *bkpinfo,
    673          struct mountlist_itself *mountlist,
     671iso_mode(struct mountlist_itself *mountlist,
    674672         struct raidlist_itself *raidlist, bool nuke_me_please)
    675673{
     
    677675    int retval = 0;
    678676
    679     assert(bkpinfo != NULL);
    680677    assert(mountlist != NULL);
    681678    assert(raidlist != NULL);
    682     if (iso_fiddly_bits(bkpinfo, nuke_me_please)) {
     679    if (iso_fiddly_bits(nuke_me_please)) {
    683680        log_msg(1, "iso_mode --- returning w/ error");
    684681        return (1);
     
    686683        c = which_restore_mode();
    687684        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);
    690686        }
    691687        if (c == 'I') {
    692             retval += interactive_mode(bkpinfo, mountlist, raidlist);
     688            retval += interactive_mode(mountlist, raidlist);
    693689        } else if (c == 'N') {
    694             retval += nuke_mode(bkpinfo, mountlist, raidlist);
     690            retval += nuke_mode(mountlist, raidlist);
    695691        } else if (c == 'C') {
    696             retval += compare_mode(bkpinfo, mountlist, raidlist);
     692            retval += compare_mode(mountlist, raidlist);
    697693        } else {
    698694            log_to_screen("OK, I shan't restore/compare any files.");
     
    732728 */
    733729int
    734 nuke_mode(struct s_bkpinfo *bkpinfo,
    735           struct mountlist_itself *mountlist,
     730nuke_mode(struct mountlist_itself *mountlist,
    736731          struct raidlist_itself *raidlist)
    737732{
     
    749744    log_msg(2, "nuke_mode --- starting");
    750745
    751     get_cfg_file_from_archive_or_bust(bkpinfo);
     746    get_cfg_file_from_archive_or_bust();
    752747    load_mountlist(mountlist, g_mountlist_fname);   // in case read_cfg_file_into_bkpinfo updated the mountlist
    753748#ifdef __FreeBSD__
     
    770765                tmpA, tmpB, tmpC);
    771766        if (ask_me_yes_or_no(tmp)) {
    772             retval = interactive_mode(bkpinfo, mountlist, raidlist);
     767            retval = interactive_mode(mountlist, raidlist);
    773768            goto after_the_nuke;
    774769        } else {
     
    828823
    829824        if (ask_me_yes_or_no("Try in interactive mode instead?")) {
    830             retval = interactive_mode(bkpinfo, mountlist, raidlist);
     825            retval = interactive_mode(mountlist, raidlist);
    831826            goto after_the_nuke;
    832827        } else
     
    844839    }
    845840    iamhere("Restoring everything");
    846     retval += restore_everything(bkpinfo, NULL);
     841    retval += restore_everything(NULL);
    847842    if (!run_boot_loader(FALSE)) {
    848843        log_msg(1,
     
    850845        boot_loader_installed = TRUE;
    851846    }
    852     clean_blkid(bkpinfo);
     847    clean_blkid();
    853848    protect_against_braindead_sysadmins();
    854849    retval += unmount_all_devices(mountlist);
     
    910905 * @return 0 for success, or the number of errors encountered.
    911906 */
    912 int restore_to_live_filesystem(struct s_bkpinfo *bkpinfo)
     907int restore_to_live_filesystem()
    913908{
    914909    int retval = 0;
     
    937932        sleep(1);
    938933    }
    939     interactively_obtain_media_parameters_from_user(bkpinfo, FALSE);
     934    interactively_obtain_media_parameters_from_user(FALSE);
    940935    log_msg(2, "bkpinfo->media_device = %s", bkpinfo->media_device);
    941936    if (!bkpinfo->media_device[0]) {
     
    948943    open_evalcall_form("Thinking...");
    949944
    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);
    952947    load_mountlist(mountlist, g_mountlist_fname);   // in case read_cfg_file_into_bkpinfo
    953948
     
    955950    retval = load_mountlist(mountlist, g_mountlist_fname);
    956951    load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    957     filelist = process_filelist_and_biggielist(bkpinfo);
     952    filelist = process_filelist_and_biggielist();
    958953    if (filelist) {
    959954        save_filelist(filelist, "/tmp/selected-files.txt");
     
    963958                                 bkpinfo->restore_path, MAX_STR_LEN / 4)) {
    964959            iamhere("Restoring everything");
    965             retval += restore_everything(bkpinfo, filelist);
     960            retval += restore_everything(filelist);
    966961            free_filelist(filelist);
    967962            strcpy(bkpinfo->restore_path, old_restpath);
     
    10141009 */
    10151010int
    1016 restore_a_biggiefile_from_CD(struct s_bkpinfo *bkpinfo,
    1017                              long bigfileno,
     1011restore_a_biggiefile_from_CD(long bigfileno,
    10181012                             struct s_node *filelist,
    10191013                             char *pathname_of_last_file_restored)
     
    12041198                    g_current_media_number);
    12051199            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);
    12071201            log_to_screen("Continuing to restore.");
    12081202        } else {
     
    13451339 * @bug orig_checksum and biggiefile_size are unused (except to check that they are non-NULL).
    13461340 */
    1347 int restore_a_biggiefile_from_stream(struct s_bkpinfo *bkpinfo, char *orig_bf_fname, long biggiefile_number, char *orig_checksum,   //UNUSED
     1341int restore_a_biggiefile_from_stream(char *orig_bf_fname, long biggiefile_number, char *orig_checksum,  //UNUSED
    13481342                                     long long biggiefile_size, //UNUSED
    13491343                                     struct s_node *filelist,
     
    15181512        if (current_slice_number == 0) {
    15191513            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",
    15221515                                              slice_siz);
    15231516            if (!(fin = fopen("/tmp/biggie-blah.txt", "r"))) {
     
    15351528        } else {
    15361529            res =
    1537                 read_file_from_stream_to_stream(bkpinfo, pout, slice_siz);
     1530                read_file_from_stream_to_stream(pout, slice_siz);
    15381531        }
    15391532        retval += res;
     
    18371830 */
    18381831int
    1839 restore_a_tarball_from_stream(struct s_bkpinfo *bkpinfo,
    1840                               char *tarball_fname,
     1832restore_a_tarball_from_stream(char *tarball_fname,
    18411833                              long current_tarball_number,
    18421834                              struct s_node *filelist,
     
    18901882            bkpinfo->tmpdir, current_tarball_number);
    18911883//  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);
    18931885    if (strstr(tarball_fname, ".star")) {
    18941886        bkpinfo->use_star = TRUE;
     
    20312023 */
    20322024int
    2033 restore_all_biggiefiles_from_CD(struct s_bkpinfo *bkpinfo,
    2034                                 struct s_node *filelist)
     2025restore_all_biggiefiles_from_CD(struct s_node *filelist)
    20352026{
    20362027    int retval = 0;
     
    20992090                        "I'll continue to scan this CD for bigfiles to be restored.");
    21002091            } 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);
    21032093                sprintf(tmp, "Restoring from %s #%d",
    2104                         media_descriptor_string(bkpinfo->
    2105                                                 backup_media_type),
     2094                        media_descriptor_string(bkpinfo->backup_media_type),
    21062095                        g_current_media_number);
    21072096                log_to_screen(tmp);
     
    21182107            update_progress_form(tmp);
    21192108            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);
    21222110            iamhere(pathname_of_last_biggie_restored);
    21232111            if (fbw && pathname_of_last_biggie_restored[0]) {
     
    21802168 */
    21812169int
    2182 restore_all_tarballs_from_CD(struct s_bkpinfo *bkpinfo,
    2183                              struct s_node *filelist)
     2170restore_all_tarballs_from_CD(struct s_node *filelist)
    21842171{
    21852172    int retval = 0;
     
    22082195        g_current_media_number = 1;
    22092196    }
    2210     insist_on_this_cd_number(bkpinfo, g_current_media_number);
     2197    insist_on_this_cd_number(g_current_media_number);
    22112198    read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp);
    22122199    max_val = atol(tmp) + 1;
     
    22202207                       progress_str, max_val);
    22212208    for (;;) {
    2222         insist_on_this_cd_number(bkpinfo, g_current_media_number);
     2209        insist_on_this_cd_number(g_current_media_number);
    22232210        update_progress_form(progress_str);
    22242211        sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2",
     
    23262313 */
    23272314int
    2328 restore_all_biggiefiles_from_stream(struct s_bkpinfo *bkpinfo,
    2329                                     struct s_node *filelist)
     2315restore_all_biggiefiles_from_stream(struct s_node *filelist)
    23302316{
    23312317    long noof_biggiefiles;
     
    23812367    if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    23822368        res =
    2383             read_EXAT_files_from_tape(bkpinfo, &biggie_size, biggie_fname,
     2369            read_EXAT_files_from_tape(&biggie_size, biggie_fname,
    23842370                                      &ctrl_chr, xattr_fname, acl_fname);
    23852371    }
     
    24142400                current_bigfile_number + 1, biggie_size / 1024);
    24152401        update_progress_form(tmp);
    2416         res = restore_a_biggiefile_from_stream(bkpinfo, biggie_fname,
     2402        res = restore_a_biggiefile_from_stream(biggie_fname,
    24172403                                               current_bigfile_number,
    24182404                                               biggie_cksum,
     
    25052491 */
    25062492int
    2507 restore_all_tarballs_from_stream(struct s_bkpinfo *bkpinfo,
    2508                                  struct s_node *filelist)
     2493restore_all_tarballs_from_stream(struct s_node *filelist)
    25092494{
    25102495    int retval = 0;
     
    25722557            iamhere("Reading EXAT files from tape");
    25732558            res =
    2574                 read_EXAT_files_from_tape(bkpinfo, &tmp_size, tmp_fname,
     2559                read_EXAT_files_from_tape(&tmp_size, tmp_fname,
    25752560                                          &ctrl_chr, xattr_fname,
    25762561                                          acl_fname);
     
    25832568                current_afioball_number, tmp_fname, (long) tmp_size >> 10);
    25842569        res =
    2585             restore_a_tarball_from_stream(bkpinfo, tmp_fname,
     2570            restore_a_tarball_from_stream(tmp_fname,
    25862571                                          current_afioball_number,
    25872572                                          filelist, tmp_size, xattr_fname,
     
    26442629 * @ingroup restoreGroup
    26452630 */
    2646 int restore_everything(struct s_bkpinfo *bkpinfo, struct s_node *filelist)
     2631int restore_everything(struct s_node *filelist)
    26472632{
    26482633    int resA;
     
    26752660    mvaddstr_and_log_it(g_currentY, 0, "Preparing to read your archives");
    26762661    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2677         mount_cdrom(bkpinfo);
     2662        mount_cdrom();
    26782663        mvaddstr_and_log_it(g_currentY++, 0,
    26792664                            "Restoring OS and data from streaming media");
    26802665        if (bkpinfo->backup_media_type == cdstream) {
    2681             openin_cdstream(bkpinfo);
     2666            openin_cdstream();
    26822667        } 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);
    26892673        if (bkpinfo->backup_media_type == cdstream) {
    2690             closein_cdstream(bkpinfo);
     2674            closein_cdstream();
    26912675        } else {
    2692             closein_tape(bkpinfo);
     2676            closein_tape();
    26932677        }
    26942678    } else {
    26952679        mvaddstr_and_log_it(g_currentY++, 0,
    26962680                            "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);
    27002684    }
    27012685    chdir(cwd);
     
    27262710 */
    27272711int
    2728 restore_live_from_monitas_server(struct s_bkpinfo *bkpinfo,
    2729                                  char *monitas_device,
     2712restore_live_from_monitas_server(char *monitas_device,
    27302713                                 char *restore_this_directory,
    27312714                                 char *restore_here)
     
    27992782
    28002783    unlink(datadisks_fname);
    2801     read_cfg_file_into_bkpinfo(g_mondo_cfg_file, bkpinfo);
     2784    read_cfg_file_into_bkpinfo(g_mondo_cfg_file);
    28022785    retval = load_mountlist(&the_mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo   strcpy(bkpinfo->media_device, monitas_device);
    28032786
     
    28262809    run_program_and_log_output(command, FALSE);
    28272810//  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);
    28292812    free_filelist(filelist);
    28302813    log_msg(2, "--------End of restore_live_from_monitas_server--------");
     
    28982881    struct mountlist_itself *mountlist;
    28992882    struct raidlist_itself *raidlist;
    2900     struct s_bkpinfo *bkpinfo;
    29012883    struct s_node *filelist;
    29022884    char *a, *b;
     
    29582940    malloc_string(a);
    29592941    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();
    29622944    bkpinfo->backup_media_type = none;  // in case boot disk was made for one backup type but user wants to restore from another backup type
    29632945    bkpinfo->restore_data = TRUE;   // Well, yeah :-)
     
    30273009            strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    30283010        }
    3029         res = let_user_edit_the_mountlist(bkpinfo, mountlist, raidlist);
     3011        res = let_user_edit_the_mountlist(mountlist, raidlist);
    30303012#ifdef __FreeBSD__
    30313013        system("mv -f /etc/raidtab /tmp/raidconf.txt");
     
    30603042        system("rm -Rf /tmp/*pih*");
    30613043
    3062         restore_a_biggiefile_from_CD(bkpinfo, 42, NULL, tmp);
     3044        restore_a_biggiefile_from_CD(42, NULL, tmp);
    30633045    }
    30643046
     
    31613143        if (argc == 5 && strcmp(argv[1], "--monitas-live") == 0) {
    31623144            retval =
    3163                 restore_live_from_monitas_server(bkpinfo,
    3164                                                  argv[2],
     3145                restore_live_from_monitas_server(argv[2],
    31653146                                                 argv[3], argv[4]);
    31663147        } else {
    31673148            log_msg(2, "Calling restore_to_live_filesystem()");
    3168             retval = restore_to_live_filesystem(bkpinfo);
     3149            retval = restore_to_live_filesystem();
    31693150        }
    31703151        log_msg(2, "Still here. Yay.");
     
    31863167        iamhere("About to call load_mountlist and load_raidtab");
    31873168        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);
    31893170        retval = load_mountlist(mountlist, g_mountlist_fname);
    31903171        retval += load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     
    32453226        if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
    32463227            iamhere("nuking");
    3247             retval += nuke_mode(bkpinfo, mountlist, raidlist);
     3228            retval += nuke_mode(mountlist, raidlist);
    32483229        } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) {
    32493230            iamhere("catchall");
    3250             retval += catchall_mode(bkpinfo, mountlist, raidlist);
     3231            retval += catchall_mode(mountlist, raidlist);
    32513232        } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) {
    32523233            iamhere("compare");
    3253             retval += compare_mode(bkpinfo, mountlist, raidlist);
     3234            retval += compare_mode(mountlist, raidlist);
    32543235        } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) {
    32553236            iamhere("iso");
    3256             retval = iso_mode(bkpinfo, mountlist, raidlist, FALSE);
     3237            retval = iso_mode(mountlist, raidlist, FALSE);
    32573238        } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) {
    32583239            iamhere("mbr");
     
    32673248        } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) {
    32683249            iamhere("isonuke");
    3269             retval = iso_mode(bkpinfo, mountlist, raidlist, TRUE);
     3250            retval = iso_mode(mountlist, raidlist, TRUE);
    32703251        } else if (argc != 1) {
    32713252            log_to_screen("Invalid paremeters");
     
    32733254        } else {
    32743255            iamhere("catchall (no mode specified in command-line call");
    3275             retval += catchall_mode(bkpinfo, mountlist, raidlist);
     3256            retval += catchall_mode(mountlist, raidlist);
    32763257        }
    32773258    }
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-compare.c

    r1644 r1645  
    6767extern char *MONDO_LOGFILE;
    6868
     69/* Reference to global bkpinfo */
     70extern struct s_bkpinfo *bkpinfo;
     71
    6972//static char cvsid[] = "$Id$";
    7073
     
    8285 * @note This function uses an MD5 checksum.
    8386 */
    84 int compare_a_biggiefile(struct s_bkpinfo *bkpinfo, long bigfileno)
     87int compare_a_biggiefile(long bigfileno)
    8588{
    8689
     
    127130    if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
    128131        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));
    130133        } else {
    131134            sprintf(tmp_ptr,
     
    230233/**
    231234 * Compare all biggiefiles in the backup.
    232  * @param bkpinfo The backup information structure. Used only in compare_a_biggiefile().
    233235 * @return 0 for success, nonzero for failure.
    234236 */
    235 int compare_all_biggiefiles(struct s_bkpinfo *bkpinfo)
     237int compare_all_biggiefiles()
    236238{
    237239    int retval = 0;
     
    240242    char tmp[MAX_STR_LEN];
    241243
    242     assert(bkpinfo != NULL);
    243244    log_msg(1, "Comparing biggiefiles");
    244245
     
    263264        log_msg(1, tmp);
    264265        update_progress_form(tmp);
    265         res = compare_a_biggiefile(bkpinfo, bigfileno);
     266        res = compare_a_biggiefile(bigfileno);
    266267        retval += res;
    267268        g_current_progress++;
     
    417418 * @return 0 for success, nonzero for failure.
    418419 */
    419 int compare_all_tarballs(struct s_bkpinfo *bkpinfo)
     420int compare_all_tarballs()
    420421{
    421422    int retval = 0;
     
    449450
    450451    for (;;) {
    451         insist_on_this_cd_number(bkpinfo, g_current_media_number);
     452        insist_on_this_cd_number(g_current_media_number);
    452453        update_progress_form(progress_str);
    453454        sprintf(tarball_fname,
     
    523524 * @return 0 for success, nonzero for failure.
    524525 */
    525 int compare_to_CD(struct s_bkpinfo *bkpinfo)
     526int compare_to_CD()
    526527{
    527528  /** needs malloc *********/
     
    541542    chdir(bkpinfo->restore_path);
    542543    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);
    544545    unlink(MINDI_CACHE"/changed.txt");
    545546
    546     resA = compare_all_tarballs(bkpinfo);
    547     resB = compare_all_biggiefiles(bkpinfo);
     547    resA = compare_all_tarballs();
     548    resB = compare_all_biggiefiles();
    548549    chdir(cwd);
    549550    noof_changed_files = count_lines_in_file(MINDI_CACHE"/changed.txt");
     
    586587 */
    587588int
    588 compare_mode(struct s_bkpinfo *bkpinfo,
    589              struct mountlist_itself *mountlist,
     589compare_mode(struct mountlist_itself *mountlist,
    590590             struct raidlist_itself *raidlist)
    591591{
     
    608608    assert(raidlist != NULL);
    609609
    610     while (get_cfg_file_from_archive(bkpinfo)) {
     610    while (get_cfg_file_from_archive()) {
    611611        if (!ask_me_yes_or_no
    612612            ("Failed to find config file/archives. Choose another source?"))
     
    614614            fatal_error("Unable to find config file/archives. Aborting.");
    615615        }
    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);
    620620    g_current_media_number = 1;
    621621    mvaddstr_and_log_it(1, 30, "Comparing Automatically");
     
    629629    if (bkpinfo->backup_media_type == tape
    630630        || bkpinfo->backup_media_type == udev) {
    631         retval += compare_to_tape(bkpinfo);
     631        retval += compare_to_tape();
    632632    } 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();
    636636    }
    637637    if (retval) {
     
    695695 * @return 0 for success, nonzero for failure.
    696696 */
    697 int compare_to_cdstream(struct s_bkpinfo *bkpinfo)
     697int compare_to_cdstream()
    698698{
    699699    int res;
     
    721721        find_cdrom_device(bkpinfo->media_device, FALSE);
    722722    }
    723     res = verify_tape_backups(bkpinfo);
     723    res = verify_tape_backups();
    724724    chdir(dir);
    725725    if (length_of_file(MINDI_CACHE"/changed.txt") > 2
     
    754754 * returns: int                                                           *
    755755 **************************************************************************/
    756 int compare_to_tape(struct s_bkpinfo *bkpinfo)
     756int compare_to_tape()
    757757{
    758758    int res;
     
    770770    mvaddstr_and_log_it(g_currentY,
    771771                        0, "Verifying archives against filesystem");
    772     res = verify_tape_backups(bkpinfo);
     772    res = verify_tape_backups();
    773773    chdir(dir);
    774774    if (res) {
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-newt.c

    r738 r1645  
    9595
    9696extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN];
    97 
    9897
    9998/**
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-tools.c

    r1640 r1645  
    162162extern char *MONDO_LOGFILE;
    163163
     164/* Reference to global bkpinfo */
     165extern struct s_bkpinfo *bkpinfo;
     166
    164167/* Should we use or not extended attributes and acl when restoring */
    165168char *g_getfattr = NULL;
     
    285288*/
    286289int
    287 extract_config_file_from_ramdisk(struct s_bkpinfo *bkpinfo,
    288                          char *ramdisk_fname,
     290extract_config_file_from_ramdisk(char *ramdisk_fname,
    289291                         char *output_cfg_file,
    290292                         char *output_mountlist_file)
     
    354356/**
    355357* Keep trying to get mondo-restore.cfg from the archive, until the user gives up.
    356 * @param bkpinfo The backup information structure.
    357358*/
    358 void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *bkpinfo)
    359 {
    360 while (get_cfg_file_from_archive(bkpinfo)) {
     359void get_cfg_file_from_archive_or_bust()
     360{
     361while (get_cfg_file_from_archive()) {
    361362if (!ask_me_yes_or_no
    362363    ("Failed to find config file/archives. Choose another source?"))
     
    364365    fatal_error("Could not find config file/archives. Aborting.");
    365366}
    366 interactively_obtain_media_parameters_from_user(bkpinfo, FALSE);
     367interactively_obtain_media_parameters_from_user(FALSE);
    367368}
    368369}
     
    432433* @return 0 for success, nonzero for failure.
    433434*/
    434 int iso_fiddly_bits(struct s_bkpinfo *bkpinfo, bool nuke_me_please)
     435int iso_fiddly_bits(bool nuke_me_please)
    435436{
    436437char *mount_isodir_command, *tmp, *command;
     
    488489}
    489490if (!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() */
     491mount_cdrom();
     492}
     493i = what_number_cd_is_this();   /* has the side-effect of calling mount_cdrom() */
    493494sprintf(tmp, "%s #%d has been mounted via loopback mount",
    494495    media_descriptor_string(bkpinfo->backup_media_type), i);
     
    637638* @return 0 for success, nonzero for failure.
    638639*/
    639 int mount_cdrom(struct s_bkpinfo *bkpinfo)
     640int mount_cdrom()
    640641{
    641642char *mount_cmd;
     
    906907* @return 0 for success, nonzero for failure.
    907908*/
    908 int read_cfg_file_into_bkpinfo(char *cfgf, struct s_bkpinfo *bkpinfo)
     909int read_cfg_file_into_bkpinfo(char *cfgf)
    909910{
    910911/** add mallocs **/
     
    11881189            strcpy(bkpinfo->media_device, "/dev/cdrom");    /* superfluous */
    11891190            bkpinfo->isodir[0] = iso_mnt[0] = iso_path[0] = '\0';
    1190             if (mount_cdrom(bkpinfo)) {
     1191            if (mount_cdrom()) {
    11911192                fatal_error
    11921193                    ("Unable to mount isodir. Failed to mount CD-ROM as well.");
     
    12091210        log_msg(2,
    12101211                "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);
    12131213        media_specified_by_user = bkpinfo->backup_media_type;
    1214         get_cfg_file_from_archive(bkpinfo);
     1214        get_cfg_file_from_archive();
    12151215/*
    12161216      if (media_specified_by_user != cdr && media_specified_by_user == cdrw)
     
    12501250*/
    12511251struct
    1252 s_node *process_filelist_and_biggielist(struct s_bkpinfo *bkpinfo)
     1252s_node *process_filelist_and_biggielist()
    12531253{
    12541254struct s_node *filelist;
     
    12931293            "Calling insist_on_this_cd_number; bkpinfo->isodir=%s",
    12941294            bkpinfo->isodir);
    1295     insist_on_this_cd_number(bkpinfo, 1);
     1295    insist_on_this_cd_number(1);
    12961296    log_msg(2, "Back from iotcn");
    12971297    run_program_and_log_output("mount", 1);
     
    19891989 * - @c bkpinfo->disaster_recovery
    19901990 */
    1991 void setup_MR_global_filenames(struct s_bkpinfo *bkpinfo)
     1991void setup_MR_global_filenames()
    19921992{
    19931993    char *temppath;
     
    22922292 * @return 0 for success, nonzero for failure.
    22932293 */
    2294 int get_cfg_file_from_archive(struct s_bkpinfo *bkpinfo)
     2294int get_cfg_file_from_archive()
    22952295{
    22962296    int retval = 0;
     
    23792379                    "Cannot find ramdisk file on mountpoint. Are you sure that's a boot disk in the drive?");
    23802380        }
    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)) {
    23832382            log_msg(2,
    23842383                    "Warning - failed to extract config file from ramdisk. I think this boot disk is mangled.");
     
    23942393        } else {
    23952394            log_msg(2, "gcffa --- calling mount_cdrom now :)");
    2396             if (!mount_cdrom(bkpinfo)) {
     2395            if (!mount_cdrom()) {
    23972396                log_msg(2,
    23982397                        "gcffa --- managed to mount CD; so, no need for Plan B");
     
    24012400                try_plan_B = TRUE;
    24022401            }
    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));
    24062404            }
    24072405        }
Note: See TracChangeset for help on using the changeset viewer.