Changeset 1638 in MondoRescue


Ignore:
Timestamp:
Sep 19, 2007, 9:32:00 AM (17 years ago)
Author:
Bruno Cornec
Message:

Continue to use configuration file data (may not compile)

Location:
branches/stable/mondo
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/configure.in

    r1619 r1638  
    3838AC_ARG_ENABLE(debug, AS_HELP_STRING(--enable-debug,Add debugging flags), CFLAGS="$CFLAGS -g", )
    3939AC_ARG_WITH(max-noof-media, AS_HELP_STRING(--with-max-noof-media=NUM,Compile for a certain maximum number of media (default 50)), max_noof_media=$withval, max_noof_media=50)
    40 AC_ARG_WITH(tape-block-size, AS_HELP_STRING(--with-tape-block-size=NUM,Set tape block size in kilobytes (default 131072)), exttape=${withval:=131072}, exttape=131072)
    4140if test x$do_static_mr = xyes; then
    4241    MONDORESTORE_STATIC=-static
     
    4544fi
    4645AC_SUBST(MONDORESTORE_STATIC)
    47 AC_DEFINE_UNQUOTED(EXTTAPE, $exttape, [Tape blocksize])
    4846
    4947# ( which automake 2>/dev/null >/dev/null && ( automake --version 2>&1 | grep -q 1.5 || automake --version 2>&1 | grep -q 1.7 || AC_MSG_ERROR([Automake must be version 1.5 or 1.7, if you have it at all]) ) )
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1627 r1638  
    2626#include "mr_file.h"
    2727#include "mr_gettext.h"
     28#include "mr_conf.h"
    2829
    2930#include "libmondo-string-EXT.h"
     
    5657#endif
    5758#endif                          /* __FreeBSD__ */
     59
     60extern struct mr_conf *mr_conf;
    5861
    5962/*@unused@*/
     
    367370
    368371    mr_asprintf(&command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s",
    369              TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
     372             mr_conf->external_tape_blocksize, zipparams, fname, filelist, MONDO_LOGFILE);
    370373    mr_free(zipparams);
    371374
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1609 r1638  
    17941794        mr_free(command);
    17951795
     1796        mr_asprintf(&tmp, mr_conf->prefix);
    17961797        if (!popup_and_get_string
    17971798            ("Prefix.",
    17981799             "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files",
    1799             bkpinfo->prefix, MAX_STR_LEN / 4)) {
     1800            tmp, MAX_STR_LEN / 4)) {
    18001801            log_to_screen("User has chosen not to backup the PC");
    18011802            finish(1);
    18021803        }
     1804        mr_free(bkpinfo->prefix);
     1805        bkpinfo->prefix = tmp;
    18031806        mr_msg(3, "prefix set to %s", bkpinfo->prefix);
    18041807
     
    18511854            }
    18521855        }
     1856        mr_asprintf(&tmp, mr_conf->prefix);
    18531857        if (!popup_and_get_string
    18541858            ("Prefix.",
    18551859             "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files",
    1856              bkpinfo->prefix, MAX_STR_LEN / 4)) {
     1860             tmp, MAX_STR_LEN / 4)) {
    18571861            log_to_screen("User has chosen not to backup the PC");
    18581862            finish(1);
    18591863        }
     1864        mr_free(bkpinfo->prefix);
     1865        bkpinfo->prefix = tmp;
    18601866        mr_msg(3, "prefix set to %s", bkpinfo->prefix);
    18611867        break;
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1594 r1638  
    1717#include "mr_list.h"
    1818#include "mr_gettext.h"
     19#include "mr_conf.h"
    1920
    2021#include "mondostructures.h"
     
    3839extern char *g_getfattr;
    3940extern char *MONDO_LOGFILE;
     41
     42extern struct mr_conf *mr_conf;
    4043
    4144/**
     
    864867    malloc_string(temp_fname);
    865868    malloc_string(temp_cksum);
    866     datablock = mr_malloc(TAPE_BLOCK_SIZE);
     869    datablock = mr_malloc(mr_conf->external_tape_blocksize);
    867870    crc16 = 0;
    868871    crctt = 0;
     
    904907         bytes_read) {
    905908        bytes_to_write =
    906             (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE;
    907         bytes_to_read = TAPE_BLOCK_SIZE;
     909            (size < mr_conf->external_tape_blocksize) ? (long) size : mr_conf->external_tape_blocksize;
     910        bytes_to_read = mr_conf->external_tape_blocksize;
    908911        bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream);
    909912        while (bytes_read < bytes_to_read) {    // next tape!
     
    995998    /*@ end vars *************************************************** */
    996999
    997     tempblock = (char *) mr_malloc((size_t) TAPE_BLOCK_SIZE);
    998 
    999     for (i = 0; i < (int) TAPE_BLOCK_SIZE; i++) {
     1000    tempblock = (char *) mr_malloc((size_t) mr_conf->external_tape_blocksize);
     1001
     1002    for (i = 0; i < (int) mr_conf->external_tape_blocksize; i++) {
    10001003        tempblock[i] = 0;
    10011004    }
    10021005    while (!(*pcontrol_char = tempblock[7000])) {
    10031006        g_tape_posK +=
    1004             fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
     1007            fread(tempblock, 1, (size_t) mr_conf->external_tape_blocksize,
    10051008                  g_tape_stream) / 1024;
    10061009    }
     
    11311134    long bytes_to_write;
    11321135
    1133     datablock = mr_malloc(TAPE_BLOCK_SIZE);
     1136    datablock = mr_malloc(mr_conf->external_tape_blocksize);
    11341137    malloc_string(temp_fname);
    11351138    pB = strrchr(the_file_I_was_reading, '/');
     
    11811184        for (size = temp_size; size > 0; size -= bytes_to_write) {
    11821185            bytes_to_write =
    1183                 (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE;
     1186                (size < mr_conf->external_tape_blocksize) ? (long) size : mr_conf->external_tape_blocksize;
    11841187            // FIXME - needs error-checking and -catching
    1185             fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream);
     1188            fread(datablock, 1, (size_t) mr_conf->external_tape_blocksize, g_tape_stream);
    11861189        }
    11871190        res =
     
    14441447    /*@ buffers **************************************************** */
    14451448    char *tmp = NULL;
    1446     char datablock[TAPE_BLOCK_SIZE];
     1449    char *datablock = NULL;
    14471450    char *checksum = NULL;
    14481451    char *infile_basename = NULL;
     
    14731476    crc16 = 0;
    14741477    crctt = 0;
     1478    datablock = mr_malloc(mr_conf->external_tape_blocksize);
    14751479
    14761480    /*@ end vars *************************************************** */
     
    15081512    for (noof_blocks = 0; filesize > 0;
    15091513         noof_blocks++, filesize -= bytes_to_read) {
    1510         if (filesize < TAPE_BLOCK_SIZE) {
     1514        if (filesize < mr_conf->external_tape_blocksize) {
    15111515            bytes_to_read = (long) filesize;
    1512             for (i = 0; i < TAPE_BLOCK_SIZE; i++) {
     1516            for (i = 0; i < mr_conf->external_tape_blocksize; i++) {
    15131517                datablock[i] = '\0';
    15141518            }
    15151519        } else {
    1516             bytes_to_read = TAPE_BLOCK_SIZE;
     1520            bytes_to_read = mr_conf->external_tape_blocksize;
    15171521        }
    15181522        (void) fread(datablock, 1, (size_t) bytes_to_read, fin);
    15191523        g_tape_posK += fwrite(datablock, 1, /*bytes_to_read */
    1520                               (size_t) TAPE_BLOCK_SIZE,
     1524                              (size_t) mr_conf->external_tape_blocksize,
    15211525                              g_tape_stream) / 1024;
    15221526        if (g_sigpipe) {
     
    15361540#endif
    15371541    }
     1542    paranoid_free(datablock);
    15381543    paranoid_fclose(fin);
    15391544    mr_asprintf(&checksum, "%04x%04x", crc16, crctt);
     
    15631568{
    15641569    /*@ buffers **************************************************** */
    1565     char tempblock[TAPE_BLOCK_SIZE];
     1570    char *tempblock;
    15661571    char *p;
    15671572
     
    15731578    /*@ end vars *************************************************** */
    15741579
     1580    tempblock = mr_malloc(mr_conf->external_tape_blocksize);
    15751581
    15761582    olen = length_of_incoming_file;
     
    15861592        return (1);
    15871593    }
    1588     for (i = 0; i < (int) TAPE_BLOCK_SIZE; i++) {
     1594    for (i = 0; i < (int) mr_conf->external_tape_blocksize; i++) {
    15891595        tempblock[i] = 0;
    15901596    }
     
    15941600    strcpy(tempblock + 1000, filename);
    15951601    g_tape_posK +=
    1596         fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
     1602        fwrite(tempblock, 1, (size_t) mr_conf->external_tape_blocksize,
    15971603               g_tape_stream) / 1024;
     1604    paranoid_free(tempblock);
    15981605    mr_msg(6, "%s (fname=%s, size=%ld K)",
    15991606            marker_to_string(control_char), p,
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1628 r1638  
    696696
    697697    bkpinfo->manual_tray = mr_conf->manual_tray;
    698     bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
     698    bkpinfo->internal_tape_block_size = mr_conf->internal_tape_blocksize;
    699699    mr_asprintf(&tmp,mr_conf->media_device);
    700700    bkpinfo->media_device = tmp;
  • branches/stable/mondo/src/include/my-stuff.h

    r1629 r1638  
    147147#define BLK_ABORTED_BACKUP      102 ///< Marker block: backup was aborted.
    148148
    149 /// The external tape blocksize.
    150 #ifdef EXTTAPE
    151 #define TAPE_BLOCK_SIZE (long)EXTTAPE
    152 #else
    153 #define TAPE_BLOCK_SIZE 131072L /* was 8192; 06/2002-->65536; 11/2002-->131072 */
    154 #endif
    155 
    156 #define DEFAULT_INTERNAL_TAPE_BLOCK_SIZE 32768  // Nov 2003?
    157 
    158 
    159 
    160 
    161149#define SLICE_SIZE 4096         ///< The size of a slice of a biggiefile.
    162 
    163 
    164 
    165 
    166 
    167150
    168151/**
  • branches/stable/mondo/src/mondoarchive/mondo-cli.c

    r1628 r1638  
    207207    assert(flag_set != NULL);
    208208
    209     bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
     209    bkpinfo->internal_tape_block_size = mr_conf->internal_tape_blocksize;
    210210
    211211    /* compulsory */
     
    429429                }
    430430            } else if (flag_set['u'] || flag_set['t']) {
    431                 /* Force autidetection */
     431                /* Force autodetection */
    432432                bkpinfo->media_size = 0L;
    433433            } else {
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c

    r1633 r1638  
    230230    char *archiver_exe = NULL;
    231231    char *compressor_exe = NULL;
     232#ifdef __FreeBSD__
     233    long BUFSIZE=512L;
     234#else
     235    long BUFSIZE=(1024L*1024L)/mr_conf->external_tape_blexternal_tape_blocksize;
     236#endif
     237
    232238
    233239    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
     
    271277    }
    272278
    273 #ifdef __FreeBSD__
    274 #define BUFSIZE 512L
    275 #else
    276 #define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
    277 #endif
    278 
    279279    mr_asprintf(&logfile, "/tmp/afio.log.%d", current_tarball_number);
    280280    if (use_star)               // doesn't use compressor_exe
     
    287287                "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s",
    288288                archiver_exe,
    289                 TAPE_BLOCK_SIZE,
     289                mr_conf->external_tape_blocksize,
    290290                BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);
    291291    }
    292 #undef BUFSIZE
    293292    mr_free(archiver_exe);
    294293    mr_free(compressor_exe);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1629 r1638  
    886886                bkpinfo->internal_tape_block_size);
    887887    } else {
    888         bkpinfo->internal_tape_block_size =
    889             DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    890         mr_msg(1, "Internal tape block size = default (%ld)",
    891                 DEFAULT_INTERNAL_TAPE_BLOCK_SIZE);
     888        bkpinfo->internal_tape_block_size = mr_conf->internal_tape_blocksize;
     889        mr_msg(1, "Internal tape block size = default (%ld)", mr_conf->internal_tape_blocksize);
    892890    }
    893891
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1628 r1638  
    438438    read_cfg_file_into_bkpinfo(g_mondo_cfg_file, bkpinfo);
    439439    iamhere("Done loading config file; resizing ML");
     440    mr_asprintf(&tmp,bkpinfo->prefix);
    440441    if (popup_and_get_string
    441         ("Prefix", "Prefix of your ISO images ?", bkpinfo->prefix, MAX_STR_LEN / 4)) {
     442        ("Prefix", "Prefix of your ISO images ?", tmp, MAX_STR_LEN / 4)) {
     443        mr_free(bkpinfo->prefix);
     444        bkpinfo->prefix = tmp;
    442445        mr_msg(1, "Prefix set to %s",bkpinfo->prefix);
    443446    }
     
    10381041
    10391042    pathname_of_last_file_restored[0] = '\0';
    1040     bigblk = mr_malloc(TAPE_BLOCK_SIZE);
     1043    bigblk = mr_malloc(mr_conf->external_tape_blocksize);
    10411044
    10421045    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
     
    12491252
    12501253            while (!feof(fbzip2)) {
    1251                 siz = fread(bigblk, 1, TAPE_BLOCK_SIZE, fbzip2);
     1254                siz = fread(bigblk, 1, mr_conf->external_tape_blocksize, fbzip2);
    12521255                if (siz > 0) {
    12531256                    siz = fwrite(bigblk, 1, siz, fout);
     
    15671570    char *xattr_fname = NULL;
    15681571    char *acl_fname = NULL;
     1572#ifdef __FreeBSD__
     1573    long BUFSIZE=512L;
     1574#else
     1575    long BUFSIZE=(1024L*1024L)/mr_conf->external_tape_blocksize;
     1576#endif
     1577
    15691578
    15701579    assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
     
    16511660            mr_free(tmp);
    16521661        }
    1653 #ifdef __FreeBSD__
    1654 #define BUFSIZE 512
    1655 #else
    1656 #define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
    1657 #endif
    1658 
    16591662        if (use_star) {
    16601663            mr_asprintf(&command,
     
    16681671                mr_asprintf(&command,
    16691672                        "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s",
    1670                         TAPE_BLOCK_SIZE,
     1673                        mr_conf->external_tape_blocksize,
    16711674                        BUFSIZE, executable, filelist_subset_fname,
    16721675                        tarball_fname);
     
    16741677                mr_asprintf(&command,
    16751678                        "afio -i -b %ld -c %ld -M 8m %s %s",
    1676                         TAPE_BLOCK_SIZE,
     1679                        mr_conf->external_tape_blocksize,
    16771680                        BUFSIZE, executable, tarball_fname);
    16781681            }
     
    16801683        mr_free(executable);
    16811684
    1682 #undef BUFSIZE
    16831685        mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768),
    16841686            (int) (random() % 32768));
     
    18411843        } else {
    18421844            use_star = FALSE;
    1843             mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE,
     1845            mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", mr_conf->external_tape_blocksize,
    18441846                    executable, afio_fname);
    18451847        }
     
    18831885        // afio
    18841886        if (filelist) {
    1885             mr_asprintf(&command, "afio -i -M 8m -b %ld %s -w %s %s 2>> %s", TAPE_BLOCK_SIZE, executable, filelist_subset_fname, afio_fname, MONDO_LOGFILE);
     1887            mr_asprintf(&command, "afio -i -M 8m -b %ld %s -w %s %s 2>> %s", mr_conf->external_tape_blocksize, executable, filelist_subset_fname, afio_fname, MONDO_LOGFILE);
    18861888        } else {
    1887             mr_asprintf(&command, "afio -i -M 8m -b %ld %s %s 2>> %s", TAPE_BLOCK_SIZE, executable, afio_fname, MONDO_LOGFILE);
     1889            mr_asprintf(&command, "afio -i -M 8m -b %ld %s %s 2>> %s", mr_conf->external_tape_blocksize, executable, afio_fname, MONDO_LOGFILE);
    18881890        }
    18891891    }
Note: See TracChangeset for help on using the changeset viewer.