/* * Now that we are fully operational, we can checksum the * disks, and using some heuristics, hopefully are able to * always determine the correct root disk. */ void diskconf() { extern struct timeout scoop_checkdisk; dev_t tmpdev; #if 0 /* * Configure root, swap, and dump area. This is * currently done by running the same checksum * algorithm over all known disks, as was done in * /boot. Then we basically fixup the *dev vars * from the info we gleaned from this. */ dkcsumattach(); #endif /* * XXX * zaurus bootblocks currently pass in "bsd" instead of * "device:bsd", or any such thing, making this a real pain. */ if (bootdv == NULL) bootdv = parsedisk("wd0a", strlen("wd0a"), 0, &tmpdev); if (bootdv == NULL) printf("boot device: lookup '%s' failed.\n", boot_file); else printf("boot device: %s\n", bootdv->dv_xname); setroot(bootdv, 0, RB_USERREQ); dumpconf(); timeout_add(&scoop_checkdisk, hz/25); }
void configure() { extern int boothowto; if (config_rootfound("backplane", NULL) == NULL) panic("backplane not configured"); #if GENERIC if ((boothowto & RB_ASKNAME) == 0) setroot(); setconf(); #else setroot(); #endif /* * Configure swap area and related system * parameter based on device(s) used. */ swapconf(); dumpconf(); cold = 0; mtpr(GC_CCF, PR_TXDB); /* Clear cold start flag in cpu */ }
void diskconf(void) { printf("boot device: %s\n", (bootdv) ? bootdv->dv_xname : "<unknown>"); setroot(bootdv, 0, RB_USERREQ); dumpconf(); }
void diskconf() { setroot(); #if 0 dumpconf(); #endif }
void diskconf(void) { printf("boot device: %s\n", bootdv ? bootdv->dv_xname : "<unknown>"); setroot(bootdv, booted_partition, RB_USERREQ); dumpconf(); }
void diskconf(void) { if (bootdv == NULL) printf("boot device: unknown (rpb %d/%d)\n", rpb.devtyp, rpb.unit); else printf("boot device: %s\n", bootdv->dv_xname); setroot(bootdv, booted_partition, RB_USERREQ); dumpconf(); }
void diskconf(void) { print_devpath("bootpath", &PAGE0->mem_boot); #if NMPATH > 0 if (bootdv != NULL) bootdv = mpath_bootdv(bootdv); #endif setroot(bootdv, 0, RB_USERREQ); dumpconf(); }
void diskconf(void) { printf("bootpath: %s\n", bootpath); #if NMPATH > 0 if (bootdv != NULL) bootdv = mpath_bootdv(bootdv); #endif setroot(bootdv, 0, RB_USERREQ); dumpconf(); }
/* * Now that we are fully operational, we can checksum the * disks, and using some heuristics, hopefully are able to * always determine the correct root disk. */ void diskconf(void) { int majdev, unit, part = 0; struct device *bootdv = NULL; dev_t tmpdev; char buf[128]; extern bios_bootmac_t *bios_bootmac; dkcsumattach(); if ((bootdev & B_MAGICMASK) == (u_int)B_DEVMAGIC) { majdev = B_TYPE(bootdev); unit = B_UNIT(bootdev); part = B_PARTITION(bootdev); snprintf(buf, sizeof buf, "%s%d%c", findblkname(majdev), unit, part + 'a'); bootdv = parsedisk(buf, strlen(buf), part, &tmpdev); } if (bios_bootmac) { struct ifnet *ifp; for (ifp = TAILQ_FIRST(&ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_list)) { if (ifp->if_type == IFT_ETHER && bcmp(bios_bootmac->mac, ((struct arpcom *)ifp)->ac_enaddr, ETHER_ADDR_LEN) == 0) break; } if (ifp) { #if defined(NFSCLIENT) printf("PXE boot MAC address %s, interface %s\n", ether_sprintf(bios_bootmac->mac), ifp->if_xname); bootdv = parsedisk(ifp->if_xname, strlen(ifp->if_xname), 0, &tmpdev); part = 0; #endif } else printf("PXE boot MAC address %s, interface %s\n", ether_sprintf(bios_bootmac->mac), "unknown"); } setroot(bootdv, part, RB_USERREQ); dumpconf(); #ifdef HIBERNATE hibernate_resume(); #endif /* HIBERNATE */ }
void diskconf(void) { struct device *bootdv; int bootpartition; if (booted_device == NULL) printf("WARNING: can't figure what device matches \"%s\"\n", boot_dev); bootdv = booted_device; bootpartition = booted_partition; setroot(bootdv, bootpartition, RB_USERREQ); dumpconf(); }
void diskconf(void) { struct device *dv; dev_t tmpdev; int len; char *p; if ((p = strchr(bootpath, ':')) != NULL) len = p - bootpath; else len = strlen(bootpath); dv = parsedisk(bootpath, len, 0, &tmpdev); setroot(dv, 0, RB_USERREQ); dumpconf(); }
/* * Configure swap space and related parameters. */ void swapconf() { struct swdevt *swp; int nblks; for (swp = swdevt; swp->sw_dev != NODEV; swp++) if (bdevsw[major(swp->sw_dev)].d_psize) { nblks = (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev); if (nblks != -1 && (swp->sw_nblks == 0 || swp->sw_nblks > nblks)) swp->sw_nblks = nblks; swp->sw_nblks = ctod(dtoc(swp->sw_nblks)); } dumpconf(); }
/* * called at boot time, configure all devices on the system. */ void cpu_configure() { if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); /* * Turn external interrupts on. * * XXX We have a race here. If we enable interrupts after setroot(), * the kernel dies. */ set_psr(get_psr() & ~PSR_IND); spl0(); setroot(); dumpconf(); cold = 0; }
/* * cpu_configure: * called at boot time, configure all devices on system */ void cpu_configure(void) { splhigh(); if (config_rootfound("mainbus", "mainbus") == NULL) panic("no mainbus found"); cpu_intr_init(); spl0(); setroot(); dumpconf(); if (cold_hook) (*cold_hook)(HPPA_COLD_HOT); #ifdef USELEDS timeout_set(&heartbeat_tmo, heartbeat, NULL); heartbeat(NULL); #endif cold = 0; }
/* * Now that we are fully operational, we can checksum the * disks, and using some heuristics, hopefully are able to * always determine the correct root disk. */ void diskconf(void) { dev_t tmpdev; #if 0 /* * Configure root, swap, and dump area. This is * currently done by running the same checksum * algorithm over all known disks, as was done in * /boot. Then we basically fixup the *dev vars * from the info we gleaned from this. */ dkcsumattach(); #endif /* Lookup boot device from boot if not set by configuration */ if (bootdv == NULL) { int len; char *p; /* boot_file is of the form wd0a:/bsd, we want 'wd0a' */ if ((p = strchr(boot_file, ':')) != NULL) len = p - boot_file; else len = strlen(boot_file); bootdv = parsedisk(boot_file, len, 0, &tmpdev); } if (bootdv == NULL) printf("boot device: lookup '%s' failed.\n", boot_file); else printf("boot device: %s\n", bootdv->dv_xname); setroot(bootdv, 0, RB_USERREQ); dumpconf(); }
void disk_configure() { rootconf(); dumpconf(); }
int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (nstance) */ rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int exitcode; int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; #ifdef HAVE_READLINE_HISTORY int rd_hist = 0; int sv_hist = 0; const char *hist_dir = NULL; const char hist_file[] = "/.rigctl_history"; char *hist_path = NULL; struct stat hist_dir_stat; #endif const char *rig_file=NULL, *ptt_file=NULL, *dcd_file=NULL; ptt_type_t ptt_type = RIG_PTT_NONE; dcd_type_t dcd_type = RIG_DCD_NONE; int serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char conf_parms[MAXCONFLEN] = ""; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS HST_SHRT_OPTS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } ptt_file = optarg; break; case 'd': if (!optarg) { usage(); /* wrong arg count */ exit(1); } dcd_file = optarg; break; case 'P': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) ptt_type = RIG_PTT_RIG; else if (!strcmp(optarg, "DTR")) ptt_type = RIG_PTT_SERIAL_DTR; else if (!strcmp(optarg, "RTS")) ptt_type = RIG_PTT_SERIAL_RTS; else if (!strcmp(optarg, "PARALLEL")) ptt_type = RIG_PTT_PARALLEL; else if (!strcmp(optarg, "CM108")) ptt_type = RIG_PTT_CM108; else if (!strcmp(optarg, "GPIO")) ptt_type = RIG_PTT_GPIO; else if (!strcmp(optarg, "GPION")) ptt_type = RIG_PTT_GPION; else if (!strcmp(optarg, "NONE")) ptt_type = RIG_PTT_NONE; else ptt_type = atoi(optarg); break; case 'D': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) dcd_type = RIG_DCD_RIG; else if (!strcmp(optarg, "DSR")) dcd_type = RIG_DCD_SERIAL_DSR; else if (!strcmp(optarg, "CTS")) dcd_type = RIG_DCD_SERIAL_CTS; else if (!strcmp(optarg, "CD")) dcd_type = RIG_DCD_SERIAL_CAR; else if (!strcmp(optarg, "PARALLEL")) dcd_type = RIG_DCD_PARALLEL; else if (!strcmp(optarg, "CM108")) dcd_type = RIG_DCD_CM108; else if (!strcmp(optarg, "NONE")) dcd_type = RIG_DCD_NONE; else dcd_type = atoi(optarg); break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (strlen(optarg) > 1) send_cmd_term = strtol(optarg, NULL, 0); else send_cmd_term = optarg[0]; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 'o': vfo_mode++; break; case 'n': rig_no_restore_ai(); break; #ifdef HAVE_READLINE_HISTORY case 'i': rd_hist++; break; case 'I': sv_hist++; break; #endif case 'v': verbose++; break; case 'L': show_conf++; break; case 'l': rig_set_debug(verbose); list_models(); exit(0); case 'u': dump_caps_opt++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "<*****@*****.**>\n\n"); /* * at least one command on command line, * disable interactive mode */ if (optind < argc) interactive = 0; my_rig = rig_init(my_model); if (!my_rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(my_rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rig_file) strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* * ex: RIG_PTT_PARALLEL and /dev/parport0 */ if (ptt_type != RIG_PTT_NONE) my_rig->state.pttport.type.ptt = ptt_type; if (dcd_type != RIG_DCD_NONE) my_rig->state.dcdport.type.dcd = dcd_type; if (ptt_file) strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1); if (dcd_file) strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) my_rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(my_rig, rig_token_lookup(my_rig, "civaddr"), civaddr); /* * print out conf parameters */ if (show_conf) { dumpconf(my_rig, stdout); } /* * print out capabilities, and exists immediately * We may be interested only in only caps, and rig_open may fail. */ if (dump_caps_opt) { dumpcaps(my_rig, stdout); rig_cleanup(my_rig); /* if you care about memory */ exit(0); } retcode = rig_open(my_rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model, my_rig->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", my_rig->caps->version, rig_strstatus(my_rig->caps->status)); exitcode = 0; #ifdef HAVE_LIBREADLINE if (interactive && prompt && have_rl) { rl_readline_name = "rigctl"; #ifdef HAVE_READLINE_HISTORY using_history(); /* Initialize Readline History */ if (rd_hist || sv_hist) { if (!(hist_dir = getenv("RIGCTL_HIST_DIR"))) hist_dir = getenv("HOME"); if (((stat(hist_dir, &hist_dir_stat) == -1) && (errno == ENOENT)) || !(S_ISDIR(hist_dir_stat.st_mode))) { fprintf(stderr, "Warning: %s is not a directory!\n", hist_dir); } hist_path = (char *)calloc((sizeof(char) * (strlen(hist_dir) + strlen(hist_file) + 1)), sizeof(char)); strncpy(hist_path, hist_dir, strlen(hist_dir)); strncat(hist_path, hist_file, strlen(hist_file)); } if (rd_hist && hist_path) if (read_history(hist_path) == ENOENT) fprintf(stderr, "Warning: Could not read history from %s\n", hist_path); #endif } #endif /* HAVE_LIBREADLINE */ do { retcode = rigctl_parse(my_rig, stdin, stdout, argv, argc); if (retcode == 2) exitcode = 2; } while (retcode == 0 || retcode == 2); #ifdef HAVE_LIBREADLINE if (interactive && prompt && have_rl) { #ifdef HAVE_READLINE_HISTORY if (sv_hist && hist_path) if (write_history(hist_path) == ENOENT) fprintf(stderr, "\nWarning: Could not write history to %s\n", hist_path); if ((rd_hist || sv_hist) && hist_path) { free(hist_path); hist_path = (char *)NULL; } #endif } #endif rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ return exitcode; }
/* * Doadump comes here after turning off memory management and * getting on the dump stack, either when called above, or by * the auto-restart code. */ void dumpsys() { int maj; int psize; daddr_t blkno; /* current block to write */ /* dump routine */ int (*dump)(dev_t, daddr_t, caddr_t, size_t); int pg; /* page being dumped */ paddr_t maddr; /* PA being dumped */ int error; /* error code from (*dump)() */ kcore_seg_t *kseg_p; cpu_kcore_hdr_t *chdr_p; char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */ extern int msgbufmapped; msgbufmapped = 0; /* Make sure dump device is valid. */ if (dumpdev == NODEV) return; if (dumpsize == 0) { dumpconf(); if (dumpsize == 0) return; } maj = major(dumpdev); if (dumplo < 0) { printf("\ndump to dev %u,%u not possible\n", maj, minor(dumpdev)); return; } dump = bdevsw[maj].d_dump; blkno = dumplo; printf("\ndumping to dev %u,%u offset %ld\n", maj, minor(dumpdev), dumplo); #ifdef UVM_SWAP_ENCRYPT uvm_swap_finicrypt_all(); #endif /* Setup the dump header */ kseg_p = (kcore_seg_t *)dump_hdr; chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))]; bzero(dump_hdr, sizeof(dump_hdr)); CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU); kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p)); *chdr_p = cpu_kcore_hdr; printf("dump "); psize = (*bdevsw[maj].d_psize)(dumpdev); if (psize == -1) { printf("area unavailable\n"); return; } /* Dump the header. */ error = (*dump)(dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1)); if (error != 0) goto abort; maddr = (paddr_t)0; for (pg = 0; pg < dumpsize; pg++) { #define NPGMB (1024 * 1024 / PAGE_SIZE) /* print out how many MBs we have dumped */ if (pg != 0 && (pg % NPGMB) == 0) printf("%d ", pg / NPGMB); #undef NPGMB error = (*dump)(dumpdev, blkno, (caddr_t)maddr, PAGE_SIZE); if (error == 0) { maddr += PAGE_SIZE; blkno += btodb(PAGE_SIZE); } else break; } abort: switch (error) { case 0: printf("succeeded\n"); break; case ENXIO: printf("device bad\n"); break; case EFAULT: printf("device not ready\n"); break; case EINVAL: printf("area improper\n"); break; case EIO: printf("i/o error\n"); break; case EINTR: printf("aborted from console\n"); break; default: printf("error %d\n", error); break; } }
void dumpsys() { cpu_kcore_hdr_t *h = &cpu_kcore_hdr; daddr64_t blkno; int (*dump)(dev_t, daddr64_t, caddr_t, size_t); u_int page = 0; paddr_t dumppa; u_int seg; int rc; extern int msgbufmapped; /* Don't record dump messages in msgbuf. */ msgbufmapped = 0; /* Make sure dump settings are valid. */ if (dumpdev == NODEV) return; if (dumpsize == 0) { dumpconf(); if (dumpsize == 0) return; } if (dumplo <= 0) { printf("\ndump to dev 0x%x not possible, not enough space\n", dumpdev); return; } dump = bdevsw[major(dumpdev)].d_dump; blkno = dumplo; printf("\ndumping to dev 0x%x offset %ld\n", dumpdev, dumplo); #ifdef UVM_SWAP_ENCRYPT uvm_swap_finicrypt_all(); #endif printf("dump "); /* Write dump header */ rc = cpu_dump(dump, &blkno); if (rc != 0) goto bad; for (seg = 0; seg < h->kcore_nsegs; seg++) { u_int pagesleft; pagesleft = atop(h->kcore_segs[seg].size); dumppa = (paddr_t)h->kcore_segs[seg].start; while (pagesleft != 0) { u_int npages; #define NPGMB atop(1024 * 1024) if (page != 0 && (page % NPGMB) == 0) printf("%u ", page / NPGMB); /* do not dump more than 1MB at once */ npages = min(pagesleft, NPGMB); #undef NPGMB npages = min(npages, dumpsize); rc = (*dump)(dumpdev, blkno, (caddr_t)SH3_PHYS_TO_P2SEG(dumppa), ptoa(npages)); if (rc != 0) goto bad; pagesleft -= npages; dumppa += ptoa(npages); page += npages; dumpsize -= npages; if (dumpsize == 0) goto bad; /* if truncated dump */ blkno += ctod(npages); } } bad: switch (rc) { case 0: printf("succeeded\n"); break; case ENXIO: printf("device bad\n"); break; case EFAULT: printf("device not ready\n"); break; case EINVAL: printf("area improper\n"); break; case EIO: printf("I/O error\n"); break; case EINTR: printf("aborted\n"); break; default: printf("error %d\n", rc); break; } /* make sure console can output our last message */ delay(1 * 1000 * 1000); }
void dumpsys() { const struct bdevsw *bdev; daddr_t blkno; int psize; int error; int addr; int block; int len; vaddr_t dumpspace; kcore_seg_t *kseg_p; cpu_kcore_hdr_t *chdr_p; char dump_hdr[dbtob(1)]; /* assumes header fits in one block */ /* Save registers. */ savectx(&dumppcb); /* flush everything out of caches */ cpu_dcache_wbinv_all(); cpu_sdcache_wbinv_all(); if (dumpdev == NODEV) return; if (dumpsize == 0) { dumpconf(); if (dumpsize == 0) return; } if (dumplo <= 0) { printf("\ndump to dev %u,%u not possible\n", major(dumpdev), minor(dumpdev)); return; } printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev), minor(dumpdev), dumplo); #ifdef UVM_SWAP_ENCRYPT uvm_swap_finicrypt_all(); #endif blkno = dumplo; dumpspace = (vaddr_t) memhook; bdev = bdevsw_lookup(dumpdev); if (bdev == NULL || bdev->d_psize == NULL) return; psize = (*bdev->d_psize)(dumpdev); printf("dump "); if (psize == -1) { printf("area unavailable\n"); return; } /* Setup the dump header */ kseg_p = (kcore_seg_t *)dump_hdr; chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))]; bzero(dump_hdr, sizeof(dump_hdr)); CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU); kseg_p->c_size = sizeof(dump_hdr) - ALIGN(sizeof(*kseg_p)); *chdr_p = cpu_kcore_hdr; error = (*bdev->d_dump)(dumpdev, blkno++, (caddr_t)dump_hdr, sizeof(dump_hdr)); if (error != 0) goto abort; len = 0; for (block = 0; block < bootconfig.dramblocks && error == 0; ++block) { addr = bootconfig.dram[block].address; for (;addr < (bootconfig.dram[block].address + (bootconfig.dram[block].pages * PAGE_SIZE)); addr += PAGE_SIZE) { if ((len % (1024*1024)) == 0) printf("%d ", len / (1024*1024)); pmap_kenter_pa(dumpspace, addr, PROT_READ); pmap_update(pmap_kernel()); error = (*bdev->d_dump)(dumpdev, blkno, (caddr_t) dumpspace, PAGE_SIZE); pmap_kremove(dumpspace, PAGE_SIZE); pmap_update(pmap_kernel()); if (error) break; blkno += btodb(PAGE_SIZE); len += PAGE_SIZE; } } abort: switch (error) { case ENXIO: printf("device bad\n"); break; case EFAULT: printf("device not ready\n"); break; case EINVAL: printf("area improper\n"); break; case EIO: printf("i/o error\n"); break; case EINTR: printf("aborted from console\n"); break; default: printf("succeeded\n"); break; } printf("\n\n"); delay(1000000); }
void dumpsys(void) { u_long totalbytesleft, bytes, i, n, memseg; u_long maddr; daddr_t blkno; int (*dump)(dev_t, daddr_t, caddr_t, size_t); int error; /* Save registers. */ savectx(&dumppcb); if (dumpdev == NODEV) return; /* * For dumps during autoconfiguration, * if dump device has already configured... */ if (dumpsize == 0) dumpconf(); if (dumplo <= 0 || dumpsize == 0) { printf("\ndump to dev %u,%u not possible\n", major(dumpdev), minor(dumpdev)); return; } printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev), minor(dumpdev), dumplo); error = (*bdevsw[major(dumpdev)].d_psize)(dumpdev); printf("dump "); if (error == -1) { printf("area unavailable\n"); return; } if ((error = cpu_dump()) != 0) goto err; totalbytesleft = ptoa(cpu_dump_mempagecnt()); blkno = dumplo + cpu_dumpsize(); dump = bdevsw[major(dumpdev)].d_dump; error = 0; for (memseg = 0; memseg < mem_cluster_cnt; memseg++) { maddr = mem_clusters[memseg].start; bytes = mem_clusters[memseg].size; for (i = 0; i < bytes; i += n, totalbytesleft -= n) { /* Print out how many MBs we have left to go. */ if ((totalbytesleft % (1024*1024)) == 0) printf("%ld ", totalbytesleft / (1024 * 1024)); /* Limit size for next transfer. */ n = bytes - i; if (n > BYTES_PER_DUMP) n = BYTES_PER_DUMP; (void) pmap_map(dumpspace, maddr, maddr + n, VM_PROT_READ); error = (*dump)(dumpdev, blkno, (caddr_t)dumpspace, n); if (error) goto err; maddr += n; blkno += btodb(n); /* XXX? */ #if 0 /* XXX this doesn't work. grr. */ /* operator aborting dump? */ if (sget() != NULL) { error = EINTR; break; } #endif } } err: switch (error) { case ENXIO: printf("device bad\n"); break; case EFAULT: printf("device not ready\n"); break; case EINVAL: printf("area improper\n"); break; case EIO: printf("i/o error\n"); break; case EINTR: printf("aborted from console\n"); break; case 0: printf("succeeded\n"); break; default: printf("error %d\n", error); break; } printf("\n\n"); delay(5000000); /* 5 seconds */ }