summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdc/fdc.c6
-rw-r--r--sys/dev/slice/disklabel.c22
-rw-r--r--sys/dev/slice/mbr.c22
-rw-r--r--sys/dev/slice/slice.h4
-rw-r--r--sys/dev/slice/slice_device.c29
-rw-r--r--sys/dev/vn/vn.c19
6 files changed, 88 insertions, 14 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 2d74c99..9afadd2 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.109 1998/04/19 23:31:41 julian Exp $
+ * $Id: fd.c,v 1.110 1998/04/22 10:25:15 julian Exp $
*
*/
@@ -2196,9 +2196,9 @@ fdsopen(void *private, int flags, int mode, struct proc *p)
sd = private;
if((flags & (FREAD|FWRITE)) != 0) {
- return(Fdopen(makedev(0,sd->minor), 0 , 0, p));
+ return(Fdopen(makedev(0,sd->minor), flags , mode, p));
} else {
- return(fdclose(makedev(0,sd->minor), 0 , 0, p));
+ return(fdclose(makedev(0,sd->minor), 0 , mode, p));
}
}
diff --git a/sys/dev/slice/disklabel.c b/sys/dev/slice/disklabel.c
index ff8c6f6..2934745 100644
--- a/sys/dev/slice/disklabel.c
+++ b/sys/dev/slice/disklabel.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: disklabel.c,v 1.2 1998/04/22 10:25:09 julian Exp $
+ * $Id: disklabel.c,v 1.3 1998/04/22 19:27:51 julian Exp $
*/
#define BAD144
@@ -74,6 +74,7 @@ static sl_h_claim_t dkl_claim; /* upwards travelling claim */
static sl_h_revoke_t dkl_revoke;/* upwards travelling revokation */
static sl_h_verify_t dkl_verify;/* things changed, are we stil valid? */
static sl_h_upconfig_t dkl_upconfig;/* config requests from below */
+static sl_h_dump_t dkl_dump; /* core dump req downward */
static struct slice_handler slicetype = {
"disklabel",
@@ -88,7 +89,8 @@ static struct slice_handler slicetype = {
&dkl_revoke, /* revoke */
&dkl_claim, /* claim */
&dkl_verify, /* verify */
- &dkl_upconfig /* subslice manipulation */
+ &dkl_upconfig, /* subslice manipulation */
+ &dkl_dump
};
static void
@@ -828,6 +830,7 @@ dkl_upconfig(struct slice *slice, int cmd, caddr_t addr, int flag, struct proc *
case SLCIOCRESET:
return (0);
+#ifdef BAD144
case SLCIOCTRANSBAD:
{
struct private_data *pd;
@@ -838,6 +841,7 @@ dkl_upconfig(struct slice *slice, int cmd, caddr_t addr, int flag, struct proc *
*(daddr_t*)addr = dkl_transbad144(pd, *(daddr_t*)addr);
return (0);
}
+#endif
/* These don't really make sense. keep the headers for a reminder */
default:
@@ -916,3 +920,17 @@ dkcksum(lp)
}
#endif /* 0 */
+static int
+dkl_dump(void *private, int32_t blkoff, int32_t blkcnt)
+{
+ struct private_data *pd;
+ struct subdev *sdp;
+ register struct slice *slice;
+
+RR;
+ sdp = private;
+ pd = sdp->pd;
+ slice = pd->slice_down;
+ blkoff += sdp->offset;
+ return (*slice->handler_down->dump)(slice->private_down, blkoff, blkcnt);
+}
diff --git a/sys/dev/slice/mbr.c b/sys/dev/slice/mbr.c
index 5558775..08e8b35 100644
--- a/sys/dev/slice/mbr.c
+++ b/sys/dev/slice/mbr.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mbr.c,v 1.2 1998/04/22 10:25:09 julian Exp $
+ * $Id: mbr.c,v 1.3 1998/04/22 19:27:51 julian Exp $
*/
#include <sys/param.h>
@@ -85,6 +85,7 @@ static sl_h_claim_t mbr_claim; /* upwards travelling claim */
static sl_h_revoke_t mbr_revoke;/* upwards travelling revokation */
static sl_h_verify_t mbr_verify;/* things changed, are we stil valid? */
static sl_h_upconfig_t mbr_upconfig;/* config request from below */
+static sl_h_dump_t mbr_dump; /* core dump req downward */
static struct slice_handler slicetype = {
"MBR",
@@ -99,7 +100,8 @@ static struct slice_handler slicetype = {
&mbr_revoke, /* revoke */
&mbr_claim, /* claim */
&mbr_verify, /* verify */
- &mbr_upconfig /* config from below */
+ &mbr_upconfig, /* config from below */
+ &mbr_dump
};
static void
@@ -839,6 +841,8 @@ mbr_upconfig(struct slice *slice, int cmd, caddr_t addr,
daddr_t blkno;
int part;
+ if (!slice->handler_up)
+ return (0);
blkno = *(daddr_t *)addr;
pd = slice->private_up;
sdp = pd->subdevs;
@@ -868,3 +872,17 @@ mbr_upconfig(struct slice *slice, int cmd, caddr_t addr,
return (0);
}
+static int
+mbr_dump(void *private, int32_t blkoff, int32_t blkcnt)
+{
+ struct private_data *pd;
+ struct subdev *sdp;
+ register struct slice *slice;
+
+RR;
+ sdp = private;
+ pd = sdp->pd;
+ slice = pd->slice_down;
+ blkoff += sdp->offset;
+ return (*slice->handler_down->dump)(slice->private_down, blkoff, blkcnt);
+}
diff --git a/sys/dev/slice/slice.h b/sys/dev/slice/slice.h
index 553bdb5..ee7cd36 100644
--- a/sys/dev/slice/slice.h
+++ b/sys/dev/slice/slice.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: $
+ * $Id: slice.h,v 1.1 1998/04/19 23:31:10 julian Exp $
*/
typedef struct slice_handler *sh_p;
@@ -125,6 +125,7 @@ typedef int sl_h_claim_t(struct slice * slice, struct slice * lower,
typedef int sl_h_verify_t(struct slice *slice);
typedef int sl_h_upconfig_t(struct slice *slice, int cmd, caddr_t data,
int fflag, struct proc *p);
+typedef int sl_h_dump_t(void *private, int32_t blkoff, int32_t blkcnt);
struct slice_handler {
char *name;
@@ -140,6 +141,7 @@ struct slice_handler {
sl_h_claim_t *claim; /* claim a new slice */
sl_h_verify_t *verify; /* verify that a slice as it was before */
sl_h_upconfig_t *upconf; /* config requests from slice below */
+ sl_h_dump_t *dump; /* dump the core */
};
/*
diff --git a/sys/dev/slice/slice_device.c b/sys/dev/slice/slice_device.c
index d471bd4..d5c418a 100644
--- a/sys/dev/slice/slice_device.c
+++ b/sys/dev/slice/slice_device.c
@@ -23,9 +23,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: slice_device.c,v 1.3 1998/04/22 19:27:52 julian Exp $
+ * $Id: slice_device.c,v 1.4 1998/04/24 07:53:55 julian Exp $
*/
#define DIAGNOSTIC 1
+#include "opt_hw_wdog.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -39,7 +40,9 @@
#include <sys/devfsext.h> /* DEVFS defintitions */
#include <dev/slice/slice.h> /* temporary location */
-
+#include <vm/vm_param.h>
+#include <machine/md_var.h>
+#include <i386/i386/cons.h>
/* Function prototypes (these should all be static except for slicenew()) */
static d_open_t slcdevopen;
@@ -369,8 +372,26 @@ static int
slcdevdump(dev_t dev)
{
sl_p slice = minor_to_slice(minor(dev));
+ static int slcdoingdump = 0;
+ int32_t num, nblocks, lo;
RR;
- if (slice == NULL)
+ if (!slice || !(slice->flags & SLF_OPEN_DEV_WR) ||
+ !slice->handler_down->dump)
return (ENXIO);
- return (0);
+
+ /* Toss any characters present prior to dump. */
+ while (cncheckc() != -1)
+ ;
+
+ if (slcdoingdump)
+ return (EFAULT);
+
+ num = (int32_t)(Maxmem * PAGE_SIZE / slice->limits.blksize);
+ nblocks = (int32_t)(slice->limits.slicesize / slice->limits.blksize);
+ lo = dumplo * DEV_BSIZE / slice->limits.blksize;
+ if (lo < 0 || lo + num > nblocks)
+ return (EINVAL);
+
+ slcdoingdump = 1;
+ return (*slice->handler_down->dump)(slice->private_down, lo, num);
}
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 0ee8871..516a9f8 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -38,7 +38,7 @@
* from: Utah Hdr: vn.c 1.13 94/04/02
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
- * $Id: vn.c,v 1.57 1998/04/22 10:25:12 julian Exp $
+ * $Id: vn.c,v 1.58 1998/04/24 07:53:59 julian Exp $
*/
/*
@@ -114,6 +114,7 @@ static sl_h_IO_req_t nvsIOreq; /* IO req downward (to device) */
static sl_h_ioctl_t nvsioctl; /* ioctl req downward (to device) */
static sl_h_open_t nvsopen; /* downwards travelling open */
/*static sl_h_close_t nvsclose; */ /* downwards travelling close */
+static sl_h_dump_t nvsdump; /* core dump req downward */
static struct slice_handler slicetype = {
"vn",
@@ -128,7 +129,8 @@ static struct slice_handler slicetype = {
NULL, /* revoke */
NULL, /* claim */
NULL, /* verify */
- NULL /* upconfig */
+ NULL, /* upconfig */
+ &nvsdump
};
#endif
@@ -448,6 +450,14 @@ nvsIOreq(void *private ,struct buf *bp)
bn = bp->b_pblkno;
bp->b_resid = bp->b_bcount;/* XXX best place to set this? */
sz = howmany(bp->b_bcount, DEV_BSIZE);
+ if (bn < 0 || bn + sz > vn->sc_size) {
+ if (bn != vn->sc_size) {
+ bp->b_error = EINVAL;
+ bp->b_flags |= B_ERROR;
+ }
+ biodone(bp);
+ return;
+ }
if( (bp->b_flags & B_PAGING) == 0) {
aiov.iov_base = bp->b_data;
@@ -936,5 +946,10 @@ nvsioctl( void *private, int cmd, caddr_t addr, int flag, struct proc *p)
return(vnioctl(makedev(0,vn->mynor), cmd, addr, flag, p));
}
+static int
+nvsdump(void *private, int32_t blkoff, int32_t blkcnt)
+{
+ return (ENODEV);
+}
#endif
#endif
OpenPOWER on IntegriCloud