Changeset 2230


Ignore:
Timestamp:
Jun 17, 2009, 10:53:23 PM (10 years ago)
Author:
bruno
Message:
  • Simplify log_it calls when possible (with just a fixed string)
  • issue with truncate_to_drive_name reported by valgrind at restore time. Needs rewrite IMO
Location:
branches/2.2.9/mondo/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-archive.c

    r2227 r2230  
    14751475                    maintain_collection_of_recent_archives(bkpinfo->tmpdir,
    14761476                                                       storing_afioball_fname);
    1477                     log_it("%s","Writing EXAT files");
     1477                    log_it("Writing EXAT files");
    14781478                    res +=
    14791479                        write_EXAT_files_to_tape(curr_xattr_list_fname,
     
    19991999    log_msg(1, "--> tmp = '%s'", tmp);
    20002000    if (strstr(tmp, "NTFS")) {
    2001         log_it("%s","TRUE");
     2001        log_it("TRUE");
    20022002        ret = TRUE;
    20032003    } else {
    2004         log_it("%s","FALSE");
     2004        log_it("FALSE");
    20052005        ret = FALSE;
    20062006    }
     
    22712271            register_in_tape_catalog(fileset, curr_set_no, -1, curr_afioball_fname);
    22722272            maintain_collection_of_recent_archives(bkpinfo->tmpdir, curr_afioball_fname);
    2273             log_it("%s","Writing EXAT files");
     2273            log_it("Writing EXAT files");
    22742274            res +=
    22752275                write_EXAT_files_to_tape(curr_xattr_list_fname,
     
    34503450                 media_descriptor_string(g_backup_media_type));
    34513451            chdir("/");
    3452             log_it("%s","Before calling verification of image()");
     3452            log_it("Before calling verification of image()");
    34533453            if (bkpinfo->backup_media_type == usb) {
    34543454                res += verify_usb_image();
     
    34563456                res += verify_cd_image();
    34573457            }
    3458             log_it("%s","After calling verification of image()");
     3458            log_it("After calling verification of image()");
    34593459        }
    34603460        if (!res) {
  • branches/2.2.9/mondo/src/common/libmondo-filelist.c

    r2227 r2230  
    592592    pout = popen(syscall_pout, "w");
    593593    if (!pout) {
    594         log_it("%s","Unable to openout to syscall_pout");
     594        log_it("Unable to openout to syscall_pout");
    595595        return (1);
    596596    }
     
    598598    if (!pin) {
    599599        pclose(pout);
    600         log_it("%s","Unable to openin from syscall");
     600        log_it("Unable to openin from syscall");
    601601        return (1);
    602602    }
     
    605605        pclose(pin);
    606606        pclose(pout);
    607         log_it("%s","Unable to openin masklist");
     607        log_it("Unable to openin masklist");
    608608        return (1);
    609609    }
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2219 r2230  
    652652    /*@ buffers ********************************************************* */
    653653    char *drive = NULL;
     654    char *truncdrive = NULL;
    654655
    655656    long long size;
     
    676677        log_msg(8, "Putting %s with size %lli in list of drives", drive, size);
    677678
    678         (void) truncate_to_drive_name(drive);
    679         log_msg(8, "drive truncated to %s", drive);
     679        truncdrive = truncate_to_drive_name(drive);
     680        log_msg(8, "drive truncated to %s", truncdrive);
    680681
    681682        for (j = 0;
    682683             j < noof_drives
    683              && strcmp(drivelist->el[j].device, drive) != 0; j++) {
     684             && strcmp(drivelist->el[j].device, truncdrive) != 0; j++) {
    684685            continue;
    685686        }
    686687        if (j == noof_drives) {
    687             strncpy(drivelist->el[noof_drives++].device, drive, 63);
     688            strcpy(drivelist->el[noof_drives++].device, truncdrive);
    688689        }
    689690        paranoid_free(drive);
     691        paranoid_free(truncdrive);
    690692    }
    691693    drivelist->entries = noof_drives;
  • branches/2.2.9/mondo/src/common/libmondo-stream.c

    r2229 r2230  
    555555    last = g_tapecatalog->entries - 1;
    556556    if (last <= 0) {
    557         log_it("%s","Too early to start deleting from collection.");
     557        log_it("Too early to start deleting from collection.");
    558558        return (0);
    559559    }
     
    568568    }
    569569    if (curr < 0) {
    570         log_it("%s","Not far enough into tape to start deleting old archives from collection.");
     570        log_it("Not far enough into tape to start deleting old archives from collection.");
    571571        return (0);
    572572    }
     
    17161716                   g_tape_stream) / 1024;
    17171717        if (g_sigpipe) {
    1718             log_it("%s","Sigpipe occurred recently. I'll start a new tape.");
     1718            log_it("Sigpipe occurred recently. I'll start a new tape.");
    17191719            fclose(fin);
    17201720            g_sigpipe = FALSE;
  • branches/2.2.9/mondo/src/common/libmondo-string.c

    r2211 r2230  
    841841    int i = strlen(partition) - 1;
    842842    char *c;
     843    char *trunc = NULL;
     844
     845    mr_asprintf(&trunc, "%s", partition);
    843846
    844847#ifdef __FreeBSD__
    845848
    846     if (islower(partition[i]))  // BSD subpartition
     849    if (islower(trunc[i]))  // BSD subpartition
    847850        i--;
    848     if (partition[i - 1] == 's') {
    849         while (isdigit(partition[i]))
     851    if (trunc[i-1] == 's') {
     852        while (isdigit(trunc[i]))
    850853            i--;
    851854        i--;
    852855    }
    853     partition[i + 1] = '\0';
     856    trunc[i+1] = '\0';
    854857
    855858#else
     
    857860    assert_string_is_neither_NULL_nor_zerolength(partition);
    858861    /* first see if it's a devfs style device */
    859     c = strrchr(partition, '/');
     862    c = strrchr(trunc, '/');
    860863    if (c && strncmp(c, "/part", 5) == 0) {
    861864        /* yup it's devfs, return the "disc" path */
    862865        strcpy(c + 1, "disc");
    863         return partition;
     866        return trunc;
    864867    }
    865868    /* then see if it's a dm style device */
    866869    if (c && strncmp(c, "/dm-", 4) == 0) {
    867870        /* yup it's dm, return the full path */
    868         return partition;
    869     }
    870 
    871 
    872     for (i = strlen(partition); isdigit(partition[i - 1]); i--)
     871        return trunc;
     872    }
     873
     874
     875    for (i = strlen(trunc); isdigit(trunc[i-1]); i--)
    873876        continue;
    874     if (partition[i - 1] == 'p' && isdigit(partition[i - 2])) {
     877    if (trunc[i-1] == 'p' && isdigit(trunc[i-2])) {
    875878        i--;
    876879    } else {
    877880        /* Some full devices like this /dev/mapper/mpath0
    878881           /dev/cciss/c0d0 may be used as partition names */
    879         if ((strstr(partition,"/dev/mapper/mpath") != NULL) ||
    880             (strstr(partition,"/dev/cciss/c") != NULL) ||
    881             (strstr(partition,"/dev/rd/") != NULL)) {
    882                 return partition;
     882        if ((strstr(trunc,"/dev/mapper/mpath") != NULL) ||
     883            (strstr(trunc,"/dev/cciss/c") != NULL) ||
     884            (strstr(trunc,"/dev/rd/") != NULL)) {
     885                return trunc;
    883886            }
    884887    }
    885     partition[i] = '\0';
     888    trunc[i] = '\0';
    886889
    887890#endif
    888891
    889     return partition;
     892    return trunc;
    890893}
    891894
  • branches/2.2.9/mondo/src/common/libmondo-tools.c

    r2226 r2230  
    13451345
    13461346    if (debug_level <= g_loglevel) {
    1347         va_start(args, fmt);
    13481347        if (!(fout = fopen(MONDO_LOGFILE, "a"))) {
    13491348            return;
     
    13611360                fprintf(fout, "[TH=%d] %s->%s#%d: ", getpid(), szFile, szFunction, nLine);
    13621361        }
     1362        va_start(args, fmt);
    13631363        vfprintf(fout, fmt, args);
     1364        va_end(args);
    13641365
    13651366        // do not slow down the progran if standard debug level
     
    13681369        //if (g_dwDebugLevel != 1)
    13691370
    1370         va_end(args);
    13711371        fprintf(fout, "\n");
    13721372        paranoid_fclose(fout);
  • branches/2.2.9/mondo/src/common/libmondo-verify.c

    r2227 r2230  
    281281    }
    282282
    283     log_it("%s","before vsbf");
     283    log_it("before vsbf");
    284284    sprintf(tmp, "Verifying %s#%d's big files",
    285285            media_descriptor_string(bkpinfo->backup_media_type),
    286286            g_current_media_number);
    287287    open_evalcall_form(tmp);
    288     log_it("%s","after vsbf");
     288    log_it("after vsbf");
    289289    sprintf(mountpoint, "%s/archives", mtpt);
    290290    if (last_bigfile_num == -1) {
     
    780780    res = read_header_block_from_stream(&size, fname, &ctrl_chr);
    781781    if (ctrl_chr != BLK_START_AFIOBALLS) {
    782         log_it("%s","YOU SHOULD NOT GET HERE");
    783         log_it("%s","Grabbing the EXAT files");
     782        log_it("YOU SHOULD NOT GET HERE");
     783        log_it("Grabbing the EXAT files");
    784784        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    785785            res =
     
    805805        }
    806806        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    807             log_it("%s","Reading EXAT files from tape");
     807            log_it("Reading EXAT files from tape");
    808808            res =
    809809                read_EXAT_files_from_tape(&size, fname, &ctrl_chr,
     
    895895    if (ctrl_chr != BLK_START_BIGGIEFILES) {
    896896        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    897             log_it("%s","Grabbing the EXAT biggiefiles");
     897            log_it("Grabbing the EXAT biggiefiles");
    898898            res =
    899899                read_EXAT_files_from_tape(&size, orig_fname,
     
    10191019    paranoid_free(tmp);
    10201020    verify_afioballs_on_CD(mountpoint);
    1021     log_it("%s","before verify_all_slices");
     1021    log_it("before verify_all_slices");
    10221022    verify_all_slices_on_CD(mountpoint);
    10231023
     
    11411141    }
    11421142    verify_afioballs_on_CD(mountpoint);
    1143     log_it("%s","before verify_all_slices");
     1143    log_it("before verify_all_slices");
    11441144    verify_all_slices_on_CD(mountpoint);
    11451145
  • branches/2.2.9/mondo/src/common/newt-specific.c

    r2227 r2230  
    14001400        assert_string_is_neither_NULL_nor_zerolength(source_file);
    14011401
    1402         log_it("%s","entering");
     1402        log_it("entering");
    14031403        if (!(fin = fopen(source_file, "r"))) {
    14041404            log_OS_error(source_file);
     
    14831483        }
    14841484        paranoid_free(tmp);
    1485         log_it("%s","leaving");
     1485        log_it("leaving");
    14861486        return (0);
    14871487    }
     
    14991499        char *tmp = NULL;
    15001500
    1501         log_it("%s","entering");
     1501        log_it("entering");
    15021502        assert(flentry != NULL);
    15031503        if (flentry->severity == 0) {
     
    15151515        paranoid_free(tmp);
    15161516
    1517         log_it("%s","leaving");
     1517        log_it("leaving");
    15181518        return (comment);
    15191519    }
  • branches/2.2.9/mondo/src/mondorestore/mondo-prep.c

    r2227 r2230  
    240240
    241241//  do_this_last[0] = '\0';
    242     log_it("%s","STARTING");
     242    log_it("STARTING");
    243243    log_msg(1, "OK, opened i-want-my-lvm. Shutting down LVM volumes...");
    244244    if (find_home_of_exe("lvm"))    // found it :) cool
     
    417417    system("sync");
    418418    sleep(1);
    419     log_it("%s","ENDING");
     419    log_it("ENDING");
    420420    if (retval > 2) {
    421421        log_msg(1, "%d errors. I'm reporting this.", retval);
     
    16131613            system("sync");
    16141614#else
    1615             log_it("%s","New, kernel-friendly partition remover");
     1615            log_it("New, kernel-friendly partition remover");
    16161616            for (i = 20; i > 0; i--) {
    16171617                fprintf(pout_to_fdisk, "d\n%d\n", i);
     
    25912591        log_it("--- Hugo, 2002/11/20");
    25922592    }
    2593     log_it("%s","Resizing mountlist");
     2593    log_it("Resizing mountlist");
    25942594    make_list_of_drives_in_mountlist(mountlist, drivelist);
    2595     log_it("%s","Back from MLoDiM");
     2595    log_it("Back from MLoDiM");
    25962596    for (driveno = 0; driveno < drivelist->entries; driveno++) {
    25972597        resize_drive_proportionately_to_suit_new_drives(mountlist,
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-compare.c

    r2227 r2230  
    576576
    577577    /* edit_mountlist if wanted */
    578     log_it("%s","About to edit mountlist");
     578    log_it("About to edit mountlist");
    579579    if (g_text_mode) {
    580580        save_mountlist_to_disk(mountlist, g_mountlist_fname);
     
    585585        res = edit_mountlist(g_mountlist_fname, mountlist, raidlist);
    586586    }
    587     log_it("%s","Finished editing mountlist");
     587    log_it("Finished editing mountlist");
    588588    if (res) {
    589589        paranoid_MR_finish(1);
     
    594594    g_current_media_number = 1;
    595595    mvaddstr_and_log_it(1, 30, "Comparing Automatically");
    596     log_it("%s","Pre-MAD");
     596    log_it("Pre-MAD");
    597597    retval = mount_all_devices(mountlist, FALSE);
    598     log_it("%s","Post-MAD");
     598    log_it("Post-MAD");
    599599    if (retval) {
    600600        unmount_all_devices(mountlist);
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.c

    r2227 r2230  
    20672067    int res = 0;
    20682068
    2069     log_it("%s","entering eml");
     2069    log_it("entering eml");
    20702070
    20712071    if (g_text_mode) {
     
    20762076        res = edit_mountlist_in_newt(mountlist_fname, mountlist, raidlist);
    20772077    }
    2078     log_it("%s","leaving eml");
     2078    log_it("leaving eml");
    20792079    return (res);
    20802080}
     
    27322732    assert(disklist != NULL);
    27332733
    2734     log_it("%s","malloc'ing");
     2734    log_it("malloc'ing");
    27352735    malloc_string(tmp);
    27362736    malloc_string(help_text);
     
    27602760           sizeof(struct list_of_disks));
    27612761
    2762     log_it("%s","Post-malloc");
     2762    log_it("Post-malloc");
    27632763    strcpy(help_text,
    27642764           "   Edit this RAID device's list of partitions. Choose OK or Cancel when done.");
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-tools.c

    r2227 r2230  
    24192419
    24202420    assert(wait_for_percentage <= 100);
    2421     log_it("%s","wait_until_software_raids_are_prepped");
     2421    log_it("wait_until_software_raids_are_prepped");
    24222422    while (unfinished_mdstat_devices > 0) {
    24232423            // FIXME: Prefix '/dev/' should really be dynamic!
  • branches/2.2.9/mondo/src/mondorestore/mondorestore.c

    r2229 r2230  
    262262    int retval = 0;
    263263
    264     log_it("%s","inside catchall");
     264    log_it("inside catchall");
    265265    assert(bkpinfo != NULL);
    266266    assert(mountlist != NULL);
    267267    assert(raidlist != NULL);
    268268    malloc_string(tmp);
    269     log_it("%s","pre wrm");
     269    log_it("pre wrm");
    270270    c = which_restore_mode();
    271     log_it("%s","post wrm");
     271    log_it("post wrm");
    272272    if (c == 'I' || c == 'C') {
    273273        interactively_obtain_media_parameters_from_user(FALSE);
     
    286286    }
    287287
    288     log_it("%s","post int");
     288    log_it("post int");
    289289
    290290    if (bkpinfo->backup_media_type == iso) {
     
    465465    }
    466466
    467     log_it("%s","About to load config file");
     467    log_it("About to load config file");
    468468    get_cfg_file_from_archive_or_bust();
    469469    read_cfg_file_into_bkpinfo(g_mondo_cfg_file);
    470     log_it("%s","Done loading config file; resizing ML");
     470    log_it("Done loading config file; resizing ML");
    471471    if (bkpinfo->backup_media_type == nfs) {
    472472        strcpy(tmp, bkpinfo->prefix);
     
    493493    }
    494494    for (done = FALSE; !done;) {
    495         log_it("%s","About to edit mountlist");
     495        log_it("About to edit mountlist");
    496496        if (g_text_mode) {
    497497            save_mountlist_to_disk(mountlist, g_mountlist_fname);
     
    502502            res = edit_mountlist(g_mountlist_fname, mountlist, raidlist);
    503503        }
    504         log_it("%s","Finished editing mountlist");
     504        log_it("Finished editing mountlist");
    505505        if (res) {
    506506            paranoid_MR_finish(1);
     
    681681    }
    682682
    683     log_it("%s","About to leave interactive_mode()");
     683    log_it("About to leave interactive_mode()");
    684684    if (retval) {
    685685        mvaddstr_and_log_it(g_currentY++,
     
    691691    paranoid_free(fstab_fname);
    692692    paranoid_free(old_restpath);
    693     log_it("%s","Leaving interactive_mode()");
     693    log_it("Leaving interactive_mode()");
    694694    return (retval);
    695695}
     
    885885        return (retval);
    886886    }
    887     log_it("%s","Restoring everything");
     887    log_it("Restoring everything");
    888888    retval += restore_everything(NULL);
    889889    clean_multipathconf();
     
    10061006                                 "Restore files to where? )",
    10071007                                 bkpinfo->restore_path, MAX_STR_LEN / 4)) {
    1008             log_it("%s","Restoring everything");
     1008            log_it("Restoring everything");
    10091009            retval += restore_everything(filelist);
    10101010            free_filelist(filelist);
     
    20352035
    20362036        if (g_getfattr) {
    2037             log_it("%s","Restoring xattr stuff");
     2037            log_it("Restoring xattr stuff");
    20382038            res = set_fattr_list(filelist_subset_fname, xattr_fname);
    20392039            if (res) {
     
    20462046
    20472047        if (g_getfacl) {
    2048             log_it("%s","Restoring acl stuff");
     2048            log_it("Restoring acl stuff");
    20492049            res = set_acl_list(filelist_subset_fname, acl_fname);
    20502050            if (res) {
     
    25052505        fclose(fbw);
    25062506        if (length_of_file(biggies_whose_EXATs_we_should_set) > 2) {
    2507             log_it("%s","Setting biggie-EXATs");
     2507            log_it("Setting biggie-EXATs");
    25082508            if (g_getfattr) {
    25092509                if (length_of_file(xattr_fname) > 0) {
     
    25222522            }
    25232523        } else {
    2524             log_it("%s","No biggiefiles selected. So, no biggie-EXATs to set.");
     2524            log_it("No biggiefiles selected. So, no biggie-EXATs to set.");
    25252525        }
    25262526    }
     
    26302630        }
    26312631        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    2632             log_it("%s","Reading EXAT files from tape");
     2632            log_it("Reading EXAT files from tape");
    26332633            res =
    26342634                read_EXAT_files_from_tape(&tmp_size, tmp_fname,
     
    29442944    }
    29452945
    2946     log_it("%s","what time is it");
     2946    log_it("what time is it");
    29472947
    29482948    /* Process command-line parameters */
     
    31273127        log_msg(2, "FYI, MOUNTLIST_FNAME = %s ", g_mountlist_fname);
    31283128
    3129         log_it("%s","About to call load_mountlist and load_raidtab");
     3129        log_it("About to call load_mountlist and load_raidtab");
    31303130        strcpy(bkpinfo->restore_path, MNT_RESTORING);
    31313131        read_cfg_file_into_bkpinfo(g_mondo_cfg_file);
    31323132        retval = load_mountlist(mountlist, g_mountlist_fname);
    31333133        retval += load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3134         log_it("%s","Returned from calling load_mountlist and load_raidtab successfully");
     3134        log_it("Returned from calling load_mountlist and load_raidtab successfully");
    31353135
    31363136        // BCO:To be reviewed
     
    31563156
    31573157        if (bkpinfo->restore_mode == nuke) {
    3158             log_it("%s","nuking");
     3158            log_it("nuking");
    31593159            retval += nuke_mode(mountlist, raidlist);
    31603160        } else if (bkpinfo->restore_mode == interactive) {
    3161             log_it("%s","catchall");
     3161            log_it("catchall");
    31623162            retval += catchall_mode(mountlist, raidlist);
    31633163        } else if (bkpinfo->restore_mode == compare) {
    3164             log_it("%s","compare");
     3164            log_it("compare");
    31653165            retval += compare_mode(mountlist, raidlist);
    31663166        } else if (bkpinfo->restore_mode == isoonly) {
    3167             log_it("%s","iso");
     3167            log_it("iso");
    31683168            retval = iso_mode(mountlist, raidlist, FALSE);
    31693169        } else if (bkpinfo->restore_mode == mbr) {
    3170             log_it("%s","mbr");
     3170            log_it("mbr");
    31713171            retval = mount_all_devices(mountlist, TRUE);
    31723172            if (!retval) {
     
    31783178            }
    31793179        } else if (bkpinfo->restore_mode == isonuke) {
    3180             log_it("%s","isonuke");
     3180            log_it("isonuke");
    31813181            retval = iso_mode(mountlist, raidlist, TRUE);
    31823182        } else {
    3183             log_it("%s","catchall (no mode specified in command-line call");
     3183            log_it("catchall (no mode specified in command-line call");
    31843184            retval += catchall_mode(mountlist, raidlist);
    31853185        }
Note: See TracChangeset for help on using the changeset viewer.