Ignore:
Timestamp:
Feb 2, 2007, 11:21:27 PM (13 years ago)
Author:
Bruno Cornec
Message:

log_msg => mr_msg in trunk

File:
1 edited

Legend:

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

    r1083 r1086  
    150150    int retval = 0;
    151151
    152     log_msg(1, "Sorting file %s", orig_fname);
     152    mr_msg(1, "Sorting file %s", orig_fname);
    153153    mr_asprintf(&tmp_fname, "/tmp/sort.%d.%d.%d", (int) (random() % 32768),
    154154             (int) (random() % 32768), (int) (random() % 32768));
     
    164164
    165165    if (retval) {
    166         log_msg(2, "Failed to sort %s - oh dear", orig_fname);
     166        mr_msg(2, "Failed to sort %s - oh dear", orig_fname);
    167167    } else {
    168         log_msg(2, "Sorted %s --> %s OK. Copying it back to %s now",
     168        mr_msg(2, "Sorted %s --> %s OK. Copying it back to %s now",
    169169                orig_fname, tmp_fname, orig_fname);
    170170        mr_asprintf(&command, "mv -f %s %s", tmp_fname, orig_fname);
     
    173173
    174174        if (retval) {
    175             log_msg(2, "Failed to copy %s back to %s - oh dear", tmp_fname,
     175            mr_msg(2, "Failed to copy %s back to %s - oh dear", tmp_fname,
    176176                    orig_fname);
    177177        } else {
    178             log_msg(2, "%s was sorted OK.", orig_fname);
     178            mr_msg(2, "%s was sorted OK.", orig_fname);
    179179        }
    180180    }
    181181    mr_free(tmp_fname);
    182     log_msg(1, "Finished sorting file %s", orig_fname);
     182    mr_msg(1, "Finished sorting file %s", orig_fname);
    183183    return (retval);
    184184}
     
    325325        mr_asprintf(&tmp, "Filelist divided into %ld sets", curr_set_no + 1);
    326326    }
    327     log_msg(1, tmp);
     327    mr_msg(1, tmp);
    328328    mr_free(tmp);
    329329    close_evalcall_form();
     
    403403    pattr = popen(syscall, "r");
    404404    if (!pattr) {
    405         log_msg(1, "Failed to open fattr() %s", syscall);
     405        mr_msg(1, "Failed to open fattr() %s", syscall);
    406406        return (1);
    407407    }
    408408    if (feof(pattr)) {
    409         log_msg(1, "Failed to call fattr() %s", syscall);
     409        mr_msg(1, "Failed to call fattr() %s", syscall);
    410410        paranoid_pclose(pattr);
    411411        return (2);
     
    433433
    434434    if (!(fin = fopen(filelist, "r"))) {
    435         log_msg(1, "Cannot openin filelist %s", filelist);
     435        mr_msg(1, "Cannot openin filelist %s", filelist);
    436436        return (1);
    437437    }
    438438    mr_asprintf(&pout_command, "gzip -c1 > %s", auxlist_fname);
    439439    if (!(pout = popen(pout_command, "w"))) {
    440         log_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname);
     440        mr_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname);
    441441        fclose(fin);
    442442        mr_free(pout_command);
     
    451451            file_to_analyze[i - 1] = '\0';
    452452        }
    453         log_msg(8, "Analyzing %s", file_to_analyze);
     453        mr_msg(8, "Analyzing %s", file_to_analyze);
    454454        /* BERLIOS : to be checked */
    455455        mr_asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
     
    520520    FILE *pin, *pout, *faclin;
    521521
    522     log_msg(1, "set_EXAT_list(%s, %s, %s)", orig_msklist,
     522    mr_msg(1, "set_EXAT_list(%s, %s, %s)", orig_msklist,
    523523            original_exat_fname, executable);
    524524    if (!orig_msklist || !orig_msklist[0]
    525525        || !does_file_exist(orig_msklist)) {
    526         log_msg(1,
     526        mr_msg(1,
    527527                "No masklist provided. I shall therefore set ALL attributes.");
    528528        mr_asprintf(&command, "gzip -dc %s | %s --restore - 2>> %s",
    529529                 original_exat_fname, executable, MONDO_LOGFILE);
    530         log_msg(1, "command = %s", command);
     530        mr_msg(1, "command = %s", command);
    531531        retval = system(command);
    532532        mr_free(command);
    533         log_msg(1, "Returning w/ retval=%d", retval);
     533        mr_msg(1, "Returning w/ retval=%d", retval);
    534534        return (retval);
    535535    }
    536536    if (length_of_file(original_exat_fname) <= 0) {
    537         log_msg(1,
     537        mr_msg(1,
    538538                "original_exat_fname %s is empty or missing, so no need to set EXAT list",
    539539                original_exat_fname);
     
    551551             MONDO_LOGFILE);
    552552
    553     log_msg(1, "syscall_pin = %s", syscall_pin);
    554     log_msg(1, "syscall_pout = %s", syscall_pout);
     553    mr_msg(1, "syscall_pin = %s", syscall_pin);
     554    mr_msg(1, "syscall_pout = %s", syscall_pout);
    555555    pout = popen(syscall_pout, "w");
    556556    if (!pout) {
     
    604604
    605605        i = strcmp(p, q);
    606         log_msg(my_depth, "'%s' v '%s' --> %d\n", p, q, i);
     606        mr_msg(my_depth, "'%s' v '%s' --> %d\n", p, q, i);
    607607
    608608//      printf("%s v %s --> %d\n", p, q, i);
    609609
    610610        if (i < 0) {            // read another subset file in.
    611             log_msg(my_depth, "Reading next subset line in\n\n");
     611            mr_msg(my_depth, "Reading next subset line in\n\n");
    612612            mr_getline(&current_subset_file, &n, faclin);
    613613            continue;
     
    619619        mr_getline(&incoming, &n, pin);
    620620        if (!i) {
    621             log_msg(my_depth, "Copying master %s", q);
     621            mr_msg(my_depth, "Copying master %s", q);
    622622        }
    623623//      if (!i) { printf("Match --- %s\n", q); }
     
    661661        return (set_EXAT_list(masklist, fattr_fname, "setfattr"));
    662662    } else {
    663         log_msg(1, "ERROR: set_EXAT_list: setfattr doesn't exist");
     663        mr_msg(1, "ERROR: set_EXAT_list: setfattr doesn't exist");
    664664        return(0);
    665665    }
     
    673673        return (set_EXAT_list(masklist, acl_fname, "setfacl"));
    674674    } else {
    675         log_msg(1, "ERROR: set_EXAT_list: setfacl doesn't exist");
     675        mr_msg(1, "ERROR: set_EXAT_list: setfacl doesn't exist");
    676676        return(0);
    677677    }
     
    748748    char_to_add = string_to_add[0];
    749749    if (node->right != NULL && node->ch < char_to_add) {
    750         log_msg(7, "depth=%d --- going RIGHT ... %c-->%c", depth,
     750        mr_msg(7, "depth=%d --- going RIGHT ... %c-->%c", depth,
    751751                char_to_add, node->ch, (node->right)->ch);
    752752        return (add_string_at_node(node->right, string_to_add));
     
    754754    // walk down tree if appropriate
    755755    if (node->down != NULL && node->ch == char_to_add) {
    756         log_msg(7, "depth=%d char=%c --- going DOWN", depth, char_to_add);
     756        mr_msg(7, "depth=%d char=%c --- going DOWN", depth, char_to_add);
    757757        depth++;
    758758        res = add_string_at_node(node->down, string_to_add + 1);
     
    762762
    763763    if (char_to_add == '\0' && node->ch == '\0') {
    764         log_msg(6, "%s already in tree", original_string);
     764        mr_msg(6, "%s already in tree", original_string);
    765765        return (1);
    766766    }
     
    769769    if (char_to_add < node->ch) // add to the left of node
    770770    {
    771         log_msg(7, "depth=%d char=%c --- adding (left)", depth,
     771        mr_msg(7, "depth=%d char=%c --- adding (left)", depth,
    772772                char_to_add);
    773773        memcpy((void *) newnode, (void *) node, sizeof(struct s_node));
     
    775775    } else if (char_to_add > node->ch)  // add to the right of node
    776776    {
    777         log_msg(7, "depth=%d char=%c --- adding (right)", depth,
     777        mr_msg(7, "depth=%d char=%c --- adding (right)", depth,
    778778                char_to_add);
    779779        newnode->right = node->right;   // newnode is to the RIGHT of node
     
    786786    node->expanded = node->selected = FALSE;
    787787    if (char_to_add == '\0') {
    788         log_msg(6, "Added %s OK", original_string);
     788        mr_msg(6, "Added %s OK", original_string);
    789789        return (0);
    790790    }
    791791    // add the rest
    792     log_msg(6, "Adding remaining chars ('%s')", string_to_add + 1);
     792    mr_msg(6, "Adding remaining chars ('%s')", string_to_add + 1);
    793793    for (i = 1; i < noof_chars; i++) {
    794794        node->down = (struct s_node *) mr_malloc(sizeof(struct s_node));
    795795        node = node->down;
    796796        char_to_add = string_to_add[i];
    797         log_msg(6, "Adding '%c'", char_to_add);
     797        mr_msg(6, "Adding '%c'", char_to_add);
    798798        node->ch = char_to_add;
    799799        node->right = node->down = NULL;
     
    803803        }
    804804    }
    805     log_msg(6, "Finally - added %s OK", original_string);
     805    mr_msg(6, "Finally - added %s OK", original_string);
    806806    return (0);
    807807}
     
    838838    mr_asprintf(&command_to_open_fname, "gzip -dc %s", filelist_fname);
    839839    mr_asprintf(&tmp, "zcat %s | wc -l", filelist_fname);
    840     log_msg(6, "tmp = %s", tmp);
     840    mr_msg(6, "tmp = %s", tmp);
    841841    tmp1 = call_program_and_get_last_line_of_output(tmp);
    842842    mr_free(tmp);
     
    907907
    908908    if (depth == 0) {
    909         log_msg(0, "----------------show filelist--------------");
     909        mr_msg(0, "----------------show filelist--------------");
    910910    }
    911911    current_string[depth] = node->ch;
    912912
    913     log_msg(3, "depth=%d", depth);
     913    mr_msg(3, "depth=%d", depth);
    914914    if (node->down) {
    915         log_msg(3, "moving down");
     915        mr_msg(3, "moving down");
    916916        depth++;
    917917        show_filelist(node->down);
     
    920920
    921921    if (!node->ch) {
    922         log_msg(0, "%s\n", current_string);
     922        mr_msg(0, "%s\n", current_string);
    923923    }
    924924
    925925    if (node->right) {
    926         log_msg(3, "moving right");
     926        mr_msg(3, "moving right");
    927927        show_filelist(node->right);
    928928    }
    929929    if (depth == 0) {
    930         log_msg(0, "----------------show filelist--------------");
     930        mr_msg(0, "----------------show filelist--------------");
    931931    }
    932932    return;
     
    986986    for (node = filelist; node != NULL; node = node->right) {
    987987        str[depth] = node->ch;
    988         log_msg(5, "depth=%d ch=%c", depth, node->ch);
     988        mr_msg(5, "depth=%d ch=%c", depth, node->ch);
    989989        if (!node->ch) {
    990990//    if (node->selected)
     
    13401340#endif
    13411341        mr_free(find_excludes);
    1342         log_msg(5, "find command = %s", strtmp);
     1342        mr_msg(5, "find command = %s", strtmp);
    13431343        system(strtmp);
    13441344        mr_free(strtmp);
     
    13561356        find_skeleton_marker[0] = '\0';
    13571357        skeleton_lino = 1;
    1358         log_msg(5, "entries = %ld", g_skeleton_entries);
     1358        mr_msg(5, "entries = %ld", g_skeleton_entries);
    13591359        percentage = 0;
    13601360    } else if (depth <= MAX_SKEL_DEPTH) // update evalcall form if appropriate
     
    13631363                "grep -Fv \"%s\" %s > %s.new 2> /dev/null", dir,
    13641364                skeleton_filelist, skeleton_filelist);
    1365 //    log_msg(0, "fsm = %s", find_skeleton_marker);
     1365//    mr_msg(0, "fsm = %s", find_skeleton_marker);
    13661366        if (!system(find_skeleton_marker)) {
    13671367            percentage = (int) (skeleton_lino * 100 / g_skeleton_entries);
    13681368            skeleton_lino++;
    1369 //        log_msg(5, "Found %s", dir);
    1370 //        log_msg(2, "Incrementing skeleton_lino; now %ld/%ld (%d%%)", skeleton_lino, g_skeleton_entries, percentage);
     1369//        mr_msg(5, "Found %s", dir);
     1370//        mr_msg(2, "Incrementing skeleton_lino; now %ld/%ld (%d%%)", skeleton_lino, g_skeleton_entries, percentage);
    13711371            sprintf(find_skeleton_marker, "mv -f %s.new %s",
    13721372                    skeleton_filelist, skeleton_filelist);
    1373 //        log_msg(6, "fsm = %s", find_skeleton_marker);
     1373//        mr_msg(6, "fsm = %s", find_skeleton_marker);
    13741374            run_program_and_log_output(find_skeleton_marker, 8);
    13751375            time(&this_time);
     
    13901390    depth++;
    13911391
    1392 //  log_msg(0, "Cataloguing %s", dir);
     1392//  mr_msg(0, "Cataloguing %s", dir);
    13931393    if (sth[0] == ' ') {
    13941394        mr_asprintf(&skip_these, "%s", sth);
     
    14661466        mr_free(find_skeleton_marker);
    14671467        unlink(skeleton_filelist);
    1468         log_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries);
     1468        mr_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries);
    14691469    }
    14701470    return (0);
     
    15651565        mr_free(tmp);
    15661566    } else if (lstat(sz_datefile, &statbuf)) {
    1567         log_msg(2,
     1567        mr_msg(2,
    15681568                "Warning - unable to find date of previous backup. Full backup instead.");
    15691569        differential = 0;
     
    15711571    } else {
    15721572        time_of_last_full_backup = statbuf.st_mtime;
    1573         log_msg(2, "Differential backup. Yay.");
     1573        mr_msg(2, "Differential backup. Yay.");
    15741574    }
    15751575    mr_free(sz_datefile);
     
    15771577// use user-specified filelist (if specified)
    15781578    if (userdef_filelist) {
    1579         log_msg(1,
     1579        mr_msg(1,
    15801580                "Using the user-specified filelist - %s - instead of calculating one",
    15811581                userdef_filelist);
     
    15861586        mr_free(command);
    15871587    } else {
    1588         log_msg(2, "include_paths = '%s'", include_paths);
    1589         log_msg(1, "Calculating filelist");
     1588        mr_msg(2, "include_paths = '%s'", include_paths);
     1589        mr_msg(1, "Calculating filelist");
    15901590        tmp = call_program_and_get_last_line_of_output("locate /win386.swp 2> /dev/null");
    15911591        tmp1 = call_program_and_get_last_line_of_output("locate /hiberfil.sys 2> /dev/null");
     
    15981598        mr_free(tmp2);
    15991599
    1600         log_msg(2, "Excluding paths = '%s'", exclude_paths);
    1601         log_msg(2,
     1600        mr_msg(2, "Excluding paths = '%s'", exclude_paths);
     1601        mr_msg(2,
    16021602                "Generating skeleton filelist so that we can track our progress");
    16031603        mr_asprintf(&skeleton_filelist, "%s/tmpfs/skeleton.txt", tmpdir);
    16041604        make_hole_for_file(skeleton_filelist);
    16051605
    1606         log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
    1607         log_msg(2, "Opening out filelist to %s", sz_filelist);
     1606        mr_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
     1607        mr_msg(2, "Opening out filelist to %s", sz_filelist);
    16081608        if (!(fout = fopen(sz_filelist, "w"))) {
    16091609            fatal_error("Cannot openout to sz_filelist");
     
    16111611        i = 0;
    16121612        if (strlen(include_paths) == 0) {
    1613             log_msg(1, "Including only '/' in %s", sz_filelist);
     1613            mr_msg(1, "Including only '/' in %s", sz_filelist);
    16141614            open_and_list_dir("/", exclude_paths, fout,
    16151615                              time_of_last_full_backup, skeleton_filelist);
     
    16181618            while (*p) {
    16191619                q = next_entry(p);
    1620                 log_msg(1, "Including %s in filelist %s", q, sz_filelist);
     1620                mr_msg(1, "Including %s in filelist %s", q, sz_filelist);
    16211621                open_and_list_dir(q, exclude_paths, fout,
    16221622                                  time_of_last_full_backup,
     
    16321632        mr_free(exclude_paths);
    16331633    }
    1634     log_msg(2, "Copying new filelist to scratchdir");
     1634    mr_msg(2, "Copying new filelist to scratchdir");
    16351635    mr_asprintf(&command, "mkdir -p %s/archives", scratchdir);
    16361636    paranoid_system(command);
     
    16461646    mr_free(sz_filelist);
    16471647
    1648     log_msg(2, "Exiting");
     1648    mr_msg(2, "Exiting");
    16491649    return (0);
    16501650}
     
    16831683    noof_chars = strlen(string_to_find) + 1;    /* we include the '\0' */
    16841684
    1685     log_msg(7, "starting --- str=%s", string_to_find);
     1685    mr_msg(7, "starting --- str=%s", string_to_find);
    16861686
    16871687/* walk across tree if necessary */
     
    16891689    char_to_find = string_to_find[0];
    16901690    if (node->right != NULL && node->ch < char_to_find) {
    1691         log_msg(7, "depth=%d --- going RIGHT ... %c-->%c", depth,
     1691        mr_msg(7, "depth=%d --- going RIGHT ... %c-->%c", depth,
    16921692                char_to_find, node->ch, (node->right)->ch);
    16931693        return (find_string_at_node(node->right, string_to_find));
     
    16961696/* walk down tree if appropriate */
    16971697    if (node->down != NULL && node->ch == char_to_find) {
    1698         log_msg(7, "depth=%d char=%c --- going DOWN", depth, char_to_find);
     1698        mr_msg(7, "depth=%d char=%c --- going DOWN", depth, char_to_find);
    16991699        depth++;
    17001700        node = find_string_at_node(node->down, string_to_find + 1);
     
    17041704
    17051705    if (char_to_find == '\0' && node->ch == '\0') {
    1706         log_msg(7, "%s is in tree", original_string);
     1706        mr_msg(7, "%s is in tree", original_string);
    17071707        return (node);
    17081708    } else {
    1709         log_msg(7, "%s is NOT in tree", original_string);
     1709        mr_msg(7, "%s is NOT in tree", original_string);
    17101710        return (NULL);
    17111711    }
     
    17341734    size_t len = 0;             // Scrub's patch doesn't work without that
    17351735
    1736 //  log_msg(1, "use_star = %s", (use_star)?"TRUE":"FALSE");
    1737     log_msg(5, "starting");
    1738     log_msg(5, "needles_list_fname = %s", needles_list_fname);
    1739     log_msg(5, "matches_list_fname = %s", matches_list_fname);
     1736//  mr_msg(1, "use_star = %s", (use_star)?"TRUE":"FALSE");
     1737    mr_msg(5, "starting");
     1738    mr_msg(5, "needles_list_fname = %s", needles_list_fname);
     1739    mr_msg(5, "matches_list_fname = %s", matches_list_fname);
    17401740    if (!(fin = fopen(needles_list_fname, "r"))) {
    17411741        fatal_error("Cannot openin needles_list_fname");
     
    17591759        }
    17601760
    1761         log_msg(5, "Looking for '%s'", fname);
     1761        mr_msg(5, "Looking for '%s'", fname);
    17621762        found_node = find_string_at_node(filelist, fname);
    17631763        if (found_node) {
     
    17681768                    fname = tmp;
    17691769                }
    1770                 log_msg(5, "Found '%s'", fname);
     1770                mr_msg(5, "Found '%s'", fname);
    17711771                turn_wildcard_chars_into_literal_chars(tmp, fname);
    17721772                fprintf(fout, "%s\n", tmp);
     
    17991799    struct s_node *nod;
    18001800
    1801     log_msg(3, "Adding %s to filelist", list_of_files_fname);
     1801    mr_msg(3, "Adding %s to filelist", list_of_files_fname);
    18021802    if (!(fin = fopen(list_of_files_fname, "r"))) {
    18031803        iamhere(list_of_files_fname);
     
    18121812            tmp[strlen(tmp) - 1] = '\0';
    18131813        }
    1814         log_msg(2, "tmp = '%s'", tmp);
     1814        mr_msg(2, "tmp = '%s'", tmp);
    18151815        if (!tmp[0]) {
    18161816            continue;
    18171817        }
    18181818        if ((nod = find_string_at_node(filelist, tmp))) {
    1819             log_msg(5, "Found '%s' in filelist already. Cool.", tmp);
     1819            mr_msg(5, "Found '%s' in filelist already. Cool.", tmp);
    18201820        } else {
    18211821            add_string_at_node(filelist, tmp);
     
    18251825        if (nod && flag_em) {
    18261826            toggle_path_selection(filelist, tmp, TRUE);
    1827             log_msg(5, "Flagged '%s'", tmp);
     1827            mr_msg(5, "Flagged '%s'", tmp);
    18281828        }
    18291829    }
Note: See TracChangeset for help on using the changeset viewer.