Ignore:
Timestamp:
Jan 11, 2006, 10:10:31 AM (18 years ago)
Author:
andree
Message:

Replaced partimagehack with ntfsclone from ntfsprogs package. Replaced
all occurrences of strings 'partimagehack' and 'partimage' with 'ntfsprog'.

File:
1 edited

Legend:

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

    r260 r296  
    21622162    char *bigfile_fname;
    21632163    char *sz_devfile;
    2164     char *partimagehack_fifo = NULL;
     2164    char *ntfsprog_fifo = NULL;
    21652165    /*@ long *********************************************** */
    21662166    long biggie_file_number = 0;
     
    21742174    FILE *ftmp = NULL;
    21752175    bool delete_when_done;
    2176     bool use_partimagehack;
     2176    bool use_ntfsprog;
    21772177    /*@ long long ****************************************** */
    21782178    long long biggie_fsize;
     
    22092209    for (fgets(bigfile_fname, MAX_STR_LEN, fin); !feof(fin);
    22102210         fgets(bigfile_fname, MAX_STR_LEN, fin), biggie_file_number++) {
    2211         use_partimagehack = FALSE;
     2211        use_ntfsprog = FALSE;
    22122212        if (bigfile_fname[strlen(bigfile_fname) - 1] < 32) {
    22132213            bigfile_fname[strlen(bigfile_fname) - 1] = '\0';
     
    22232223            delete_when_done = TRUE;
    22242224        } else {
    2225 // Call partimagehack if it's a /dev entry (i.e. a partition to be imaged)
     2225// Call ntfsclone (formerly partimagehack) if it's a /dev entry (i.e. a partition to be imaged)
    22262226            log_msg(2, "bigfile_fname = %s", bigfile_fname);
    2227             use_partimagehack = FALSE;
     2227            use_ntfsprog = FALSE;
    22282228            if (!strncmp(bigfile_fname, "/dev/", 5)
    22292229                && is_dev_an_NTFS_dev(bigfile_fname)) {
    2230                 use_partimagehack = TRUE;
     2230                use_ntfsprog = TRUE;
    22312231                log_msg(2,
    2232                         "Calling partimagehack in background because %s is an NTFS partition",
     2232                        "Calling ntfsclone in background because %s is an NTFS partition",
    22332233                        bigfile_fname);
    22342234                sprintf(sz_devfile, "/tmp/%d.%d.000",
     
    22362236                        (int) (random() % 32768));
    22372237                mkfifo(sz_devfile, 0x770);
    2238                 partimagehack_fifo = sz_devfile;
     2238                ntfsprog_fifo = sz_devfile;
    22392239                switch (pid = fork()) {
    22402240                case -1:
     
    22422242                case 0:
    22432243                    log_msg(2,
    2244                             "CHILD - fip - calling feed_into_partimage(%s, %s)",
     2244                            "CHILD - fip - calling feed_into_ntfsprog(%s, %s)",
    22452245                            bigfile_fname, sz_devfile);
    2246                     res = feed_into_partimage(bigfile_fname, sz_devfile);
     2246                    res = feed_into_ntfsprog(bigfile_fname, sz_devfile);
    22472247                    exit(res);
    22482248                    break;
    22492249                default:
    22502250                    log_msg(2,
    2251                             "feed_into_partimage() called in background --- pid=%ld",
     2251                            "feed_into_ntfsprog() called in background --- pid=%ld",
    22522252                            (long int) (pid));
    22532253                }
     
    22562256            else {
    22572257                sz_devfile[0] = '\0';
    2258                 partimagehack_fifo = NULL;
     2258                ntfsprog_fifo = NULL;
    22592259            }
    22602260
     
    22652265            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    22662266                write_header_block_to_stream(biggie_fsize, bigfile_fname,
    2267                                              use_partimagehack ?
     2267                                             use_ntfsprog ?
    22682268                                             BLK_START_A_PIHBIGGIE :
    22692269                                             BLK_START_A_NORMBIGGIE);
     
    22712271            res =
    22722272                slice_up_file_etc(bkpinfo, bigfile_fname,
    2273                                   partimagehack_fifo, biggie_file_number,
    2274                                   noof_biggie_files, use_partimagehack);
     2273                                  ntfsprog_fifo, biggie_file_number,
     2274                                  noof_biggie_files, use_ntfsprog);
    22752275            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    22762276                write_header_block_to_stream(0,
     
    32703270 *
    32713271 * @param biggie_filename The file to chop up.
    3272  * @param partimagehack_fifo The FIFO to partimagehack if this is an imagedev, NULL otherwise.
     3272 * @param ntfsprog_fifo The FIFO to ntfsclone if this is an imagedev, NULL otherwise.
    32733273 * @param biggie_file_number The sequence number of this biggie file (starting from 0).
    32743274 * @param noof_biggie_files The number of biggie files there are total.
     
    32793279int
    32803280slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
    3281                   char *partimagehack_fifo, long biggie_file_number,
    3282                   long noof_biggie_files, bool use_partimagehack)
     3281                  char *ntfsprog_fifo, long biggie_file_number,
     3282                  long noof_biggie_files, bool use_ntfsprog)
    32833283{
    32843284
     
    33293329
    33303330    biggiestruct.for_backward_compatibility = '\n';
    3331     biggiestruct.use_partimagehack = use_partimagehack;
     3331    biggiestruct.use_ntfsprog = use_ntfsprog;
    33323332    if (!(tempblock = (char *) malloc(256 * 1024))) {
    33333333        fatal_error("malloc error 256*1024");
     
    33473347        fatal_error("bkpinfo->optimal_set_size is insanely small");
    33483348    }
    3349     if (partimagehack_fifo) {
    3350         file_to_openin = partimagehack_fifo;
     3349    if (ntfsprog_fifo) {
     3350        file_to_openin = ntfsprog_fifo;
    33513351        strcpy(checksum_line, "IGNORE");
    33523352        log_msg(2,
    33533353                "Not calculating checksum for %s: it would take too long",
    33543354                biggie_filename);
    3355         totallength = get_phys_size_of_drive(biggie_filename)*1024*1024LL;
     3355        if ( !find_home_of_exe("ntfsresize")) {
     3356            fatal_error("ntfsresize not found");
     3357        }
     3358        sprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
     3359        log_it("command = %s", command);
     3360        strcpy (tmp, call_program_and_get_last_line_of_output(command));
     3361        log_it("res of it = %s", tmp);
     3362        totallength = atoll(tmp);
    33563363    } else {
    33573364        file_to_openin = biggie_filename;
Note: See TracChangeset for help on using the changeset viewer.