Ignore:
Timestamp:
May 26, 2008, 5:47:22 PM (16 years ago)
Author:
Bruno Cornec
Message:

syntax fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mondo/src/common/libmondo-stream.c

    r1948 r1949  
    624624
    625625
     626/**
     627 * Handle OBDR if we were asked to do so
     628 * @param tapedev The tape device to open for writing.
     629 * @return 0 for success, nonzero for failure.
     630 * @note This should be called ONLY from backup processes. It will OVERWRITE ANY
     631 * EXISTING DATA on the tape!
     632 */
     633void skip_obdr(char *tapedev)
     634{
     635    char *command = NULL;
     636    char *ntapedev = NULL;
     637
     638    ntapedev = get_non_rewind_dev(tapedev);
     639    if (ntapedev == NULL) {
     640        log_it("Not skipping OBDR");
     641    }
     642
     643    asprintf(&command, "mt -f %s fsf 2", ntapedev);
     644    run_program_and_log_output(command, 1);
     645    paranoid_free(command);
     646
     647    paranoid_free(ntapedev);
     648}
     649
     650int create_obdr(char *tapedev)
     651{
     652
     653    char *ntapedev = NULL;
     654    char *command = NULL;
     655    int res = 0;
     656
     657    ntapedev = get_non_rewind_dev(tapedev);
     658    if (ntapedev == NULL) {
     659        log_it("Skipping OBDR");
     660        return(1);
     661    }
     662
     663    /* OBDR: First block 10 kB of zero bs = 512 */
     664    asprintf(&command, "mt -f %s compression off", tapedev);
     665    res = run_program_and_log_output(command, 1);
     666    paranoid_free(command);
     667
     668    asprintf(&command, "mt -f %s rewind", tapedev);
     669    res = run_program_and_log_output(command, 1);
     670    paranoid_free(command);
     671
     672    asprintf(&command, "mt -f %s setblk 512", ntapedev);
     673    res = run_program_and_log_output(command, 1);
     674    paranoid_free(command);
     675
     676    asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20", ntapedev);
     677    res = run_program_and_log_output(command, 1);
     678    paranoid_free(command);
     679
     680    /* OBDR: then ISO boot image bs = 2048 */
     681    asprintf(&command, "mt -f %s setblk 2048", ntapedev);
     682    res = run_program_and_log_output(command, 1);
     683    paranoid_free(command);
     684
     685    asprintf(&command, "dd if=%s of=%s bs=2048", ntapedev, MINDI_CACHE"/mondorescue.iso" );
     686    res = run_program_and_log_output(command, 1);
     687    paranoid_free(command);
     688
     689    paranoid_free(ntapedev);
     690}
     691
    626692
    627693/**
     
    669735    }
    670736    if (bkpinfo->use_obdr) {
    671         skip_obdr(tapedev);
     737        skip_obdr(bkpinfo->media_device);
    672738    }
    673739
     
    830896}
    831897
    832 
    833 /**
    834  * Handle OBDR if we were asked to do so
    835  * @param tapedev The tape device to open for writing.
    836  * @return 0 for success, nonzero for failure.
    837  * @note This should be called ONLY from backup processes. It will OVERWRITE ANY
    838  * EXISTING DATA on the tape!
    839  */
    840 void skip_obdr(char *tapedev)
    841 {
    842     char *command = NULL;
    843 
    844     ntapedev = get_non_rewind_dev(tapedev);
    845     if (ntapedev == NULL) {
    846         log_it("Not skipping OBDR");
    847     }
    848 
    849     asprintf(&command, "mt -f %s fsf 2", ntapedev);
    850     run_program_and_log_output(command, 1);
    851     paranoid_free(command);
    852 }
    853 
    854 int create_obdr(char *tapedev)
    855 {
    856 
    857     char *ntapedev = NULL;
    858     char *command = NULL;
    859     int res = 0;
    860 
    861     ntapedev = get_non_rewind_dev(tapedev);
    862     if (ntapedev == NULL) {
    863         log_it("Skipping OBDR");
    864         return(1);
    865     }
    866 
    867     /* OBDR: First block 10 kB of zero bs = 512 */
    868     asprintf(&command, "mt -f %s compression off", tapedev);
    869     res = run_program_and_log_output(command, 1);
    870     paranoid_free(command);
    871 
    872     asprintf(&command, "mt -f %s rewind", tapedev);
    873     res = run_program_and_log_output(command, 1);
    874     paranoid_free(command);
    875 
    876     asprintf(&command, "mt -f %s setblk 512", ntapedev);
    877     res = run_program_and_log_output(command, 1);
    878     paranoid_free(command);
    879 
    880     asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20", ntapedev);
    881     res = run_program_and_log_output(command, 1);
    882     paranoid_free(command);
    883 
    884     /* OBDR: then ISO boot image bs = 2048 */
    885     asprintf(&command, "mt -f %s setblk 2048", ntapedev);
    886     res = run_program_and_log_output(command, 1);
    887     paranoid_free(command);
    888 
    889     asprintf(&command, "dd if=%s of=%s bs=2048", ntapedev);
    890     res = run_program_and_log_output(command, 1);
    891     paranoid_free(command);
    892 
    893 }
    894 
    895898/**
    896899 * Start writing to a tape device for the backup.
     
    915918    g_tape_posK = 0;
    916919
    917     if (bkpindo->use_obdr) {
     920    if (bkpinfo->use_obdr) {
    918921        create_obdr(tapedev);
    919922    }
Note: See TracChangeset for help on using the changeset viewer.