Date: Fri, 17 Jun 2011 05:55:41 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r223172 - stable/8/sys/geom Message-ID: <201106170555.p5H5tfRU062946@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Jun 17 05:55:41 2011 New Revision: 223172 URL: http://svn.freebsd.org/changeset/base/223172 Log: MFC r219950: Change BIO_GETATTR("GEOM::kerneldump") API to make set_dumper() called by consumer (geom_dev) instead of provider (geom_disk). This allows any geom insert it's code into the dump call chain, implementing more sophisticated functionality then just disk partitioning. Modified: stable/8/sys/geom/geom.h stable/8/sys/geom/geom_dev.c stable/8/sys/geom/geom_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/geom/geom.h ============================================================================== --- stable/8/sys/geom/geom.h Fri Jun 17 05:30:12 2011 (r223171) +++ stable/8/sys/geom/geom.h Fri Jun 17 05:55:41 2011 (r223172) @@ -43,6 +43,7 @@ #include <sys/sx.h> #include <sys/queue.h> #include <sys/ioccom.h> +#include <sys/conf.h> #include <sys/sbuf.h> #include <sys/module.h> @@ -304,6 +305,7 @@ extern struct sx topology_lock; struct g_kerneldump { off_t offset; off_t length; + struct dumperinfo di; }; MALLOC_DECLARE(M_GEOM); Modified: stable/8/sys/geom/geom_dev.c ============================================================================== --- stable/8/sys/geom/geom_dev.c Fri Jun 17 05:30:12 2011 (r223171) +++ stable/8/sys/geom/geom_dev.c Fri Jun 17 05:55:41 2011 (r223172) @@ -281,8 +281,11 @@ g_dev_ioctl(struct cdev *dev, u_long cmd kd.length = OFF_MAX; i = sizeof kd; error = g_io_getattr("GEOM::kerneldump", cp, &i, &kd); - if (!error) - dev->si_flags |= SI_DUMPDEV; + if (!error) { + error = set_dumper(&kd.di); + if (!error) + dev->si_flags |= SI_DUMPDEV; + } break; case DIOCGFLUSH: error = g_io_flush(cp); Modified: stable/8/sys/geom/geom_disk.c ============================================================================== --- stable/8/sys/geom/geom_disk.c Fri Jun 17 05:30:12 2011 (r223171) +++ stable/8/sys/geom/geom_disk.c Fri Jun 17 05:55:41 2011 (r223172) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/sysctl.h> #include <sys/bio.h> -#include <sys/conf.h> #include <sys/ctype.h> #include <sys/fcntl.h> #include <sys/malloc.h> @@ -169,10 +168,8 @@ g_disk_access(struct g_provider *pp, int static void g_disk_kerneldump(struct bio *bp, struct disk *dp) -{ - int error; +{ struct g_kerneldump *gkd; - struct dumperinfo di; struct g_geom *gp; gkd = (struct g_kerneldump*)bp->bio_data; @@ -183,16 +180,15 @@ g_disk_kerneldump(struct bio *bp, struct g_io_deliver(bp, ENODEV); return; } - di.dumper = dp->d_dump; - di.priv = dp; - di.blocksize = dp->d_sectorsize; - di.maxiosize = dp->d_maxsize; - di.mediaoffset = gkd->offset; + gkd->di.dumper = dp->d_dump; + gkd->di.priv = dp; + gkd->di.blocksize = dp->d_sectorsize; + gkd->di.maxiosize = dp->d_maxsize; + gkd->di.mediaoffset = gkd->offset; if ((gkd->offset + gkd->length) > dp->d_mediasize) gkd->length = dp->d_mediasize - gkd->offset; - di.mediasize = gkd->length; - error = set_dumper(&di); - g_io_deliver(bp, error); + gkd->di.mediasize = gkd->length; + g_io_deliver(bp, 0); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106170555.p5H5tfRU062946>