Changeset 1086 in MondoRescue for trunk/mondo/src/common/libmondo-devices.c


Ignore:
Timestamp:
Feb 2, 2007, 11:21:27 PM (17 years ago)
Author:
Bruno Cornec
Message:

log_msg => mr_msg in trunk

File:
1 edited

Legend:

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

    r1079 r1086  
    133133    }
    134134
    135     log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,
     135    mr_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,
    136136            mountpoint);
    137137    /*@ end vars *************************************************** */
     
    145145#endif
    146146
    147     log_msg(4, command);
     147    mr_msg(4, command);
    148148    if (strncmp(device, "/dev/", 5) == 0) {
    149149        retract_CD_tray_and_defeat_autorun();
    150150    }
    151151    retval = system(command);
    152     log_msg(1, "system(%s) returned %d", command, retval);
     152    mr_msg(1, "system(%s) returned %d", command, retval);
    153153    mr_free(command);
    154154
     
    174174    mr_asprintf(&tmp, where_is_root_mounted());
    175175    mr_asprintf(&comment, "root is mounted at %s\n", tmp);
    176     log_msg(0, comment);
     176    mr_msg(0, comment);
    177177    mr_free(comment);
    178178
    179     log_msg(0,
     179    mr_msg(0,
    180180            "No, Schlomo, that doesn't mean %s is the root partition. It's just a debugging message. Relax. It's part of am_I_in_disaster_recovery_mode().",
    181181            tmp);
     
    208208        is_this_a_ramdisk = TRUE;
    209209    }
    210     log_msg(1, "Is this a ramdisk? result = %d", is_this_a_ramdisk);
     210    mr_msg(1, "Is this a ramdisk? result = %d", is_this_a_ramdisk);
    211211    return (is_this_a_ramdisk);
    212212}
     
    291291#endif
    292292
    293     log_msg(3, "Ejecting %s", dev);
     293    mr_msg(3, "Ejecting %s", dev);
    294294    res2 = run_program_and_log_output(command, 1);
    295295    mr_free(command);
     
    543543    }
    544544    if (res) {
    545         log_msg(1, _("mount failed"));
    546     } else {
    547         log_msg(1, _("mount succeeded with %s"), dev);
     545        mr_msg(1, _("mount failed"));
     546    } else {
     547        mr_msg(1, _("mount succeeded with %s"), dev);
    548548    }
    549549    mr_free(dev);
     
    568568    if (g_cdrw_drive_is_here != NULL) {
    569569        mr_asprintf(&cdrw_device, g_cdrw_drive_is_here);
    570         log_msg(3, "Been there, done that. Returning %s", cdrw_device);
     570        mr_msg(3, "Been there, done that. Returning %s", cdrw_device);
    571571        return(cdrw_device);
    572572    }
    573573    if (g_backup_media_type == dvd) {
    574         log_msg(1,
     574        mr_msg(1,
    575575                "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
    576576        return(NULL);
     
    652652    if ((g_cdrom_drive_is_here != NULL) && !isdigit(g_cdrom_drive_is_here[0])) {
    653653        mr_asprintf(&output, g_cdrom_drive_is_here);
    654         log_msg(3, "Been there, done that. Returning %s", output);
     654        mr_msg(3, "Been there, done that. Returning %s", output);
    655655        return(output);
    656656    }
    657657    if ((the_last_place_i_found_it != NULL) && !try_to_mount) {
    658658        mr_asprintf(&output, the_last_place_i_found_it);
    659         log_msg(3,
     659        mr_msg(3,
    660660                "find_cdrom_device() --- returning last found location - '%s'",
    661661                output);
     
    674674    if (!tmp) {
    675675        mr_asprintf(&output, "/dev/cdrom");
    676         log_msg(4, "Can't find cdrecord; assuming %s", output);
     676        mr_msg(4, "Can't find cdrecord; assuming %s", output);
    677677        if (!does_device_exist(output)) {
    678             log_msg(4, "That didn't work. Sorry.");
     678            mr_msg(4, "That didn't work. Sorry.");
    679679            mr_free(cdr_exe);
    680680            mr_free(output);
     
    690690    fin = popen(command, "r");
    691691    if (!fin) {
    692         log_msg(4, "command=%s", command);
     692        mr_msg(4, "command=%s", command);
    693693        log_OS_error("Cannot popen command");
    694694        mr_free(cdr_exe);
     
    730730#ifndef __FreeBSD__
    731731    if (strlen(phrase_two) == 0) {
    732         log_msg(4, "Not running phase two. String is empty.");
     732        mr_msg(4, "Not running phase two. String is empty.");
    733733    } else {
    734734        mr_asprintf(&command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);
    735735        fin = popen(command, "r");
    736736        if (!fin) {
    737             log_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
     737            mr_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
    738738        } else {
    739739            for (mr_getline(&tmp, &n, fin); !feof(fin);
    740740                 mr_getline(&tmp, &n, fin)) {
    741                 log_msg(5, "--> '%s'", tmp);
     741                mr_msg(5, "--> '%s'", tmp);
    742742                if (tmp[0] != ' ' && tmp[1] != ' ') {
    743743                    p = strchr(tmp, ':');
     
    747747                            mr_free(dvd_last_resort);
    748748                            mr_asprintf(&dvd_last_resort, "/dev/%s", tmp);
    749                             log_msg(4,
     749                            mr_msg(4,
    750750                                    "Ignoring '%s' because it's a DVD drive",
    751751                                    tmp);
     
    767767#ifdef __FreeBSD__
    768768    if (!found_it) {
    769         log_msg(4, "OK, approach 2");
     769        mr_msg(4, "OK, approach 2");
    770770        if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/cdrom"))) {
    771771            if (!
     
    804804    if (dvd_last_resort != NULL) {
    805805        if (!found_it && strlen(dvd_last_resort) > 0) {
    806             log_msg(4, "Well, I'll use the DVD - %s - as a last resort",
     806            mr_msg(4, "Well, I'll use the DVD - %s - as a last resort",
    807807                    dvd_last_resort);
    808808            mr_free(output);
     
    817817                strrchr(output, '/') + 1);
    818818        if (system(tmp) == 0) {
    819             log_msg(4,
     819            mr_msg(4,
    820820                    "%s is not right. It's being SCSI-emulated. Continuing.",
    821821                    output);
     
    827827
    828828    if (found_it) {
    829         log_msg(4, "(find_cdrom_device) --> '%s'", output);
     829        mr_msg(4, "(find_cdrom_device) --> '%s'", output);
    830830        if (!does_device_exist(output)) {
    831             log_msg(4, "OK, I was wrong, I haven't found it... yet.");
     831            mr_msg(4, "OK, I was wrong, I haven't found it... yet.");
    832832            found_it = FALSE;
    833833            mr_free(output);
     
    836836
    837837    if (!found_it) {
    838         log_msg(4, "OK, approach 2");
     838        mr_msg(4, "OK, approach 2");
    839839        if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/scd0"))) {
    840840            if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/sr0"))) {
     
    882882    if (found_it && try_to_mount) {
    883883        if (! mount_CDROM_here(output, mountpoint)) {
    884             log_msg(4, "[Cardigans] I've changed my mind");
     884            mr_msg(4, "[Cardigans] I've changed my mind");
    885885            found_it = FALSE;
    886886            mr_free(output);
     
    888888            mr_asprintf(&tmp, "%s/archives", mountpoint);
    889889            if (!does_file_exist(tmp)) {
    890                 log_msg(4, "[Cardigans] I'll take it back");
     890                mr_msg(4, "[Cardigans] I'll take it back");
    891891                found_it = FALSE;
    892892                mr_free(output);
     
    895895                paranoid_system(command);
    896896                mr_free(command);
    897                 log_msg(4, "I'm confident the Mondo CD is in %s", output);
     897                mr_msg(4, "I'm confident the Mondo CD is in %s", output);
    898898            }
    899899            mr_free(tmp);
     
    905905    if (found_it) {
    906906        if (!does_file_exist(output)) {
    907             log_msg(3, "I still haven't found it.");
     907            mr_msg(3, "I still haven't found it.");
    908908            mr_free(output);
    909909            return(NULL);
    910910        }
    911         log_msg(3, "(find_cdrom_device) --> '%s'", output);
     911        mr_msg(3, "(find_cdrom_device) --> '%s'", output);
    912912        mr_asprintf(&the_last_place_i_found_it, output);
    913913        mr_free(g_cdrom_drive_is_here);
     
    921921    mr_free(cdr_exe);
    922922
    923     log_msg(1, "command=%s", command);
     923    mr_msg(1, "command=%s", command);
    924924    mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
    925925    mr_free(command);
     
    927927    if (tmp[0]) {
    928928        output = tmp;
    929         log_msg(4, "Finally found it at %s", output);
     929        mr_msg(4, "Finally found it at %s", output);
    930930    } else {
    931931        mr_free(tmp);
    932932        mr_free(output);
    933         log_msg(4, "Still couldn't find it.");
     933        mr_msg(4, "Still couldn't find it.");
    934934    }
    935935    return(output);
     
    945945    if (g_dvd_drive_is_here != NULL) {
    946946        mr_asprintf(&output, g_dvd_drive_is_here);
    947         log_msg(3, "Been there, done that. Returning %s", output);
     947        mr_msg(3, "Been there, done that. Returning %s", output);
    948948        return (output);
    949949    }
     
    952952            ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    953953        );
    954     log_msg(5, "tmp = '%s'", tmp);
     954    mr_msg(5, "tmp = '%s'", tmp);
    955955    if (!tmp[0]) {
    956956        mr_free(tmp);
     
    969969        mr_free(g_dvd_drive_is_here);
    970970        mr_asprintf(&g_dvd_drive_is_here, output);
    971         log_msg(2, "I think DVD is at %s", output);
    972     } else {
    973         log_msg(2, "I cannot find DVD");
     971        mr_msg(2, "I think DVD is at %s", output);
     972    } else {
     973        mr_msg(2, "I cannot find DVD");
    974974    }
    975975
     
    10321032
    10331033    if (outvalB <= 0) {
    1034         log_msg(1, "Error getting size of %s: %s", drive, strerror(errno));
     1034        mr_msg(1, "Error getting size of %s: %s", drive, strerror(errno));
    10351035#if linux
    10361036    fileid = open(drive, O_RDONLY);
     
    10411041                cylindersize = hdgeo.heads * hdgeo.sectors / 2;
    10421042                outvalA = cylindersize * cylinders / 1024;
    1043                 log_msg(2, "Got Harddisk geometry, C:%d, H:%d, S:%d",
     1043                mr_msg(2, "Got Harddisk geometry, C:%d, H:%d, S:%d",
    10441044                        hdgeo.cylinders, hdgeo.heads, hdgeo.sectors);
    10451045                gotgeo = 1;
    10461046            } else {
    1047                 log_msg(1, "Harddisk geometry wrong");
     1047                mr_msg(1, "Harddisk geometry wrong");
    10481048            }
    10491049        } else {
    1050             log_msg(1,
     1050            mr_msg(1,
    10511051                    "Error in ioctl() getting new hard disk geometry (%s), resizing in unsafe mode",
    10521052                    strerror(errno));
     
    10541054        close(fileid);
    10551055    } else {
    1056         log_msg(1, "Failed to open %s for reading: %s", drive,
     1056        mr_msg(1, "Failed to open %s for reading: %s", drive,
    10571057                strerror(errno));
    10581058    }
    10591059    if (!gotgeo) {
    1060         log_msg(1, "Failed to get harddisk geometry, using old mode");
     1060        mr_msg(1, "Failed to get harddisk geometry, using old mode");
    10611061    }
    10621062#endif
     
    10671067    outvalC = (outvalA > outvalB) ? outvalA : outvalB;
    10681068
    1069 //  log_msg (5, "drive = %s, error = %s", drive, strerror (errno));
     1069//  mr_msg (5, "drive = %s, error = %s", drive, strerror (errno));
    10701070//  fatal_error ("GPSOD: Unable to get size of drive");
    1071     log_msg(1, "%s --> %ld or %ld --> %ld", drive, outvalA, outvalB,
     1071    mr_msg(1, "%s --> %ld or %ld --> %ld", drive, outvalA, outvalB,
    10721072            outvalC);
    10731073
     
    11641164//  assert_string_is_neither_NULL_nor_zerolength(device_raw);
    11651165    if (device_raw[0] != '/' && !strstr(device_raw, ":/")) {
    1166         log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
     1166        mr_msg(1, "%s needs to have a '/' prefixed - I'll do it",
    11671167                device_raw);
    11681168        mr_asprintf(&tmp, "/%s", device_raw);
     
    11701170        mr_asprintf(&tmp, device_raw);
    11711171    }
    1172     log_msg(1, "Is %s mounted?", tmp);
     1172    mr_msg(1, "Is %s mounted?", tmp);
    11731173    if (!strcmp(tmp, "/proc") || !strcmp(tmp, "proc")) {
    1174         log_msg(1,
     1174        mr_msg(1,
    11751175                "I don't know how the heck /proc made it into the mountlist. I'll ignore it.");
    11761176        return (FALSE);
     
    12011201    mr_free(device_with_space);
    12021202
    1203     log_msg(4, "tmp (command) = '%s'", tmp);
     1203    mr_msg(4, "tmp (command) = '%s'", tmp);
    12041204    if (!system(tmp)) {
    12051205        mr_free(tmp);
     
    13211321    assert(cd_number_i_want > 0);
    13221322
    1323 //  log_msg(3, "Insisting on CD number %d", cd_number_i_want);
     1323//  mr_msg(3, "Insisting on CD number %d", cd_number_i_want);
    13241324
    13251325    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1326         log_msg(3,
     1326        mr_msg(3,
    13271327                "No need to insist_on_this_cd_number when the backup type isn't CD-R(W) or NFS or ISO");
    13281328        return;
     
    13351335    if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso
    13361336        || bkpinfo->backup_media_type == nfs) {
    1337         log_msg(3, "Remounting CD");
     1337        mr_msg(3, "Remounting CD");
    13381338        g_ISO_restore_mode = TRUE;
    13391339// FIXME --- I'm tempted to do something about this...
     
    13521352                    cd_number_i_want);
    13531353            if (does_file_exist(tmp)) {
    1354                 log_msg(1,
     1354                mr_msg(1,
    13551355                        "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir",
    13561356                        bkpinfo->isodir);
     
    13581358            }
    13591359        }
    1360         log_msg(3, "Mounting %s at %s", tmp, MNT_CDROM);
     1360        mr_msg(3, "Mounting %s at %s", tmp, MNT_CDROM);
    13611361        if (! mount_CDROM_here(tmp, MNT_CDROM)) {
    13621362            fatal_error("Mommy!");
     
    13651365    }
    13661366    if ((res = what_number_cd_is_this(bkpinfo)) != cd_number_i_want) {
    1367         log_msg(3, "Currently, we hold %d but we want %d", res,
     1367        mr_msg(3, "Currently, we hold %d but we want %d", res,
    13681368                cd_number_i_want);
    13691369        mr_asprintf(&tmp, "Insisting on %s #%d",
     
    13731373                bkpinfo->backup_media_string,
    13741374                cd_number_i_want);
    1375         log_msg(3, tmp);
     1375        mr_msg(3, tmp);
    13761376        mr_free(tmp);
    13771377
     
    14031403        mr_free(request);
    14041404
    1405         log_msg(1, "Thankyou. Proceeding...");
     1405        mr_msg(1, "Thankyou. Proceeding...");
    14061406        g_current_media_number = cd_number_i_want;
    14071407    }
     
    14521452    }
    14531453    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
    1454     log_msg(3, "media type = %s",bkpinfo->backup_media_string);
     1454    mr_msg(3, "media type = %s",bkpinfo->backup_media_string);
    14551455
    14561456    if (archiving_to_media) {
     
    14901490                mr_asprintf(&tmp, "1");
    14911491                mr_asprintf(&sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4582 MB
    1492                 log_msg(1, "Setting to DVD defaults");
     1492                mr_msg(1, "Setting to DVD defaults");
    14931493            } else if (bkpinfo->backup_media_type == usb) {
    14941494                strcpy(bkpinfo->media_device, VANILLA_USB_DEVICE);
     
    14981498                mr_asprintf(&tmp, "4");
    14991499                mr_asprintf(&sz_size, "650");
    1500                 log_msg(1, "Setting to CD defaults");
     1500                mr_msg(1, "Setting to CD defaults");
    15011501            }
    15021502            if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) {
     
    15341534        if (bkpinfo->disaster_recovery) {
    15351535            mr_allocstr(bkpinfo->media_device, "/dev/cdrom");
    1536             log_msg(2, "CD-ROM device assumed to be at %s",
     1536            mr_msg(2, "CD-ROM device assumed to be at %s",
    15371537                    bkpinfo->media_device);
    15381538        } else if (bkpinfo->restore_data
     
    15411541                mr_asprintf(&bkpinfo->media_device, "/dev/cdrom");
    15421542            }                   // just for the heck of it :)
    1543             log_msg(1, "bkpinfo->media_device = %s",
     1543            mr_msg(1, "bkpinfo->media_device = %s",
    15441544                    bkpinfo->media_device);
    15451545            tmp = find_cdrom_device(FALSE);
     
    15471547                || (tmp != NULL)) {
    15481548                mr_allocstr(bkpinfo->media_device, tmp);
    1549                 log_msg(1, "bkpinfo->media_device = %s",
     1549                mr_msg(1, "bkpinfo->media_device = %s",
    15501550                        bkpinfo->media_device);
    15511551                mr_asprintf(&comment,
     
    15611561            mr_free(tmp);
    15621562
    1563             log_msg(2, "%s device found at %s",
     1563            mr_msg(2, "%s device found at %s",
    15641564                    bkpinfo->backup_media_string,
    15651565                    bkpinfo->media_device);
     
    16071607        mr_free(bkpinfo->media_device);
    16081608        if (find_tape_device_and_size(bkpinfo->media_device, sz_size)) {
    1609             log_msg(3, _("Ok, using vanilla scsi tape."));
     1609            mr_msg(3, _("Ok, using vanilla scsi tape."));
    16101610            mr_allocstr(bkpinfo->media_device,VANILLA_SCSI_TAPE"0" );
    16111611            if ((fin = fopen(bkpinfo->media_device, "r"))) {
     
    16471647        }
    16481648        mr_free(tmp);
    1649         log_msg(4, "sz_size = %s", sz_size);
     1649        mr_msg(4, "sz_size = %s", sz_size);
    16501650        mr_free(sz_size);
    16511651        bkpinfo->media_size[0] = 0;
    1652         log_msg(4, "media_size[0] = %ld", bkpinfo->media_size[0]);
     1652        mr_msg(4, "media_size[0] = %ld", bkpinfo->media_size[0]);
    16531653        if (bkpinfo->media_size[0] <= 0) {
    16541654            bkpinfo->media_size[0] = 0;
     
    17811781            finish(1);
    17821782        }
    1783         log_msg(3, "prefix set to %s", bkpinfo->prefix);
     1783        mr_msg(3, "prefix set to %s", bkpinfo->prefix);
    17841784
    17851785        for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
    17861786            bkpinfo->media_size[i] = 650;
    17871787        }
    1788         log_msg(3, "Just set nfs_remote_dir to %s",
     1788        mr_msg(3, "Just set nfs_remote_dir to %s",
    17891789                bkpinfo->nfs_remote_dir);
    1790         log_msg(3, "isodir is still %s", bkpinfo->isodir);
     1790        mr_msg(3, "isodir is still %s", bkpinfo->isodir);
    17911791        break;
    17921792
     
    18281828            finish(1);
    18291829        }
    1830         log_msg(3, "prefix set to %s", bkpinfo->prefix);
     1830        mr_msg(3, "prefix set to %s", bkpinfo->prefix);
    18311831        break;
    18321832    default:
     
    19741974#else
    19751975    if (bkpinfo->backup_media_type == nfs) {
    1976         log_msg(3, "I think the NFS mount is mounted at %s",
     1976        mr_msg(3, "I think the NFS mount is mounted at %s",
    19771977                bkpinfo->isodir);
    19781978    }
     
    19971997            fatal_error("Media size is less than zero.");
    19981998        } else {
    1999             log_msg(2, "Warning - media size is less than zero.");
     1999            mr_msg(2, "Warning - media size is less than zero.");
    20002000            bkpinfo->media_size[0] = 0;
    20012001        }
     
    20922092        return (FALSE);
    20932093    }
    2094     log_msg(10, "Injecting %s", dev);
     2094    mr_msg(10, "Injecting %s", dev);
    20952095    inject_device(dev);
    20962096    if (!does_file_exist(dev)) {
    2097         log_msg(10, "%s doesn't exist. Returning FALSE.", dev);
     2097        mr_msg(10, "%s doesn't exist. Returning FALSE.", dev);
    20982098        return (FALSE);
    20992099    }
     
    21032103        && !run_program_and_log_output(command, FALSE)) {
    21042104        mr_asprintf(&output, dev);
    2105         log_msg(4, "Found it - %s", dev);
     2105        mr_msg(4, "Found it - %s", dev);
    21062106        mr_free(command);
    21072107        return (TRUE);
    21082108    } else {
    2109         log_msg(4, "It's not %s", dev);
     2109        mr_msg(4, "It's not %s", dev);
    21102110        mr_free(command);
    21112111        return (FALSE);
     
    23652365        lstat(curr_fname, &statbuf);
    23662366        while (S_ISLNK(statbuf.st_mode)) {
    2367             log_msg(1, "curr_fname = %s", curr_fname);
     2367            mr_msg(1, "curr_fname = %s", curr_fname);
    23682368            mr_asprintf(&command, "file %s", curr_fname);
    23692369            tmp = call_program_and_get_last_line_of_output(command);
     
    23762376            for (p = scratch; *p != '\0' && *p != '\''; p++);
    23772377            *p = '\0';
    2378             log_msg(0, "curr_fname %s --> '%s' --> %s", curr_fname, tmp, scratch);
     2378            mr_msg(0, "curr_fname %s --> '%s' --> %s", curr_fname, tmp, scratch);
    23792379            mr_free(tmp);
    23802380
     
    24192419    char *fdisk = NULL;
    24202420
    2421     log_msg(0, "Looking for partition table format type");
     2421    mr_msg(0, "Looking for partition table format type");
    24222422    mr_asprintf(&fdisk, "/sbin/parted2fdisk");
    2423     log_msg(1, "Using %s", fdisk);
     2423    mr_msg(1, "Using %s", fdisk);
    24242424    mr_asprintf(&command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    24252425    mr_free(fdisk);
     
    24342434    }
    24352435    mr_free(tmp);
    2436     log_msg(0, "Found %s partition table format type", output);
     2436    mr_msg(0, "Found %s partition table format type", output);
    24372437    return (output);
    24382438}
Note: See TracChangeset for help on using the changeset viewer.