aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Saab <ps@FreeBSD.org>2001-03-28 01:37:29 +0000
committerPaul Saab <ps@FreeBSD.org>2001-03-28 01:37:29 +0000
commit6b8b8c7fdc750322acdeccb71f1e7bd707e01e15 (patch)
treef6db56e675a6f82ae77054c4a4fc5fbeb9fe180d
parent919eea6db9fcac16c41f1255ad370d02bba52585 (diff)
downloadsrc-6b8b8c7fdc750322acdeccb71f1e7bd707e01e15.tar.gz
src-6b8b8c7fdc750322acdeccb71f1e7bd707e01e15.zip
Last commit was broken.. It always prints '[CTRL-C to abort]'.
Move duplicate code for printing the status of the dump and checking for abort into a separate function. Pointy hat to: me
Notes
Notes: svn path=/head/; revision=74890
-rw-r--r--sys/cam/scsi/scsi_da.c19
-rw-r--r--sys/dev/ata/ata-disk.c13
-rw-r--r--sys/dev/ida/ida_disk.c14
-rw-r--r--sys/dev/twe/twe_freebsd.c14
-rw-r--r--sys/kern/kern_shutdown.c21
-rw-r--r--sys/sys/systm.h1
6 files changed, 31 insertions, 51 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 2152fa4b4d0f..4f5d01a1610a 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -720,26 +720,13 @@ dadump(dev_t dev)
return(EIO);
}
- if (addr % (1024 * 1024) == 0) {
-#ifdef HW_WDOG
- if (wdog_tickler)
- (*wdog_tickler)();
-#endif /* HW_WDOG */
- /* Count in MB of data left to write */
- printf("%d ", (num * softc->params.secsize)
- / (1024 * 1024));
- }
-
+ if (dumpstatus(addr, (long)(num * softc->params.secsize)) < 0)
+ return (EINTR);
+
/* update block count */
num -= blkcnt * dumppages;
blknum += blkcnt * dumppages;
addr += PAGE_SIZE * dumppages;
-
- /* operator aborting dump? */
- if (cncheckc() == 0x03)
- return (EINTR);
- else
- printf("[CTRL-C to abort] ");
}
/*
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index 8a4377f943cf..3531cd718879 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -341,21 +341,12 @@ addump(dev_t dev)
DELAY(20);
}
- if (addr % (1024 * 1024) == 0) {
-#ifdef HW_WDOG
- if (wdog_tickler)
- (*wdog_tickler)();
-#endif
- printf("%ld ", (long)(count * DEV_BSIZE) / (1024 * 1024));
- }
+ if (dumpstatus(addr, (long)(count * DEV_BSIZE)) < 0)
+ return EINTR;
blkno += blkcnt * dumppages;
count -= blkcnt * dumppages;
addr += PAGE_SIZE * dumppages;
- if (cncheckc() == 0x03)
- return EINTR;
- else
- printf("[CTRL-C to abort] ");
}
if (ata_wait(adp->controller, adp->unit, ATA_S_READY | ATA_S_DSC) < 0)
diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c
index d2d99f50cd4a..0aaeadc40370 100644
--- a/sys/dev/ida/ida_disk.c
+++ b/sys/dev/ida/ida_disk.c
@@ -232,22 +232,12 @@ idad_dump(dev_t dev)
if (error)
return (error);
- if (addr % (1024 * 1024) == 0) {
-#ifdef HW_WDOG
- if (wdog_tickler)
- (*wdog_tickler)();
-#endif
- printf("%ld ", (long)(count * DEV_BSIZE)/(1024 * 1024));
- }
+ if (dumpstatus(addr, (long)(count * DEV_BSIZE)) < 0)
+ return (EINTR);
blkno += blkcnt * dumppages;
count -= blkcnt * dumppages;
addr += PAGE_SIZE * dumppages;
-
- if (cncheckc() == 0x03)
- return (EINTR);
- else
- printf("[CTRL-C to abort] ");
}
return (0);
}
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c
index d5acfda0d9a5..15c55744be21 100644
--- a/sys/dev/twe/twe_freebsd.c
+++ b/sys/dev/twe/twe_freebsd.c
@@ -729,22 +729,12 @@ twed_dump(dev_t dev)
return(error);
- if (addr % (1024 * 1024) == 0) {
-#ifdef HW_WDOG
- if (wdog_tickler)
- (*wdog_tickler)();
-#endif
- printf("%ld ", (long)(count * DEV_BSIZE) / (1024 * 1024));
- }
+ if (dumpstatus(addr, (long)(count * DEV_BSIZE)) < 0)
+ return(EINTR);
blkno += blkcnt * dumppages;
count -= blkcnt * dumppages;
addr += PAGE_SIZE * dumppages;
-
- if (cncheckc() == 0x03)
- return(EINTR);
- else
- printf("[CTRL-C to abort] ");
}
return(0);
}
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 637d01c0a263..ad79fdcbbb79 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -527,6 +527,27 @@ dumpsys(void)
}
}
+int
+dumpstatus(vm_offset_t addr, long count)
+{
+ int c;
+
+ if (addr % (1024 * 1024) == 0) {
+#ifdef HW_WDOG
+ if (wdog_tickler)
+ (*wdog_tickler)();
+#endif
+ printf("%ld ", count / (1024 * 1024));
+ }
+
+ if ((c = cncheckc()) == 0x03)
+ return -1;
+ else if (c != -1)
+ printf("[CTRL-C to abort] ");
+
+ return 0;
+}
+
/*
* Panic is called on unresolvable fatal errors. It prints "panic: mesg",
* and then reboots. If we are called twice, then we avoid trying to sync
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 0d75bdfecc22..f2072644b15a 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -91,6 +91,7 @@ struct ucred;
struct uio;
void Debugger __P((const char *msg));
+int dumpstatus __P((vm_offset_t addr, long count));
int nullop __P((void));
int eopnotsupp __P((void));
int einval __P((void));