Module Name: src Committed By: martin Date: Sat Mar 21 15:52:10 UTC 2020
Modified Files: src/sys/arch/xen/xen [netbsd-9]: xbd_xenbus.c src/sys/dev [netbsd-9]: cgd.c dksubr.c dkvar.h ld.c src/sys/dev/ata [netbsd-9]: wd.c src/sys/dev/raidframe [netbsd-9]: rf_netbsdkintf.c src/sys/dev/scsipi [netbsd-9]: sd.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #795): sys/dev/dksubr.c: revision 1.112 sys/arch/xen/xen/xbd_xenbus.c: revision 1.95 sys/dev/scsipi/sd.c: revision 1.328 sys/dev/dkvar.h: revision 1.32 sys/dev/ld.c: revision 1.109 sys/dev/cgd.c: revision 1.120 sys/dev/raidframe/rf_netbsdkintf.c: revision 1.380 sys/dev/ata/wd.c: revision 1.458 Add a flag to dk_dump for virtual disk devices. If a disk is backed by a physical medium other than itself, such as cgd(4), then it passes DK_DUMP_RECURSIVE to disable the recursion detection for dk_dump. If, however, a device represents a physical medium on its own, such as wd(4), then it passes 0 instead. With this, I can now dump to dk on cgd on dk on wd. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/xen/xen/xbd_xenbus.c cvs rdiff -u -r1.116.10.1 -r1.116.10.2 src/sys/dev/cgd.c cvs rdiff -u -r1.109 -r1.109.2.1 src/sys/dev/dksubr.c cvs rdiff -u -r1.30 -r1.30.10.1 src/sys/dev/dkvar.h cvs rdiff -u -r1.106.4.1 -r1.106.4.2 src/sys/dev/ld.c cvs rdiff -u -r1.452.2.1 -r1.452.2.2 src/sys/dev/ata/wd.c cvs rdiff -u -r1.376 -r1.376.4.1 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.327 -r1.327.4.1 src/sys/dev/scsipi/sd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/xbd_xenbus.c diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.92 src/sys/arch/xen/xen/xbd_xenbus.c:1.92.4.1 --- src/sys/arch/xen/xen/xbd_xenbus.c:1.92 Sat Feb 2 12:32:55 2019 +++ src/sys/arch/xen/xen/xbd_xenbus.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbd_xenbus.c,v 1.92 2019/02/02 12:32:55 cherry Exp $ */ +/* $NetBSD: xbd_xenbus.c,v 1.92.4.1 2020/03/21 15:52:09 martin Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.92 2019/02/02 12:32:55 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.92.4.1 2020/03/21 15:52:09 martin Exp $"); #include "opt_xen.h" @@ -930,7 +930,7 @@ xbddump(dev_t dev, daddr_t blkno, void * DPRINTF(("xbddump(%d, %" PRId64 ", %p, %lu)\n", dev, blkno, va, (unsigned long)size)); - return dk_dump(&sc->sc_dksc, dev, blkno, va, size); + return dk_dump(&sc->sc_dksc, dev, blkno, va, size, 0); } static int Index: src/sys/dev/cgd.c diff -u src/sys/dev/cgd.c:1.116.10.1 src/sys/dev/cgd.c:1.116.10.2 --- src/sys/dev/cgd.c:1.116.10.1 Sat Mar 21 15:18:57 2020 +++ src/sys/dev/cgd.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.116.10.1 2020/03/21 15:18:57 martin Exp $ */ +/* $NetBSD: cgd.c,v 1.116.10.2 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.1 2020/03/21 15:18:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.2 2020/03/21 15:52:09 martin Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -770,7 +770,7 @@ cgddump(dev_t dev, daddr_t blkno, void * DPRINTF_FOLLOW(("cgddump(0x%"PRIx64", %" PRId64 ", %p, %lu)\n", dev, blkno, va, (unsigned long)size)); GETCGD_SOFTC(cs, dev); - return dk_dump(&cs->sc_dksc, dev, blkno, va, size); + return dk_dump(&cs->sc_dksc, dev, blkno, va, size, DK_DUMP_RECURSIVE); } /* Index: src/sys/dev/dksubr.c diff -u src/sys/dev/dksubr.c:1.109 src/sys/dev/dksubr.c:1.109.2.1 --- src/sys/dev/dksubr.c:1.109 Fri Jun 28 14:56:46 2019 +++ src/sys/dev/dksubr.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $ */ +/* $NetBSD: dksubr.c,v 1.109.2.1 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.109.2.1 2020/03/21 15:52:09 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -761,7 +761,7 @@ static volatile int dk_dumping = 0; /* ARGSUSED */ int dk_dump(struct dk_softc *dksc, dev_t dev, - daddr_t blkno, void *vav, size_t size) + daddr_t blkno, void *vav, size_t size, int flags) { const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver; struct disk_geom *dg = &dksc->sc_dkdev.dk_geom; @@ -784,7 +784,8 @@ dk_dump(struct dk_softc *dksc, dev_t dev /* ensure that we are not already dumping */ if (dk_dumping) return EFAULT; - dk_dumping = 1; + if ((flags & DK_DUMP_RECURSIVE) == 0) + dk_dumping = 1; if (dkd->d_dumpblocks == NULL) { DPRINTF(DKDB_DUMP, ("%s: no dumpblocks\n", __func__)); @@ -863,7 +864,8 @@ dk_dump(struct dk_softc *dksc, dev_t dev va += nblk * lp->d_secsize; } - dk_dumping = 0; + if ((flags & DK_DUMP_RECURSIVE) == 0) + dk_dumping = 0; return 0; } Index: src/sys/dev/dkvar.h diff -u src/sys/dev/dkvar.h:1.30 src/sys/dev/dkvar.h:1.30.10.1 --- src/sys/dev/dkvar.h:1.30 Wed Nov 1 19:15:31 2017 +++ src/sys/dev/dkvar.h Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dkvar.h,v 1.30 2017/11/01 19:15:31 mlelstv Exp $ */ +/* $NetBSD: dkvar.h,v 1.30.10.1 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -83,6 +83,8 @@ struct dk_softc { ((_dksc)->sc_dkdev.dk_bopenmask & (_pmask) && \ ((_dksc)->sc_dkdev.dk_copenmask & (_pmask)))) +#define DK_DUMP_RECURSIVE __BIT(0) /* this is a virtual disk */ + /* * Functions that are exported to the pseudo disk implementations: */ @@ -106,7 +108,7 @@ int dk_size(struct dk_softc *, dev_t); int dk_ioctl(struct dk_softc *, dev_t, u_long, void *, int, struct lwp *); int dk_dump(struct dk_softc *, dev_t, - daddr_t, void *, size_t); + daddr_t, void *, size_t, int); void dk_getdisklabel(struct dk_softc *, dev_t); void dk_getdefaultlabel(struct dk_softc *, struct disklabel *); Index: src/sys/dev/ld.c diff -u src/sys/dev/ld.c:1.106.4.1 src/sys/dev/ld.c:1.106.4.2 --- src/sys/dev/ld.c:1.106.4.1 Tue Feb 11 08:37:34 2020 +++ src/sys/dev/ld.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ld.c,v 1.106.4.1 2020/02/11 08:37:34 martin Exp $ */ +/* $NetBSD: ld.c,v 1.106.4.2 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.106.4.1 2020/02/11 08:37:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.106.4.2 2020/03/21 15:52:09 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -507,7 +507,7 @@ lddump(dev_t dev, daddr_t blkno, void *v if ((sc->sc_flags & LDF_ENABLED) == 0) return (ENODEV); - return dk_dump(dksc, dev, blkno, va, size); + return dk_dump(dksc, dev, blkno, va, size, 0); } static int Index: src/sys/dev/ata/wd.c diff -u src/sys/dev/ata/wd.c:1.452.2.1 src/sys/dev/ata/wd.c:1.452.2.2 --- src/sys/dev/ata/wd.c:1.452.2.1 Sat Mar 21 15:18:57 2020 +++ src/sys/dev/ata/wd.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.452.2.1 2020/03/21 15:18:57 martin Exp $ */ +/* $NetBSD: wd.c,v 1.452.2.2 2020/03/21 15:52:09 martin Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,7 +54,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.452.2.1 2020/03/21 15:18:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.452.2.2 2020/03/21 15:52:09 martin Exp $"); #include "opt_ata.h" #include "opt_wd.h" @@ -1570,7 +1570,7 @@ wddump(dev_t dev, daddr_t blkno, void *v return (ENXIO); dksc = &wd->sc_dksc; - return dk_dump(dksc, dev, blkno, va, size); + return dk_dump(dksc, dev, blkno, va, size, 0); } static int Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.376 src/sys/dev/raidframe/rf_netbsdkintf.c:1.376.4.1 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.376 Fri Mar 1 11:06:56 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.376 2019/03/01 11:06:56 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.376.4.1 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: Utah $Hdr: cd.c 1.6 90/11/28$ + * from: Utah $Hdr$ * * @(#)cd.c 8.2 (Berkeley) 11/16/93 */ @@ -101,7 +101,7 @@ ***********************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.376 2019/03/01 11:06:56 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.376.4.1 2020/03/21 15:52:09 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -663,7 +663,7 @@ raiddump(dev_t dev, daddr_t blkno, void */ blkno += RF_PROTECTED_SECTORS; - return dk_dump(dksc, dev, blkno, va, size); + return dk_dump(dksc, dev, blkno, va, size, DK_DUMP_RECURSIVE); } static int Index: src/sys/dev/scsipi/sd.c diff -u src/sys/dev/scsipi/sd.c:1.327 src/sys/dev/scsipi/sd.c:1.327.4.1 --- src/sys/dev/scsipi/sd.c:1.327 Tue Mar 19 06:59:40 2019 +++ src/sys/dev/scsipi/sd.c Sat Mar 21 15:52:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.327 2019/03/19 06:59:40 mlelstv Exp $ */ +/* $NetBSD: sd.c,v 1.327.4.1 2020/03/21 15:52:09 martin Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -47,7 +47,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.327 2019/03/19 06:59:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.327.4.1 2020/03/21 15:52:09 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_scsi.h" @@ -1192,7 +1192,7 @@ sddump(dev_t dev, daddr_t blkno, void *v if ((periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) return (ENXIO); - return dk_dump(dksc, dev, blkno, va, size); + return dk_dump(dksc, dev, blkno, va, size, 0); } static int