Changeset 3340


Ignore:
Timestamp:
Feb 12, 2015, 7:38:20 PM (4 years ago)
Author:
bruno
Message:
  • Avoid using size_of_all_biggiefiles() at each use, but creates an intermediate long variable for that.
File:
1 edited

Legend:

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

    r3294 r3340  
    826826    }
    827827
    828     estimated_total_noof_slices = size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
     828    estimated_total_noof_slices = size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1L;
    829829
    830830    /* TODO: add netfs stuff here? */
     
    19241924 * @see slice_up_file_etc
    19251925 */
    1926 int
    1927 make_slices_and_images(char *biggielist_fname)
    1928 {
     1926int make_slices_and_images(char *biggielist_fname) {
    19291927
    19301928    /*@ pointers ******************************************* */
     
    19421940    long noof_biggie_files = 0L;
    19431941    long estimated_total_noof_slices = 0L;
     1942    long size_of_all_biggiefiles = 0L;
    19441943
    19451944    /*@ int ************************************************ */
     
    19551954    assert_string_is_neither_NULL_nor_zerolength(biggielist_fname);
    19561955
    1957     estimated_total_noof_slices = size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1L;
    1958 
    1959     log_msg(1, "size of all biggiefiles = %ld", size_of_all_biggiefiles_K());
    1960     log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, estimated_total_noof_slices);
     1956    size_of_all_biggiefiles = size_of_all_biggiefiles_K();
     1957    estimated_total_noof_slices = size_of_all_biggiefiles / bkpinfo->optimal_set_size + 1L;
     1958
     1959    log_msg(1, "size of all biggiefiles = %ld", size_of_all_biggiefiles);
     1960    log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", size_of_all_biggiefiles, bkpinfo->optimal_set_size, estimated_total_noof_slices);
    19611961
    19621962    if (length_of_file(biggielist_fname) < 6) {
     
    20382038
    20392039            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2040                 write_header_block_to_stream((off_t)0,
    2041                                              calc_checksum_of_file
    2042                                              (bigfile_fname),
    2043                                              BLK_STOP_A_BIGGIE);
     2040                write_header_block_to_stream((off_t)0, calc_checksum_of_file(bigfile_fname), BLK_STOP_A_BIGGIE);
    20442041            }
    20452042            retval += res;
     
    22722269    assert(bkpinfo != NULL);
    22732270    /* slice big files */
    2274     mvaddstr_and_log_it(g_currentY, 0,
    2275                         "Archiving large files to media           ");
     2271    mvaddstr_and_log_it(g_currentY, 0, "Archiving large files to media           ");
    22762272    mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
    22772273    if (g_getfattr) {
     
    23152311    res = make_slices_and_images(biggielist);
    23162312    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2317         write_header_block_to_stream((off_t)0, "end-of-biggiefiles",
    2318                                      BLK_STOP_BIGGIEFILES);
     2313        write_header_block_to_stream((off_t)0, "end-of-biggiefiles", BLK_STOP_BIGGIEFILES);
    23192314    }
    23202315    retval += res;
     
    23872382        mr_asprintf(curr_file, "%s", cf);
    23882383        if (!does_file_exist(curr_file)) {
    2389             log_msg(1,
    2390                     "Warning - you're trying to add a non-existent file - '%s' to the CD",
    2391                     curr_file);
     2384            log_msg(1, "Warning - you're trying to add a non-existent file - '%s' to the CD", curr_file);
    23922385        } else {
    23932386            log_msg(8, "Trying to add file %s to CD", curr_file);
     
    27642757 * @ingroup LLarchiveGroup
    27652758 */
    2766 int
    2767 slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files, bool use_ntfsprog) {
     2759int slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files, bool use_ntfsprog) {
    27682760
    27692761    /*@ buffers ************************************************** */
     
    28482840        mr_getline(checksum_line, fin);
    28492841        pclose(fin);
    2850         totallength = length_of_file (biggie_filename);
     2842        totallength = length_of_file(biggie_filename);
    28512843    }
    28522844    lstat(biggie_filename, &biggiestruct.properties);
     
    28852877    }
    28862878    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2887         res =
    2888             move_files_to_stream(slice_fname(biggie_file_number, 0,
    2889                                              bkpinfo->tmpdir, ""), NULL);
    2890     } else {
    2891         res =
    2892             move_files_to_cd(slice_fname(biggie_file_number, 0,
    2893                                          bkpinfo->tmpdir, ""), NULL);
    2894     }
    2895     i = bkpinfo->optimal_set_size / 256;
     2879        res = move_files_to_stream(slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""), NULL);
     2880    } else {
     2881        res = move_files_to_cd(slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""), NULL);
     2882    }
     2883    i = bkpinfo->optimal_set_size / 256L;
    28962884    if (!(tempblock = (char *) malloc(256 * 1024))) {
    28972885        fatal_error("malloc error 256*1024");
     
    29102898            return (1);
    29112899        }
    2912         if ((i == bkpinfo->optimal_set_size / 256) && (totalread < 1.1 * totallength)) {
    2913             for (i = 0L; i < bkpinfo->optimal_set_size / 256; i++) {
     2900        if ((i == bkpinfo->optimal_set_size / 256L) && (totalread < 1.1 * totallength)) {
     2901            for (long j = 0L; j < bkpinfo->optimal_set_size / 256L; j++) {
    29142902                blksize = fread(tempblock, 1, 256 * 1024, fin);
    29152903                if (blksize > 0) {
Note: See TracChangeset for help on using the changeset viewer.