Ignore:
Timestamp:
Mar 9, 2024, 3:10:04 AM (3 months ago)
Author:
Bruno Cornec
Message:

Fix all remaining compiler errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/mondorestore/mondo-rstr-compare.c

    r3875 r3879  
    77#include "mr_mem.h"
    88#include "mr_file.h"
    9 #include "../common/mondostructures.h"
    10 #include "../common/libmondo.h"
    11 //#include "../../config.h"
    12 #include "mr-externs.h"
    13 #include "mondo-rstr-compare.h"
    14 #include "mondorestore-EXT.h"
     9#include "mr_sys.h"
     10#include "mondostructures.h"
    1511#include "mondo-rstr-tools-EXT.h"
     12#include "libmondo-string-EXT.h"
     13#include "libmondo-verify-EXT.h"
     14#include "libmondo-files-EXT.h"
     15#include "libmondo-tools-EXT.h"
     16#include "libmondo-fork-EXT.h"
     17#include "libmondo-devices-EXT.h"
     18#include "libmondo-string-EXT.h"
     19#include "libmondo-mountlist-EXT.h"
     20#include "libmondo-raid-EXT.h"
     21#include "newt-specific-EXT.h"
    1622
    1723extern char *MONDO_LOGFILE;
     
    2127
    2228extern char *g_mountlist_fname;
     29extern int g_current_media_number;
     30extern bool g_text_mode;
     31extern int g_currentY;
     32extern long g_current_progress;
     33extern char *g_mondo_cfg_file;
     34
     35// in mondo-rstr-newt.c
     36extern int edit_mountlist(char *, struct mountlist_itself *, struct raidlist_itself *);
    2337
    2438//static char cvsid[] = "$Id$";
     
    6377
    6478    if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
    65         if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
     79        if (does_file_exist(ARCHIVES_PATH "/NOT-THE-LAST")) {
    6680            insist_on_this_cd_number((++g_current_media_number));
    6781        } else {
     
    368382        insist_on_this_cd_number(g_current_media_number);
    369383        update_progress_form(progress_str);
    370         mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
     384        mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.bz2", current_tarball_number);
    371385
    372386        if (!does_file_exist(tarball_fname)) {
    373387            mr_free(tarball_fname);
    374             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
     388            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.lzo", current_tarball_number);
    375389        }
    376390        if (!does_file_exist(tarball_fname)) {
    377391            mr_free(tarball_fname);
    378             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number);
     392            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.lzma", current_tarball_number);
    379393        }
    380394        if (!does_file_exist(tarball_fname)) {
    381395            mr_free(tarball_fname);
    382             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);
     396            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.gz", current_tarball_number);
    383397        }
    384398        if (!does_file_exist(tarball_fname)) {
    385399            mr_free(tarball_fname);
    386             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);
     400            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.", current_tarball_number);
    387401        }
    388402        if (!does_file_exist(tarball_fname)) {
    389403            mr_free(tarball_fname);
    390             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);
     404            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.star.bz2", current_tarball_number);
    391405        }
    392406        if (!does_file_exist(tarball_fname)) {
    393407            mr_free(tarball_fname);
    394             mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);
     408            mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.star.", current_tarball_number);
    395409        }
    396410        if (!does_file_exist(tarball_fname)) {
    397             if (!does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST") ||
    398                 system("find " MNT_CDROM
    399                        "/archives/slice* > /dev/null 2> /dev/null")
     411            if (!does_file_exist(ARCHIVES_PATH "/NOT-THE-LAST") ||
     412                system("find " ARCHIVES_PATH "/slice* > /dev/null 2> /dev/null")
    400413                == 0) {
    401414                log_msg(2, "OK, I think I'm done with tarballs...");
     
    492505 **************************************************************************/
    493506
     507/**
     508 * Compare all data on a tape-based backup.
     509 * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path.
     510 * @return 0 for success, nonzero for failure.
     511 */
     512/**************************************************************************
     513 * F@COMPARE_TO_TAPE()                                                    *
     514 * compare_to_tape() -  gots me??                                         *
     515 *                                                                        *
     516 * returns: int                                                           *
     517 **************************************************************************/
     518int compare_to_tape()
     519{
     520    int res;
     521    char *dir;
     522    char *command = NULL;
     523
     524    assert(bkpinfo != NULL);
     525    malloc_string(dir);
     526
     527    if (getcwd(dir, MAX_STR_LEN)) {
     528        // FIXME
     529    }
     530    if (chdir(bkpinfo->restore_path)) {
     531        // FIXME
     532    }
     533    mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
     534    run_program_and_log_output(command, FALSE);
     535    mr_free(command);
     536
     537    mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
     538    res = verify_tape_backups();
     539    if (chdir(dir)) {
     540        // FIXME
     541    }
     542    if (res) {
     543        mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
     544    } else {
     545        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     546    }
     547    paranoid_free(dir);
     548    return (res);
     549}
     550
     551/**************************************************************************
     552 *END_COMPARE_TO_TAPE                                                     *
     553 **************************************************************************/
     554
     555
     556/**
     557 * Compare all data on a cdstream-based backup.
     558 * @param bkpinfo The backup information structure. Fields used:
     559 * - @c bkpinfo->disaster_recovery
     560 * - @c bkpinfo->media_device
     561 * - @c bkpinfo->restore_path
     562 * @return 0 for success, nonzero for failure.
     563 */
     564int compare_to_cdstream()
     565{
     566    int res;
     567
     568  /** needs malloc **/
     569    char *dir;
     570    char *command = NULL;
     571
     572    assert(bkpinfo != NULL);
     573    malloc_string(dir);
     574    if (getcwd(dir, MAX_STR_LEN)) {
     575        // FIXME
     576    }
     577    if (chdir(bkpinfo->restore_path)) {
     578        // FIXME
     579    }
     580
     581    mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
     582    run_program_and_log_output(command, FALSE);
     583    mr_free(command);
     584    mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
     585
     586    if (bkpinfo->disaster_recovery
     587        && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
     588        mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));
     589    } else {
     590        bkpinfo->media_device = find_optical_device();
     591    }
     592    res = verify_tape_backups();
     593    if (chdir(dir)) {
     594        // FIXME
     595    }
     596    if (length_of_file(MONDO_CACHE"/changed.txt") > 2
     597        && length_of_file(MONDO_CACHE"/changed.files") > 2) {
     598        log_msg(0,
     599                "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");
     600        log_msg(2, "Calling popup_changelist_from_file()");
     601        popup_changelist_from_file(MONDO_CACHE"/changed.files");
     602        log_msg(2, "Returned from popup_changelist_from_file()");
     603    }
     604
     605    mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     606    paranoid_free(dir);
     607    return (res);
     608}
     609
     610/**************************************************************************
     611 *END_COMPARE_CD_STREAM                                                   *
     612 **************************************************************************/
    494613
    495614
     
    620739 *END_COMPARE_MODE                                                        *
    621740 **************************************************************************/
    622 
    623 /**
    624  * Compare all data on a cdstream-based backup.
    625  * @param bkpinfo The backup information structure. Fields used:
    626  * - @c bkpinfo->disaster_recovery
    627  * - @c bkpinfo->media_device
    628  * - @c bkpinfo->restore_path
    629  * @return 0 for success, nonzero for failure.
    630  */
    631 int compare_to_cdstream()
    632 {
    633     int res;
    634 
    635   /** needs malloc **/
    636     char *dir;
    637     char *command = NULL;
    638 
    639     assert(bkpinfo != NULL);
    640     malloc_string(dir);
    641     if (getcwd(dir, MAX_STR_LEN)) {
    642         // FIXME
    643     }
    644     if (chdir(bkpinfo->restore_path)) {
    645         // FIXME
    646     }
    647 
    648     mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
    649     run_program_and_log_output(command, FALSE);
    650     mr_free(command);
    651     mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
    652 
    653     if (bkpinfo->disaster_recovery
    654         && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    655         mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    656     } else {
    657         bkpinfo->media_device = find_optical_device();
    658     }
    659     res = verify_tape_backups();
    660     if (chdir(dir)) {
    661         // FIXME
    662     }
    663     if (length_of_file(MONDO_CACHE"/changed.txt") > 2
    664         && length_of_file(MONDO_CACHE"/changed.files") > 2) {
    665         log_msg(0,
    666                 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");
    667         log_msg(2, "Calling popup_changelist_from_file()");
    668         popup_changelist_from_file(MONDO_CACHE"/changed.files");
    669         log_msg(2, "Returned from popup_changelist_from_file()");
    670     }
    671 
    672     mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    673     paranoid_free(dir);
    674     return (res);
    675 }
    676 
    677 /**************************************************************************
    678  *END_COMPARE_CD_STREAM                                                   *
    679  **************************************************************************/
    680 
    681 
    682 /**
    683  * Compare all data on a tape-based backup.
    684  * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path.
    685  * @return 0 for success, nonzero for failure.
    686  */
    687 /**************************************************************************
    688  * F@COMPARE_TO_TAPE()                                                    *
    689  * compare_to_tape() -  gots me??                                         *
    690  *                                                                        *
    691  * returns: int                                                           *
    692  **************************************************************************/
    693 int compare_to_tape()
    694 {
    695     int res;
    696     char *dir;
    697     char *command = NULL;
    698 
    699     assert(bkpinfo != NULL);
    700     malloc_string(dir);
    701 
    702     if (getcwd(dir, MAX_STR_LEN)) {
    703         // FIXME
    704     }
    705     if (chdir(bkpinfo->restore_path)) {
    706         // FIXME
    707     }
    708     mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
    709     run_program_and_log_output(command, FALSE);
    710     mr_free(command);
    711 
    712     mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
    713     res = verify_tape_backups();
    714     if (chdir(dir)) {
    715         // FIXME
    716     }
    717     if (res) {
    718         mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    719     } else {
    720         mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    721     }
    722     paranoid_free(dir);
    723     return (res);
    724 }
    725 
    726 /**************************************************************************
    727  *END_COMPARE_TO_TAPE                                                     *
    728  **************************************************************************/
    729 
    730741/* @} - end compareGroup */
Note: See TracChangeset for help on using the changeset viewer.