Changeset 59 in MondoRescue for trunk/mondo/mondo/common/libmondo-verify.c


Ignore:
Timestamp:
Oct 11, 2005, 1:34:31 AM (19 years ago)
Author:
bcornec
Message:

Trunk: indent on all source files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-verify.c

    r49 r59  
    7474    log_msg(1, "Now scanning log file for 'afio: ' stuff");
    7575    asprintf(&command,
    76             "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s",
    77             stderr_fname, afio_found_changes);
     76             "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s",
     77             stderr_fname, afio_found_changes);
    7878    log_msg(2, command);
    7979    res = system(command);
     
    8585    log_msg(1, "Now scanning log file for 'star: ' stuff");
    8686    asprintf(&command,
    87             "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s",
    88             stderr_fname, afio_found_changes);
     87             "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s",
     88             stderr_fname, afio_found_changes);
    8989    log_msg(2, command);
    9090    res = system(command);
     
    9696    afio_diffs = count_lines_in_file(afio_found_changes);
    9797    asprintf(&command,
    98             "cat %s %s %s | sort | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",
    99             ignorefiles_fname, afio_found_changes, afio_found_changes,
    100             changedfiles_fname);
     98             "cat %s %s %s | sort | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",
     99             ignorefiles_fname, afio_found_changes, afio_found_changes,
     100             changedfiles_fname);
    101101    log_msg(2, command);
    102102    paranoid_system(command);
     
    150150            retval++;
    151151            asprintf(&tmp, "Warning - missing set(s) between %d and %d\n",
    152                     g_last_afioball_number, set_number - 1);
     152                     g_last_afioball_number, set_number - 1);
    153153            log_to_screen(tmp);
    154154            paranoid_free(tmp);
     
    156156    }
    157157    asprintf(&tmp, "Verifying %s #%d's tarballs",
    158             media_descriptor_string(bkpinfo->backup_media_type),
    159             g_current_media_number);
     158             media_descriptor_string(bkpinfo->backup_media_type),
     159             g_current_media_number);
    160160    open_evalcall_form(tmp);
    161161    paranoid_free(tmp);
     
    177177            verify_an_afioball_from_CD(bkpinfo,
    178178                                       vfy_tball_fname(bkpinfo, mountpoint,
    179                                        set_number));
     179                                                       set_number));
    180180    }
    181181    g_last_afioball_number = set_number - 1;
     
    253253    iamhere("before vsbf");
    254254    asprintf(&tmp, "Verifying %s#%d's big files",
    255             media_descriptor_string(bkpinfo->backup_media_type),
    256             g_current_media_number);
     255             media_descriptor_string(bkpinfo->backup_media_type),
     256             g_current_media_number);
    257257    open_evalcall_form(tmp);
    258258    paranoid_free(tmp);
     
    293293            }
    294294            asprintf(&tmp, "%s/%s", bkpinfo->restore_path,
    295                     biggiestruct.filename);
     295                     biggiestruct.filename);
    296296            log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp);
    297297            if (!(forig = fopen(tmp, "r"))) {
     
    314314            if (bkpinfo->compression_level > 0) {
    315315                asprintf(&command, "cat %s | %s -dc 2>> %s",
    316                         slice_fname(bigfile_num, slice_num, mountpoint,
    317                                     bkpinfo->zip_suffix), sz_exe,
    318                         MONDO_LOGFILE);
     316                         slice_fname(bigfile_num, slice_num, mountpoint,
     317                                     bkpinfo->zip_suffix), sz_exe,
     318                         MONDO_LOGFILE);
    319319            } else {
    320320                asprintf(&command, "cat %s",
    321                         slice_fname(bigfile_num, slice_num, mountpoint,
    322                                     bkpinfo->zip_suffix));
     321                         slice_fname(bigfile_num, slice_num, mountpoint,
     322                                     bkpinfo->zip_suffix));
    323323            }
    324324            if ((pin = popen(command, "r"))) {
     
    437437        if (strstr(tarball_fname, ".bz2"))
    438438            asprintf(&command,
    439                     "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s",
    440                     tarball_fname,
    441                     (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog,
    442                     outlog);
     439                     "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s",
     440                     tarball_fname,
     441                     (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog,
     442                     outlog);
    443443    } else {
    444444        bkpinfo->use_star = FALSE;
    445445        asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s",
    446                 bkpinfo->zip_exe, tarball_fname, outlog, outlog);
     446                 bkpinfo->zip_exe, tarball_fname, outlog, outlog);
    447447    }
    448448    log_msg(6, "command=%s", command);
     
    454454    } else {
    455455        asprintf(&command, "cat %s | cut -d':' -f%d | sort | uniq", outlog,
    456                 (bkpinfo->use_star) ? 1 : 2);
     456                 (bkpinfo->use_star) ? 1 : 2);
    457457        pin = popen(command, "r");
    458458        if (pin) {
     
    569569    asprintf(&tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p);
    570570    /* BERLIOS : useless
    571     asprintf(&tmp, "Temporarily copying file from tape to '%s'",
    572             tarball_fname);
    573     log_it(tmp);
    574     paranoid_free(tmp);
    575     */
     571       asprintf(&tmp, "Temporarily copying file from tape to '%s'",
     572       tarball_fname);
     573       log_it(tmp);
     574       paranoid_free(tmp);
     575     */
    576576    read_file_from_stream_to_file(bkpinfo, tarball_fname, size);
    577577    res = verify_a_tarball(bkpinfo, tarball_fname);
    578578    if (res) {
    579579        asprintf(&tmp,
    580                 "Afioball '%s' no longer matches your live filesystem", p);
     580                 "Afioball '%s' no longer matches your live filesystem",
     581                 p);
    581582        log_msg(0, tmp);
    582583        paranoid_free(tmp);
     
    632633    asprintf(&test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);
    633634    /* BERLIOS: useless
    634     asprintf(&tmp,
    635             "Temporarily copying biggiefile %s's slices from tape to '%s'",
    636             p, test_file);
    637     log_it(tmp);
    638     paranoid_free(tmp);
    639     */
    640     for (res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
     635       asprintf(&tmp,
     636       "Temporarily copying biggiefile %s's slices from tape to '%s'",
     637       p, test_file);
     638       log_it(tmp);
     639       paranoid_free(tmp);
     640     */
     641    for (res =
     642         read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
    641643         ctrl_chr != BLK_STOP_A_BIGGIE;
    642          res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr)) {
     644         res =
     645         read_header_block_from_stream(&slice_siz, slice_fnam,
     646                                       &ctrl_chr)) {
    643647        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    644648            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
     
    646650        res = read_file_from_stream_to_file(bkpinfo, test_file, slice_siz);
    647651        unlink(test_file);
    648         res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
     652        res =
     653            read_header_block_from_stream(&slice_siz, slice_fnam,
     654                                          &ctrl_chr);
    649655        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    650656            log_msg(2, "test_file = %s", test_file);
     
    663669        if (strcmp(biggie_cksum, orig_cksum)) {
    664670            asprintf(&tmp, "orig cksum=%s; curr cksum=%s", biggie_cksum,
    665                     orig_cksum);
     671                     orig_cksum);
    666672            log_msg(2, tmp);
    667673            paranoid_free(tmp);
    668674
    669675            asprintf(&tmp, "%s has changed on live filesystem",
    670                     biggie_fname);
     676                     biggie_fname);
    671677            log_to_screen(tmp);
    672678            paranoid_free(tmp);
    673679
    674680            asprintf(&tmp, "echo \"%s\" >> /tmp/biggies.changed",
    675                     biggie_fname);
     681                     biggie_fname);
    676682            system(tmp);
    677683            paranoid_free(tmp);
     
    715721
    716722    asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ,
    717             bkpinfo->tmpdir);
     723             bkpinfo->tmpdir);
    718724    asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ,
    719             bkpinfo->tmpdir);
     725             bkpinfo->tmpdir);
    720726    log_to_screen("Verifying regular archives on tape");
    721727    total_afioballs = get_last_filelist_number(bkpinfo) + 1;
     
    745751         res = read_header_block_from_stream(&size, fname, &ctrl_chr)) {
    746752        asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
    747                 bkpinfo->tmpdir, current_afioball_number);
     753                 bkpinfo->tmpdir, current_afioball_number);
    748754        asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ,
    749                 bkpinfo->tmpdir, current_afioball_number);
     755                 bkpinfo->tmpdir, current_afioball_number);
    750756        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    751757            iamhere("Reading EXAT files from tape");
     
    769775        if (res) {
    770776            asprintf(&tmp, "Afioball %ld differs from live filesystem",
    771                     current_afioball_number);
     777                     current_afioball_number);
    772778            log_to_screen(tmp);
    773779            paranoid_free(tmp);
     
    824830
    825831    asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ,
    826             bkpinfo->tmpdir);
     832             bkpinfo->tmpdir);
    827833    asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ,
    828             bkpinfo->tmpdir);
     834             bkpinfo->tmpdir);
    829835    asprintf(&comment, "Verifying all bigfiles.");
    830836    log_to_screen(comment);
    831837    /*
    832     asprintf(&tmp, "%s/biggielist.txt", bkpinfo->tmpdir);
    833     noof_biggiefiles = count_lines_in_file (tmp); // pointless
    834     paranoid_free(tmp);
    835     */
     838       asprintf(&tmp, "%s/biggielist.txt", bkpinfo->tmpdir);
     839       noof_biggiefiles = count_lines_in_file (tmp); // pointless
     840       paranoid_free(tmp);
     841     */
    836842    res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr);
    837843    if (ctrl_chr != BLK_START_BIGGIEFILES) {
     
    872878        }
    873879        asprintf(&comment, "Verifying bigfile #%ld (%ld K)",
    874                 current_biggiefile_number, (long) size >> 10);
     880                 current_biggiefile_number, (long) size >> 10);
    875881        update_progress_form(comment);
    876882        paranoid_free(comment);
    877883
    878         asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);
    879         res = verify_a_biggiefile_from_stream(bkpinfo, logical_fname, size);
     884        asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path,
     885                 orig_fname);
     886        res =
     887            verify_a_biggiefile_from_stream(bkpinfo, logical_fname, size);
    880888        paranoid_free(logical_fname);
    881889        retval += res;
     
    929937    asprintf(&mountpoint, "%s/cdrom", bkpinfo->tmpdir);
    930938    asprintf(&fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix,
    931             bkpinfo->nfs_remote_dir, g_current_media_number);
     939             bkpinfo->nfs_remote_dir, g_current_media_number);
    932940
    933941    mkdir(mountpoint, 1777);
     
    935943    if (!does_file_exist(fname)) {
    936944        asprintf(&tmp,
    937                 "%s not found; assuming you backed up to CD; verifying CD...",
    938                 fname);
     945                 "%s not found; assuming you backed up to CD; verifying CD...",
     946                 fname);
    939947        log_msg(2, tmp);
    940948        paranoid_free(tmp);
     
    957965        if (ret) {
    958966            asprintf(&tmp, "make_vn of %s failed; unable to verify ISO\n",
    959                     fname);
     967                     fname);
    960968            log_to_screen(tmp);
    961969            paranoid_free(tmp);
     
    965973#else
    966974        asprintf(&command, "mount -o loop,ro -t iso9660 %s %s", fname,
    967                 mountpoint);
     975                 mountpoint);
    968976#endif
    969977        if (run_program_and_log_output(command, FALSE)) {
    970978            asprintf(&tmp, "%s failed; unable to mount ISO image\n",
    971                     command);
     979                     command);
    972980            log_to_screen(tmp);
    973981            paranoid_free(tmp);
     
    10081016#endif
    10091017    {
    1010         asprintf(&tmp, "%s failed; unable to unmount ISO image\n", command);
     1018        asprintf(&tmp, "%s failed; unable to unmount ISO image\n",
     1019                 command);
    10111020        log_to_screen(tmp);
    10121021        paranoid_free(tmp);
     
    10731082        ("rm -f /tmp/biggies.changed /tmp/changed.files.[0-9]* 2> /dev/null");
    10741083    asprintf(&changed_files_fname, "/tmp/changed.files.%d",
    1075             (int) (random() % 32767));
     1084             (int) (random() % 32767));
    10761085    asprintf(&tmp,
    1077             "cat %s | grep -x \"%s:.*\" | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\"  > %s",
    1078             MONDO_LOGFILE, (bkpinfo->use_star) ? "star" : "afio",
    1079             changed_files_fname);
     1086             "cat %s | grep -x \"%s:.*\" | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\"  > %s",
     1087             MONDO_LOGFILE, (bkpinfo->use_star) ? "star" : "afio",
     1088             changed_files_fname);
    10801089    log_msg(2, "Running command to derive list of changed files");
    10811090    log_msg(2, tmp);
     
    10991108    if (diffs > 0) {
    11001109        asprintf(&tmp, "cp -f %s %s", changed_files_fname,
    1101                 "/tmp/changed.files");
     1110                 "/tmp/changed.files");
    11021111        run_program_and_log_output(tmp, FALSE);
    11031112        paranoid_free(tmp);
    11041113
    11051114        asprintf(&tmp,
    1106                 "%ld files differed from live filesystem; type less %s or less %s to see",
    1107                 diffs, changed_files_fname, "/tmp/changed.files");
     1115                 "%ld files differed from live filesystem; type less %s or less %s to see",
     1116                 diffs, changed_files_fname, "/tmp/changed.files");
    11081117        log_msg(0, tmp);
    11091118        paranoid_free(tmp);
     
    11381147    assert_string_is_neither_NULL_nor_zerolength(mountpoint);
    11391148    asprintf(&output, "%s/archives/%d.star.%s", mountpoint, setno,
    1140             bkpinfo->zip_suffix);
     1149             bkpinfo->zip_suffix);
    11411150    if (!does_file_exist(output)) {
    11421151        paranoid_free(output);
    11431152        asprintf(&output, "%s/archives/%d.afio.%s", mountpoint, setno,
    1144                 bkpinfo->zip_suffix);
     1153                 bkpinfo->zip_suffix);
    11451154    }
    11461155    return (output);
Note: See TracChangeset for help on using the changeset viewer.