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/mondorestore/mondo-restore.c

    r274 r300  
    13681368  /** malloc ***/
    13691369    char *checksum, *outfile_fname, *tmp, *bzip2_command,
    1370         *partimagehack_command, *suffix, *sz_devfile;
     1370        *ntfsprog_command, *suffix, *sz_devfile;
    13711371    char *bigblk;
    13721372    char *p;
     
    13751375    long sliceno;
    13761376    long siz;
    1377     char partimagehack_fifo[MAX_STR_LEN];
     1377    char ntfsprog_fifo[MAX_STR_LEN];
    13781378    char *file_to_openout = NULL;
    13791379    struct s_filename_and_lstat_info biggiestruct;
    13801380    struct utimbuf the_utime_buf, *ubuf;
    1381     bool use_partimage_hack = FALSE;
     1381    bool use_ntfsprog_hack = FALSE;
    13821382    pid_t pid;
    13831383    int res = 0;
     
    13941394    malloc_string(tmp);
    13951395    malloc_string(bzip2_command);
    1396     malloc_string(partimagehack_command);
     1396    malloc_string(ntfsprog_command);
    13971397    malloc_string(suffix);
    13981398    malloc_string(sz_devfile);
     
    14511451
    14521452    log_msg(1, "DEFINITELY restoring %s", biggiestruct.filename);
    1453     if (biggiestruct.use_partimagehack) {
     1453    if (biggiestruct.use_ntfsprog) {
    14541454        if (strncmp(biggiestruct.filename, "/dev/", 5)) {
    14551455            log_msg(1,
    1456                     "I was in error when I set biggiestruct.use_partimagehack to TRUE.");
     1456                    "I was in error when I set biggiestruct.use_ntfsprog to TRUE.");
    14571457            log_msg(1, "%s isn't even in /dev", biggiestruct.filename);
    1458             biggiestruct.use_partimagehack = FALSE;
    1459         }
    1460     }
    1461 
    1462     if (biggiestruct.use_partimagehack) // if it's an NTFS device
     1458            biggiestruct.use_ntfsprog = FALSE;
     1459        }
     1460    }
     1461
     1462    if (biggiestruct.use_ntfsprog)  // if it's an NTFS device
    14631463//  if (!strncmp ( biggiestruct.filename, "/dev/", 5))
    14641464    {
    14651465        g_loglevel = 4;
    1466         use_partimage_hack = TRUE;
     1466        use_ntfsprog_hack = TRUE;
    14671467        log_msg(2,
    1468                 "Calling partimagehack in background because %s is an NTFS /dev entry",
     1468                "Calling ntfsclone in background because %s is an NTFS /dev entry",
    14691469                outfile_fname);
    14701470        sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    14711471                (int) (random() % 32768));
    14721472        mkfifo(sz_devfile, 0x770);
    1473         strcpy(partimagehack_fifo, sz_devfile);
    1474         file_to_openout = partimagehack_fifo;
     1473        strcpy(ntfsprog_fifo, sz_devfile);
     1474        file_to_openout = ntfsprog_fifo;
    14751475        switch (pid = fork()) {
    14761476        case -1:
     
    14781478        case 0:
    14791479            log_msg(3,
    1480                     "CHILD - fip - calling feed_outfrom_partimage(%s, %s)",
    1481                     biggiestruct.filename, partimagehack_fifo);
     1480                    "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)",
     1481                    biggiestruct.filename, ntfsprog_fifo);
    14821482            res =
    1483                 feed_outfrom_partimage(biggiestruct.filename,
    1484                                        partimagehack_fifo);
     1483                feed_outfrom_ntfsprog(biggiestruct.filename,
     1484                                       ntfsprog_fifo);
    14851485//          log_msg(3, "CHILD - fip - exiting");
    14861486            exit(res);
     
    14881488        default:
    14891489            log_msg(3,
    1490                     "feed_into_partimage() called in background --- pid=%ld",
     1490                    "feed_into_ntfsprog() called in background --- pid=%ld",
    14911491                    (long int) (pid));
    14921492        }
    14931493    } else {
    1494         use_partimage_hack = FALSE;
    1495         partimagehack_fifo[0] = '\0';
     1494        use_ntfsprog_hack = FALSE;
     1495        ntfsprog_fifo[0] = '\0';
    14961496        file_to_openout = outfile_fname;
    14971497        if (!does_file_exist(outfile_fname))    // yes, it looks weird with the '!' but it's correct that way
     
    15201520        return (1);
    15211521    }
    1522     log_msg(3, "Opened out to %s", outfile_fname);  // CD/DVD --> mondorestore --> partimagehack --> hard disk itself
     1522    log_msg(3, "Opened out to %s", outfile_fname);  // CD/DVD --> mondorestore --> ntfsclone --> hard disk itself
    15231523
    15241524    for (sliceno = 1, finished = FALSE; !finished;) {
     
    16291629    g_loglevel = old_loglevel;
    16301630
    1631     if (use_partimage_hack) {
    1632         log_msg(3, "Waiting for partimage to finish");
     1631    if (use_ntfsprog_hack) {
     1632        log_msg(3, "Waiting for ntfsclone to finish");
    16331633        sprintf(tmp,
    1634                 " ps ax | grep \" partimagehack \" | grep -v grep > /dev/null 2> /dev/null");
     1634                " ps ax | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    16351635        while (system(tmp) == 0) {
    16361636            sleep(1);
    16371637        }
    1638         log_it("OK, partimage has really finished");
     1638        log_it("OK, ntfsclone has really finished");
    16391639    }
    16401640
     
    16521652    paranoid_free(tmp);
    16531653    paranoid_free(bzip2_command);
    1654     paranoid_free(partimagehack_command);
     1654    paranoid_free(ntfsprog_command);
    16551655    paranoid_free(suffix);
    16561656    paranoid_free(sz_devfile);
     
    16821682                                     long long biggiefile_size, //UNUSED
    16831683                                     struct s_node *filelist,
    1684                                      int use_partimagehack,
     1684                                     int use_ntfsprog,
    16851685                                     char *pathname_of_last_file_restored)
    16861686{
     
    16921692    char *command;
    16931693    char *outfile_fname;
    1694     char *partimagehack_command;
     1694    char *ntfsprog_command;
    16951695    char *sz_devfile;
    1696     char *partimagehack_fifo;
     1696    char *ntfsprog_fifo;
    16971697    char *file_to_openout = NULL;
    16981698
     
    17061706    long long slice_siz;
    17071707    bool dummy_restore = FALSE;
    1708     bool use_partimage_hack = FALSE;
     1708    bool use_ntfsprog_hack = FALSE;
    17091709    pid_t pid;
    17101710    struct s_filename_and_lstat_info biggiestruct;
     
    17131713
    17141714    malloc_string(tmp);
    1715     malloc_string(partimagehack_fifo);
     1715    malloc_string(ntfsprog_fifo);
    17161716    malloc_string(outfile_fname);
    17171717    malloc_string(command);
    17181718    malloc_string(sz_devfile);
    1719     malloc_string(partimagehack_command);
     1719    malloc_string(ntfsprog_command);
    17201720    old_loglevel = g_loglevel;
    17211721    assert(bkpinfo != NULL);
     
    17241724
    17251725    pathname_of_last_file_restored[0] = '\0';
    1726     if (use_partimagehack == BLK_START_A_PIHBIGGIE) {
    1727         use_partimagehack = 1;
     1726    if (use_ntfsprog == BLK_START_A_PIHBIGGIE) {
     1727        use_ntfsprog = 1;
    17281728        log_msg(1, "%s --- pih=YES", orig_bf_fname);
    1729     } else if (use_partimagehack == BLK_START_A_NORMBIGGIE) {
    1730         use_partimagehack = 0;
     1729    } else if (use_ntfsprog == BLK_START_A_NORMBIGGIE) {
     1730        use_ntfsprog = 0;
    17311731        log_msg(1, "%s --- pih=NO", orig_bf_fname);
    17321732    } else {
    1733         use_partimagehack = 0;
     1733        use_ntfsprog = 0;
    17341734        log_msg(1, "%s --- pih=NO (weird marker though)", orig_bf_fname);
    17351735    }
     
    17571757    }
    17581758
    1759     if (use_partimagehack) {
     1759    if (use_ntfsprog) {
    17601760        if (strncmp(orig_bf_fname, "/dev/", 5)) {
    17611761            log_msg(1,
    1762                     "I was in error when I set use_partimagehack to TRUE.");
     1762                    "I was in error when I set use_ntfsprog to TRUE.");
    17631763            log_msg(1, "%s isn't even in /dev", orig_bf_fname);
    1764             use_partimagehack = FALSE;
    1765         }
    1766     }
    1767 
    1768     if (use_partimagehack) {
     1764            use_ntfsprog = FALSE;
     1765        }
     1766    }
     1767
     1768    if (use_ntfsprog) {
    17691769        g_loglevel = 4;
    17701770        strcpy(outfile_fname, orig_bf_fname);
    1771         use_partimage_hack = TRUE;
     1771        use_ntfsprog_hack = TRUE;
    17721772        log_msg(2,
    1773                 "Calling partimagehack in background because %s is a /dev entry",
     1773                "Calling ntfsclone in background because %s is a /dev entry",
    17741774                outfile_fname);
    17751775        sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    17761776                (int) (random() % 32768));
    17771777        mkfifo(sz_devfile, 0x770);
    1778         strcpy(partimagehack_fifo, sz_devfile);
    1779         file_to_openout = partimagehack_fifo;
     1778        strcpy(ntfsprog_fifo, sz_devfile);
     1779        file_to_openout = ntfsprog_fifo;
    17801780        switch (pid = fork()) {
    17811781        case -1:
     
    17831783        case 0:
    17841784            log_msg(3,
    1785                     "CHILD - fip - calling feed_outfrom_partimage(%s, %s)",
    1786                     outfile_fname, partimagehack_fifo);
     1785                    "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)",
     1786                    outfile_fname, ntfsprog_fifo);
    17871787            res =
    1788                 feed_outfrom_partimage(outfile_fname, partimagehack_fifo);
     1788                feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo);
    17891789//          log_msg(3, "CHILD - fip - exiting");
    17901790            exit(res);
     
    17921792        default:
    17931793            log_msg(3,
    1794                     "feed_into_partimage() called in background --- pid=%ld",
     1794                    "feed_into_ntfsprog() called in background --- pid=%ld",
    17951795                    (long int) (pid));
    17961796        }
     
    18041804                    orig_bf_fname);
    18051805        }
    1806         use_partimage_hack = FALSE;
    1807         partimagehack_fifo[0] = '\0';
     1806        use_ntfsprog_hack = FALSE;
     1807        ntfsprog_fifo[0] = '\0';
    18081808        file_to_openout = outfile_fname;
    18091809        if (!does_file_exist(outfile_fname))    // yes, it looks weird with the '!' but it's correct that way
     
    18821882            pathname_of_last_file_restored);
    18831883
    1884     if (use_partimage_hack) {
    1885         log_msg(3, "Waiting for partimage to finish");
     1884    if (use_ntfsprog_hack) {
     1885        log_msg(3, "Waiting for ntfsclone to finish");
    18861886        sprintf(tmp,
    1887                 " ps ax | grep \" partimagehack \" | grep -v grep > /dev/null 2> /dev/null");
     1887                " ps ax | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    18881888        while (system(tmp) == 0) {
    18891889            sleep(1);
    18901890        }
    1891         log_msg(3, "OK, partimage has really finished");
     1891        log_msg(3, "OK, ntfsclone has really finished");
    18921892    }
    18931893
     
    19061906    paranoid_free(outfile_fname);
    19071907    paranoid_free(command);
    1908     paranoid_free(partimagehack_command);
     1908    paranoid_free(ntfsprog_command);
    19091909    paranoid_free(sz_devfile);
    1910     paranoid_free(partimagehack_fifo);
     1910    paranoid_free(ntfsprog_fifo);
    19111911    g_loglevel = old_loglevel;
    19121912    return (retval);
Note: See TracChangeset for help on using the changeset viewer.