Changeset 3874 in MondoRescue


Ignore:
Timestamp:
Mar 7, 2024, 7:23:09 PM (7 weeks ago)
Author:
Bruno Cornec
Message:

remove differentiated support for cdrw

Location:
branches/3.3/mondo/src
Files:
11 edited

Legend:

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

    r3870 r3874  
    680680    case cdr:
    681681        mr_asprintf(value, "cdr");
    682         break;
    683     case cdrw:
    684         mr_asprintf(value, "cdrw");
    685682        break;
    686683    case cdstream:
     
    17711768    }
    17721769
    1773     if (bkpinfo->backup_media_type == cdr
    1774         || bkpinfo->backup_media_type == cdrw) {
     1770    if (bkpinfo->backup_media_type == cdr) {
    17751771        if (is_this_device_mounted(bkpinfo->media_device)) {
    17761772            log_msg(2, "Warning - %s mounted. I'm unmounting it before I burn to it.", bkpinfo->media_device);
     
    24572453/**
    24582454 * Make sure the user has a valid CD-R(W) in the CD drive.
    2459  * @param cdrw_dev Set to the CD-R(W) device checked.
     2455 * @param cd_dev Set to the CD-R(W) device checked.
    24602456 * @param keep_looping If TRUE, keep pestering user until they insist
    24612457 * or insert a correct CD; if FALSE, only check once.
    24622458 * @return 0 (there was an OK CD in the drive) or 1 (there wasn't).
    24632459 */
    2464 int interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev,
     2460int interrogate_disk_currently_in_cddrive(char *cd_dev,
    24652461                                             bool keep_looping)
    24662462{
     
    24692465    char *cdrecord = NULL;
    24702466
    2471     mr_asprintf(bkp, "%s", cdrw_dev);
    2472     if (find_cdrw_device(cdrw_dev)) {
    2473         strcpy(cdrw_dev, bkp);
    2474     } else {
     2467    mr_asprintf(bkp, "%s", cd_dev);
     2468    if ((cd_dev = find_dvd_device()) != NULL) {
    24752469        if (!system("which cdrecord > /dev/null 2> /dev/null")) {
    2476             mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2470            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev);
    24772471        } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) {
    2478             mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2472            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev);
    24792473        } else {
    24802474            log_msg(2, "Oh well. I guess I'll just pray then.");
     
    25162510    char *tmp = NULL;
    25172511    char *cdrom_dev = NULL;
    2518     char *cdrw_dev = NULL;
     2512    char *cd_dev = NULL;
    25192513    char *our_serial_str = NULL;
    25202514    bool ok_go_ahead_burn_it;
     
    25272521    char *mds = NULL;
    25282522
    2529     malloc_string(cdrw_dev);
     2523    malloc_string(cd_dev);
    25302524
    25312525    mds = media_descriptor_string(g_backup_media_type);
     
    26042598        log_msg(2,
    26052599                "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", mds);
    2606         if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) {
     2600        if (interrogate_disk_currently_in_cddrive(cd_dev, FALSE)) {
    26072601            ok_go_ahead_burn_it = FALSE;
    26082602            log_to_screen("There isn't a writable %s in the drive.", mds);
     
    26332627
    26342628    mr_free(cdrom_dev);
    2635     paranoid_free(cdrw_dev);
     2629    paranoid_free(cd_dev);
    26362630    mr_free(mtpt);
    26372631    if (pmountable) {
     
    31013095        }
    31023096        if (g_current_media_number == 1 && !res
    3103             && (bkpinfo->backup_media_type == cdr
    3104                 || bkpinfo->backup_media_type == cdrw)) {
     3097            && (bkpinfo->backup_media_type == cdr)) {
    31053098            if ((tmp = find_cdrom_device()) == NULL) {  // make sure find_cdrom_device() finds, records CD-R's loc
    31063099                log_msg(3, "*Sigh* Mike, I hate your computer.");
     
    32043197        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    32053198    } else if (bkpinfo->backup_data)
    3206         //bkpinfo->backup_media_type == cdrw || bkpinfo->backup_media_type == cdr))
     3199        // bkpinfo->backup_media_type == cdr))
    32073200    {
    32083201        log_msg(2,
  • branches/3.3/mondo/src/common/libmondo-cli.c

    r3873 r3874  
    534534    if (flag_set['u']) {
    535535        bkpinfo->backup_media_type = udev;
    536     }
    537     if (flag_set['w']) {
    538         bkpinfo->backup_media_type = cdrw;
    539536    }
    540537    if (flag_set['U']) {
  • branches/3.3/mondo/src/common/libmondo-devices-EXT.h

    r3872 r3874  
    2525extern int kick_vn(char *vn);
    2626extern char which_boot_loader(char *which_device);
    27 
    28 
    29 
    30 extern int find_cdrw_device(char *cdrw_device);
    31 
    3227
    3328extern int interactively_obtain_media_parameters_from_user(bool);
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3872 r3874  
    5555extern char *call_program_and_get_last_line_of_output(const char *);
    5656
    57 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = "";
     57static char g_cd_drive_is_here[MAX_STR_LEN / 4] = "";
    5858static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = "";
    5959static char g_dvd_drive_is_here[MAX_STR_LEN / 4] = "";
     
    105105        if (strlen(g_dvd_drive_is_here) > 0) {
    106106            inject_device(g_dvd_drive_is_here);
    107         }
    108         if (strlen(g_cdrw_drive_is_here) > 0) {
    109             inject_device(g_cdrw_drive_is_here);
    110107        }
    111108    }
     
    188185    case cdr:
    189186        strcpy(output, "cdr");
    190         break;
    191     case cdrw:
    192         strcpy(output, "cdrw");
    193187        break;
    194188    case cdstream:
     
    501495    }
    502496    return (res);
    503 }
    504 
    505 
    506 
    507 
    508 
    509 
    510 /**
    511  * Locate a CD-R/W writer's SCSI node.
    512  * @param cdrw_device SCSI node will be placed here.
    513  * @return 0 for success, nonzero for failure.
    514  */
    515 int find_cdrw_device(char *cdrw_device)
    516 {
    517     /*@ buffers ************************ */
    518     char *tmp = NULL;
    519     char *cdr_exe = NULL;
    520     char *command = NULL;
    521 
    522     if (g_cdrw_drive_is_here[0]) {
    523         strcpy(cdrw_device, g_cdrw_drive_is_here);
    524         log_msg(3, "Been there, done that. Returning %s", cdrw_device);
    525         return (0);
    526     }
    527     if (g_backup_media_type == dvd) {
    528         log_msg(1, "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
    529         return (1);
    530     }
    531     run_program_and_log_output("insmod ide-scsi", -1);
    532     if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) {
    533         if ((cdr_exe = find_home_of_exe("wodim")) == NULL) {
    534             cdr_exe = find_home_of_exe("dvdrecord");
    535         }
    536     }
    537     if (cdr_exe != NULL) {
    538         mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", cdr_exe);
    539         tmp = call_program_and_get_last_line_of_output(command);
    540         mr_free(command);
    541     }
    542     if ((tmp == NULL) || (strlen(tmp) < 2)) {
    543         mr_free(tmp);
    544         mr_free(cdr_exe);
    545         return (1);
    546     } else {
    547         strcpy(cdrw_device, tmp);
    548         log_it("Found CDRW device - %s", cdrw_device);
    549         strcpy(g_cdrw_drive_is_here, cdrw_device);
    550         mr_free(tmp);
    551         mr_free(cdr_exe);
    552         return (0);
    553     }
    554497}
    555498
     
    786729                                        (found_it =
    787730                                         set_dev_to_this_if_rx_OK(output,
    788                                                                   g_cdrw_drive_is_here)))
     731                                                                  g_cd_drive_is_here)))
    789732                                    {
    790733                                        retval = 1;
     
    837780    }
    838781
    839     mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
     782    mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cd_drive_is_here);
    840783
    841784    log_msg(1, "command=%s", command);
     
    22492192    switch (bkpinfo->backup_media_type) {
    22502193    case cdr:
    2251     case cdrw:
    22522194    case dvd:
    22532195    case usb:
     
    23382280            log_msg(2, "%s device found at %s", mds, bkpinfo->media_device);
    23392281        } else {
    2340             if ((find_cdrw_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
     2282            if ((find_cdrom_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
    23412283                mr_free(bkpinfo->media_device);
    23422284            }
  • branches/3.3/mondo/src/common/libmondo-files.c

    r3871 r3874  
    1919#include "libmondo-fork-EXT.h"
    2020#include "libmondo-string-EXT.h"
    21 #include "libmondo-newt-specific-EXT.h"
     21#include "newt-specific-EXT.h"
    2222
    2323/*@unused@*/
  • branches/3.3/mondo/src/common/libmondo-string.c

    r3871 r3874  
    10401040        mr_asprintf(type_of_backup, "CDR");
    10411041        break;
    1042     case cdrw:
    1043         mr_asprintf(type_of_backup, "CDRW");
    1044         break;
    10451042    case tape:
    10461043        mr_asprintf(type_of_backup, "tape");
  • branches/3.3/mondo/src/common/libmondo-tools.c

    r3871 r3874  
    486486
    487487// CD-R or CD-RW
    488     if (bkpinfo->backup_media_type == cdrw
    489         || bkpinfo->backup_media_type == cdr) {
     488    if (bkpinfo->backup_media_type == cdr) {
    490489        if (!bkpinfo->manual_cd_tray) {
    491490            mr_asprintf(extra_cdrom_params, "-waiti ");
    492491        }
    493         if (bkpinfo->backup_media_type == cdrw) {
    494             mr_asprintf(extra_cdrom_params, "blank=fast ");
    495         }
    496         if (extra_cdrom_params == NULL) {
    497             // If not initialized earlier, do it now
    498             mr_asprintf(extra_cdrom_params, " ");
    499         }
     492        mr_asprintf(extra_cdrom_params, "%s", "blank=fast ");
    500493        if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) {
    501494            if ((cdr_exe = find_home_of_exe("wodim")) == NULL) {
  • branches/3.3/mondo/src/common/mondostructures.h

    r3856 r3874  
    173173    iso,                        ///< Back up to ISO images.
    174174    cdr,                        ///< Back up to recordable CDs (do not erase them).
    175     cdrw,                       ///< Back up to CD-RWs and blank them first.
    176175    dvd,                        ///< Back up to DVD+R[W] or DVD-R[W] disks.
    177176    cdstream,                   ///< Back up to recordable CDs but treat them like a tape streamer.
     
    339338  /**
    340339   * The device we're backing up to.
    341    * If backup_media_type is @b cdr, @b cdrw, or @b cdstream, this should be the SCSI node (e.g. 0,1,0).
     340   * If backup_media_type is @b cdr, or @b cdstream, this should be the SCSI node (e.g. 0,1,0).
    342341   * If backup_media_type is @b dvd, @b tape, @b usb or @b udev, this should be a /dev entry.
    343342   * If backup_media_type is anything else, this should be blank.
  • branches/3.3/mondo/src/common/newt-specific.c

    r3871 r3874  
    12251225/**
    12261226 * Ask the user which backup media type they would like to use.
    1227  * The choices are @p none (exit to shell), @c cdr, @c cdrw, @c dvd,
     1227 * The choices are @p none (exit to shell), @c cdr, @c dvd,
    12281228 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs,
    12291229 * and @c iso.
     
    12401240        char *title_sz = NULL;
    12411241        char *minimsg_sz = NULL;
    1242         static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso };
    1243         static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
     1242        static t_bkptype possible_bkptypes[] = { none, cdr, dvd, tape, cdstream, udev, netfs, iso };
     1243        static char *possible_responses[] = { "none", "cdr", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
    12441244        char *outstr = NULL;
    12451245        char *instr = NULL;
     
    12891289        newtCenteredWindow(34, 17, minimsg_sz);
    12901290        b1 = newtButton(1, 1, "CD-R disks ");
    1291         b2 = newtButton(17, 1, "CD-RW disks");
    12921291        b3 = newtButton(1, 9, "Tape drive ");
    12931292        b4 = newtButton(17, 5, "USB Key/Disk");
     
    12971296        b8 = newtButton(17, 13, "    Exit   ");
    12981297        myForm = newtForm(NULL, NULL, 0);
    1299         newtFormAddComponents(myForm, b1, b5, b3, b7, b2, b4, b6, b8, NULL);
     1298        newtFormAddComponents(myForm, b1, b5, b3, b7, b4, b6, b8, NULL);
    13001299        b_res = newtRunForm(myForm);
    13011300        newtFormDestroy(myForm);
     
    13031302        if (b_res == b1) {
    13041303            output = cdr;
    1305         } else if (b_res == b2) {
    1306             output = cdrw;
    13071304        } else if (b_res == b3) {
    13081305            output = tape;
  • branches/3.3/mondo/src/mondoarchive/mondoarchive.c

    r3872 r3874  
    2727extern bool g_text_mode;
    2828extern char *g_boot_mountpt;
    29 extern char *g_cdrw_drive_is_here;
     29extern char *g_cd_drive_is_here;
    3030static char *g_cdrom_drive_is_here = NULL;
    3131static char *g_dvd_drive_is_here = NULL;
     
    281281        g_loglevel = 10;
    282282        setup_newt_stuff();
    283         malloc_string(tmp);
    284         if (find_cdrw_device(tmp)) {
     283        if ((tmp = find_cdrom_device()) == NULL) {
    285284            printf("Failed to find CDR-RW drive\n");
    286285        } else {
    287286            printf("CD-RW is at %s\n", tmp);
    288         }
    289         tmp[0] = '\0';
    290         if (find_cdrom_device(tmp, atoi(argv[2]))) {
    291             printf("Failed to find CD-ROM drive\n");
    292         } else {
    293             printf("CD-ROM is at %s\n", tmp);
    294287        }
    295288        mr_free(tmp);
  • branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c

    r3873 r3874  
    671671    } else if (!strcmp(value, "cdr")) {
    672672        bkpinfo->backup_media_type = cdr;
    673     } else if (!strcmp(value, "cdrw")) {
    674         bkpinfo->backup_media_type = cdrw;
    675673    } else if (!strcmp(value, "dvd")) {
    676674        bkpinfo->backup_media_type = dvd;
Note: See TracChangeset for help on using the changeset viewer.