Changeset 684 in MondoRescue


Ignore:
Timestamp:
Jun 26, 2006, 1:12:48 PM (18 years ago)
Author:
bcornec
Message:

Attempt to fix Bug #7820 Does not backup a file greater than 2 GB
Report from taps23@…
Changed legnth_of_file to off_t for ftello support and all relative changes made as well in various functions to be consistent

Location:
branches/stable/mondo/mondo
Files:
12 edited

Legend:

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

    r681 r684  
    13641364    mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    13651365    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1366         write_header_block_to_stream(0, "start-of-tape",
     1366        write_header_block_to_stream((off_t)0, "start-of-tape",
    13671367                                     BLK_START_OF_TAPE);
    1368         write_header_block_to_stream(0, "start-of-backup",
     1368        write_header_block_to_stream((off_t)0, "start-of-backup",
    13691369                                     BLK_START_OF_BACKUP);
    13701370    }
     
    21752175    bool delete_when_done;
    21762176    bool use_ntfsprog;
    2177     /*@ long long ****************************************** */
    2178     long long biggie_fsize;
     2177    off_t biggie_fsize;
    21792178
    21802179    assert(bkpinfo != NULL);
     
    22742273                                  noof_biggie_files, use_ntfsprog);
    22752274            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2276                 write_header_block_to_stream(0,
     2275                write_header_block_to_stream((off_t)0,
    22772276                                             calc_checksum_of_file
    22782277                                             (bigfile_fname),
     
    24612460
    24622461    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2463         write_header_block_to_stream(0, "start-of-afioballs",
     2462        write_header_block_to_stream((off_t)0, "start-of-afioballs",
    24642463                                     BLK_START_AFIOBALLS);
    24652464#if __FreeBSD__ == 5
     
    24702469        res = make_afioballs_and_images_OLD(bkpinfo);
    24712470#endif
    2472         write_header_block_to_stream(0, "stop-afioballs",
     2471        write_header_block_to_stream((off_t)0, "stop-afioballs",
    24732472                                     BLK_STOP_AFIOBALLS);
    24742473    } else {
     
    25432542        res += write_EXAT_files_to_tape(bkpinfo, xattr_fname, acl_fname);
    25442543        sprintf(blah, "%ld", count_lines_in_file(biggielist));
    2545         write_header_block_to_stream(0, blah, BLK_START_BIGGIEFILES);
     2544        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    25462545    }
    25472546    res = make_slices_and_images(bkpinfo, biggielist);
    25482547    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2549         write_header_block_to_stream(0, "end-of-biggiefiles",
     2548        write_header_block_to_stream((off_t)0, "end-of-biggiefiles",
    25502549                                     BLK_STOP_BIGGIEFILES);
    25512550    }
     
    29312930    char *curr_file, *cf;
    29322931    /*@ long long ****************************************************** */
    2933     long long length_of_incoming_file = 0;
     2932    off_t length_of_incoming_file = (off_t)0;
    29342933    t_archtype type;
    29352934    va_list ap;
     
    29662965        unlink(curr_file);
    29672966/* write closing header */
    2968         write_header_block_to_stream(0, "finished-writing-file", stop_chr);
     2967        write_header_block_to_stream((off_t)0, "finished-writing-file", stop_chr);
    29692968    }
    29702969    va_end(ap);
     
    33063305
    33073306    /*@ long long ************************************************** */
    3308     long long totalread = 0;
    3309     long long totallength = 0;
    3310     long long length;
     3307    off_t totalread = (off_t)0;
     3308    off_t totallength = (off_t)0;
     3309    off_t length;
    33113310
    33123311    /*@ int ******************************************************** */
     
    33603359        strcpy (tmp, call_program_and_get_last_line_of_output(command));
    33613360        log_it("res of it = %s", tmp);
    3362         totallength = atoll(tmp);
     3361        totallength = (off_t)atoll(tmp);
    33633362    } else {
    33643363        file_to_openin = biggie_filename;
  • branches/stable/mondo/mondo/common/libmondo-files-EXT.h

    r128 r684  
    1616extern int grab_percentage_from_last_line_of_file(char *filename);
    1717extern char *last_line_of_file(char *filename);
    18 extern long long length_of_file(char *filename);
     18extern off_t length_of_file(char *filename);
    1919extern int make_checksum_list_file(char *filelist, char *cksumlist,
    2020                                   char *comppath);
  • branches/stable/mondo/mondo/common/libmondo-files.c

    r681 r684  
    596596 * @return The length of the file, or -1 for error.
    597597 */
    598 long long length_of_file(char *filename)
     598off_t length_of_file(char *filename)
    599599{
    600600    /*@ pointers *************************************************** */
     
    602602
    603603    /*@ long long ************************************************* */
    604     long long length;
     604    off_t length;
    605605
    606606    fin = fopen(filename, "r");
     
    611611    }
    612612    fseeko(fin, 0, SEEK_END);
    613     length = ftell(fin);
     613    length = ftello(fin);
    614614    paranoid_fclose(fin);
    615615    return (length);
     
    641641
    642642    /*@ long [long] ************************************************* */
    643     long long filelist_length;
    644     long curr_pos;
     643    off_t filelist_length;
     644    off_t curr_pos;
    645645    long start_time;
    646646    long current_time;
     
    680680            counter = 0;
    681681            curr_fname[37] = '\0';
    682             curr_pos = ftell(fin) / 1024;
     682            curr_pos = ftello(fin) / 1024;
    683683            percentage = (int) (curr_pos * 100 / filelist_length);
    684684            time_taken = current_time - start_time;
     
    921921                }
    922922            } else {
     923                /* BERLIOS: more than long here ??? */
    923924                file_len_K = (long) (length_of_file(fname) / 1024);
    924925            }
  • branches/stable/mondo/mondo/common/libmondo-files.h

    r128 r684  
    1919int grab_percentage_from_last_line_of_file(char *filename);
    2020char *last_line_of_file(char *filename);
    21 long long length_of_file(char *filename);
     21off_t length_of_file(char *filename);
    2222int make_checksum_list_file(char *filelist, char *cksumlist,
    2323                            char *comppath);
  • branches/stable/mondo/mondo/common/libmondo-fork.c

    r541 r684  
    616616//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    617617                fwrite(tmp, 1, bytes_read_in, ftmp);
    618                 sprintf(tmp, "I am here - %ld", ftell(fin));
     618                sprintf(tmp, "I am here - %llu", ftello(fin));
    619619//    log_msg(0, tmp);
    620620                fread(tmp, 1, 512, fin);
  • branches/stable/mondo/mondo/common/libmondo-stream-EXT.h

    r128 r684  
    2626                                    char *fn);
    2727extern bool should_we_write_to_next_tape(long mediasize,
    28                                          long long
     28                                         off_t
    2929                                         length_of_incoming_file);
    3030extern int skip_incoming_files_until_we_find_this_one(char
     
    3636extern int write_file_to_stream_from_file(struct s_bkpinfo *bkpinfo,
    3737                                          char *infile);
    38 extern int write_header_block_to_stream(long long length_of_incoming_file,
     38extern int write_header_block_to_stream(off_t length_of_incoming_file,
    3939                                        char *filename, int control_char);
    4040extern void wrong_marker(int should_be, int it_is);
  • branches/stable/mondo/mondo/common/libmondo-stream.c

    r541 r684  
    259259    log_it("closeout_tape() -- entering");
    260260    retval +=
    261         write_header_block_to_stream(0, "end-of-backup",
     261        write_header_block_to_stream((off_t)0, "end-of-backup",
    262262                                     BLK_END_OF_BACKUP);
    263     retval += write_header_block_to_stream(0, "end-of-tape", BLK_END_OF_TAPE);  /* just in case */
     263    retval += write_header_block_to_stream((off_t)0, "end-of-tape", BLK_END_OF_TAPE);   /* just in case */
    264264/* write 1MB of crap */
    265265    for (i = 0; i < 256 * 1024; i++) {
     
    269269        (void) fwrite(blk, 1, 256 * 1024, g_tape_stream);
    270270        if (should_we_write_to_next_tape
    271             (bkpinfo->media_size[g_current_media_number], 256 * 1024)) {
     271            (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) {
    272272            start_to_write_to_next_tape(bkpinfo);
    273273        }
     
    490490                                 BLK_START_EXAT_FILE);
    491491    write_file_to_stream_from_file(bkpinfo, xattr_fname);
    492     write_header_block_to_stream(-1, xattr_fname, BLK_STOP_EXAT_FILE);
     492    write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
    493493// acl
    494494    write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    495495                                 BLK_START_EXAT_FILE);
    496496    write_file_to_stream_from_file(bkpinfo, acl_fname);
    497     write_header_block_to_stream(-1, acl_fname, BLK_STOP_EXAT_FILE);
     497    write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    498498    write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    499499                                 BLK_STOP_EXTENDED_ATTRIBUTES);
     
    11961196 * autodetecting the size. Huh?
    11971197 */
     1198
     1199/* BERLIOS: Should be reviewed for mediasize being a off_t ??? */
    11981200bool
    11991201should_we_write_to_next_tape(long mediasize,
    1200                              long long length_of_incoming_file)
     1202                             off_t length_of_incoming_file)
    12011203{
    12021204    /*@ bool's ***************************************************** */
     
    14341436    g_tape_posK = 0;
    14351437    g_sigpipe = FALSE;
    1436     res += write_header_block_to_stream(0, "start-of-tape", BLK_START_OF_TAPE); /* just in case */
    1437     res += write_header_block_to_stream(0, "start-of-backup", BLK_START_OF_BACKUP); /* just in case */
     1438    res += write_header_block_to_stream((off_t)0, "start-of-tape", BLK_START_OF_TAPE);  /* just in case */
     1439    res += write_header_block_to_stream((off_t)0, "start-of-backup", BLK_START_OF_BACKUP);  /* just in case */
    14381440    return (res);
    14391441}
     
    14771479            }
    14781480            if (i != last) {
    1479                 write_header_block_to_stream(0,
     1481                write_header_block_to_stream((off_t)0,
    14801482                                             "stop-backcatalog-afio-or-slice",
    14811483                                             BLK_STOP_AN_AFIO_OR_SLICE);
     
    15821584    long i;
    15831585
    1584     /*@ long long ************************************************** */
    1585     long long filesize;
     1586    off_t filesize;
    15861587
    15871588#ifdef EXTRA_TAPE_CHECKSUMS
     
    16581659    paranoid_fclose(fin);
    16591660    sprintf(checksum, "%04x%04x", crc16, crctt);
    1660     write_header_block_to_stream(g_current_media_number, checksum,
     1661    /* BERLIOS: what does it do ??? */
     1662    write_header_block_to_stream((off_t)g_current_media_number, checksum,
    16611663                                 BLK_STOP_FILE);
    16621664//  log_it("File '%s' written to tape.", infile);
     
    16801682 */
    16811683int
    1682 write_header_block_to_stream(long long length_of_incoming_file,
     1684write_header_block_to_stream(off_t length_of_incoming_file,
    16831685                             char *filename, int control_char)
    16841686{
     
    16911693    int i;
    16921694
    1693     /*@ long long ************************************************** */
    1694     long long olen;
     1695    off_t olen;
    16951696
    16961697    /*@ end vars *************************************************** */
     
    17151716    tempblock[7000] = control_char;
    17161717/*  for(i=0;i<8;i++) {tempblock[7001+i]=olen&0xff; olen>>=8;} */
    1717     memcpy(tempblock + 7001, (char *) &olen, sizeof(long long));
     1718    memcpy(tempblock + 7001, (char *) &olen, sizeof(off_t));
    17181719/*  if (length_of_incoming_file) {memcpy(tempblock+7001,(char*)&length_of_incoming_file,sizeof(long long));} */
    17191720    strcpy(tempblock + 1000, filename);
  • branches/stable/mondo/mondo/common/libmondo-stream.h

    r128 r684  
    2626                             char *fn);
    2727bool should_we_write_to_next_tape(long mediasize,
    28                                   long long length_of_incoming_file);
     28                                  off_t length_of_incoming_file);
    2929int skip_incoming_files_until_we_find_this_one(char
    3030                                               *the_file_I_was_reading);
     
    3535int write_file_to_stream_from_file(struct s_bkpinfo *bkpinfo,
    3636                                   char *infile);
    37 int write_header_block_to_stream(long long length_of_incoming_file,
     37int write_header_block_to_stream(off_t length_of_incoming_file,
    3838                                 char *filename, int control_char);
    3939void wrong_marker(int should_be, int it_is);
  • branches/stable/mondo/mondo/common/libmondo-verify.h

    r128 r684  
    3434extern int grab_percentage_from_last_line_of_file(char *);
    3535extern char *last_line_of_file(char *);
    36 extern long long length_of_file(char *);
     36extern off_t length_of_file(char *);
    3737extern void log_file_end_to_screen(char *, char *);
    3838extern void log_tape_pos(void);
  • branches/stable/mondo/mondo/mondorestore/mondo-restore.c

    r676 r684  
    19851985    if (count_lines_in_file(filelist_name) <= 0
    19861986        || length_of_file(tarball_fname) <= 0) {
    1987         log_msg(3, "length_of_file(%s) = %ld", tarball_fname,
     1987        log_msg(3, "length_of_file(%s) = %llu", tarball_fname,
    19881988                length_of_file(tarball_fname));
    19891989        sprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)",
  • branches/stable/mondo/mondo/mondorestore/mondoprep.h

    r558 r684  
    3939extern int strcmp_inc_numbers(char *, char *);
    4040extern long count_lines_in_file(char *);
    41 extern long long length_of_file(char *);
     41extern off_t length_of_file(char *);
    4242extern long noof_lines_that_match_wildcard(char *, char *);
    4343//extern char *slice_fname (long, long, bool, char *);
  • branches/stable/mondo/mondo/mondorestore/mr-externs.h

    r558 r684  
    3636extern void initialize_raid_record(struct raid_device_record *);
    3737extern bool is_this_device_mounted(char *);
    38 extern long long length_of_file(char *);
     38extern off_t length_of_file(char *);
    3939extern char *last_line_of_file(char *);
    4040extern struct s_node *load_filelist(char *);
Note: See TracChangeset for help on using the changeset viewer.