Changeset 300 in MondoRescue for trunk/mondo/mondo/common/libmondo-archive.c


Ignore:
Timestamp:
Jan 11, 2006, 2:20:38 PM (18 years ago)
Author:
bcornec
Message:

merge -r295:299 $SVN_M/branches/2.06

File:
1 edited

Legend:

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

    r262 r300  
    19681968    char *bigfile_fname = NULL;
    19691969    char *sz_devfile;
    1970     char *partimagehack_fifo = NULL;
     1970    char *ntfsprog_fifo = NULL;
    19711971    /*@ long *********************************************** */
    19721972    long biggie_file_number = 0;
     
    19811981    FILE *ftmp = NULL;
    19821982    bool delete_when_done;
    1983     bool use_partimagehack;
     1983    bool use_ntfsprog;
    19841984    /*@ long long ****************************************** */
    19851985    long long biggie_fsize;
     
    20152015    for (getline(&bigfile_fname, &n, fin); !feof(fin);
    20162016         getline(&bigfile_fname, &n, fin), biggie_file_number++) {
    2017         use_partimagehack = FALSE;
     2017        use_ntfsprog = FALSE;
    20182018        if (bigfile_fname[strlen(bigfile_fname) - 1] < 32) {
    20192019            bigfile_fname[strlen(bigfile_fname) - 1] = '\0';
     
    20292029            delete_when_done = TRUE;
    20302030        } else {
    2031             // Call partimagehack if it's a /dev entry (i.e. a partition to be imaged)
     2031            // Call ntfsclone (formerly partimagehack) if it's a /dev entry (i.e. a partition to be imaged)
    20322032            log_msg(2, "bigfile_fname = %s", bigfile_fname);
    2033             use_partimagehack = FALSE;
     2033            use_ntfsprog = FALSE;
    20342034            if (!strncmp(bigfile_fname, "/dev/", 5)
    20352035                && is_dev_an_NTFS_dev(bigfile_fname)) {
    2036                 use_partimagehack = TRUE;
     2036                use_ntfsprog = TRUE;
    20372037                log_msg(2,
    2038                         "Calling partimagehack in background because %s is an NTFS partition",
     2038                        "Calling ntfsclone in background because %s is an NTFS partition",
    20392039                        bigfile_fname);
    20402040                asprintf(&sz_devfile, "/tmp/%d.%d.000",
     
    20422042                         (int) (random() % 32768));
    20432043                mkfifo(sz_devfile, 0x770);
    2044                 partimagehack_fifo = sz_devfile;
     2044                ntfsprog_fifo = sz_devfile;
    20452045                switch (pid = fork()) {
    20462046                case -1:
     
    20482048                case 0:
    20492049                    log_msg(2,
    2050                             "CHILD - fip - calling feed_into_partimage(%s, %s)",
     2050                            "CHILD - fip - calling feed_into_ntfsprog(%s, %s)",
    20512051                            bigfile_fname, sz_devfile);
    2052                     res = feed_into_partimage(bigfile_fname, sz_devfile);
     2052                    res = feed_into_ntfsprog(bigfile_fname, sz_devfile);
    20532053                    exit(res);
    20542054                    break;
    20552055                default:
    20562056                    log_msg(2,
    2057                             "feed_into_partimage() called in background --- pid=%ld",
     2057                            "feed_into_ntfsprog() called in background --- pid=%ld",
    20582058                            (long int) (pid));
    20592059
     
    20632063            // Otherwise, use good old 'dd' and 'bzip2'
    20642064            else {
    2065                 partimagehack_fifo = NULL;
     2065                ntfsprog_fifo = NULL;
    20662066            }
    20672067
     
    20722072            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    20732073                write_header_block_to_stream(biggie_fsize, bigfile_fname,
    2074                                              use_partimagehack ?
     2074                                             use_ntfsprog ?
    20752075                                             BLK_START_A_PIHBIGGIE :
    20762076                                             BLK_START_A_NORMBIGGIE);
    20772077            }
    2078             res = slice_up_file_etc(bkpinfo, bigfile_fname,
    2079                                     partimagehack_fifo, biggie_file_number,
    2080                                     noof_biggie_files, use_partimagehack);
     2078            res =
     2079                slice_up_file_etc(bkpinfo, bigfile_fname,
     2080                                  ntfsprog_fifo, biggie_file_number,
     2081                                  noof_biggie_files, use_ntfsprog);
    20812082            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    20822083                tmp = calc_checksum_of_file(bigfile_fname);
     
    29962997 *
    29972998 * @param biggie_filename The file to chop up.
    2998  * @param partimagehack_fifo The FIFO to partimagehack if this is an imagedev, NULL otherwise.
     2999 * @param ntfsprog_fifo The FIFO to ntfsclone if this is an imagedev, NULL otherwise.
    29993000 * @param biggie_file_number The sequence number of this biggie file (starting from 0).
    30003001 * @param noof_biggie_files The number of biggie files there are total.
     
    30053006int
    30063007slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
    3007                   char *partimagehack_fifo, long biggie_file_number,
    3008                   long noof_biggie_files, bool use_partimagehack)
     3008                  char *ntfsprog_fifo, long biggie_file_number,
     3009                  long noof_biggie_files, bool use_ntfsprog)
    30093010{
    30103011
     
    30493050
    30503051    biggiestruct.for_backward_compatibility = '\n';
    3051     biggiestruct.use_partimagehack = use_partimagehack;
     3052    biggiestruct.use_ntfsprog = use_ntfsprog;
    30523053    optimal_set_size = bkpinfo->optimal_set_size;
    30533054    if (is_this_file_compressed(biggie_filename)
     
    30643065        fatal_error("bkpinfo->optimal_set_size is insanely small");
    30653066    }
    3066     if (partimagehack_fifo) {
    3067         file_to_openin = partimagehack_fifo;
     3067    if (ntfsprog_fifo) {
     3068        file_to_openin = ntfsprog_fifo;
    30683069        asprintf(&checksum_line, "IGNORE");
    30693070        log_msg(2,
    30703071                "Not calculating checksum for %s: it would take too long",
    30713072                biggie_filename);
    3072         totallength = get_phys_size_of_drive(biggie_filename)*1024*1024LL;
     3073        if ( !find_home_of_exe("ntfsresize")) {
     3074            fatal_error("ntfsresize not found");
     3075        }
     3076        sprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
     3077        log_it("command = %s", command);
     3078        strcpy (tmp, call_program_and_get_last_line_of_output(command));
     3079        log_it("res of it = %s", tmp);
     3080        totallength = atoll(tmp);
    30733081    } else {
    30743082        file_to_openin = biggie_filename;
Note: See TracChangeset for help on using the changeset viewer.