Date: Thu, 24 Mar 2011 08:37:48 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219950 - head/sys/geom Message-ID: <201103240837.p2O8bmKh022666@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Mar 24 08:37:48 2011 New Revision: 219950 URL: http://svn.freebsd.org/changeset/base/219950 Log: MFgraid/head r217827: 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: head/sys/geom/geom.h head/sys/geom/geom_dev.c head/sys/geom/geom_disk.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Thu Mar 24 07:59:21 2011 (r219949) +++ head/sys/geom/geom.h Thu Mar 24 08:37:48 2011 (r219950) @@ -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> @@ -303,6 +304,7 @@ extern struct sx topology_lock; struct g_kerneldump { off_t offset; off_t length; + struct dumperinfo di; }; MALLOC_DECLARE(M_GEOM); Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Thu Mar 24 07:59:21 2011 (r219949) +++ head/sys/geom/geom_dev.c Thu Mar 24 08:37:48 2011 (r219950) @@ -289,8 +289,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: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Thu Mar 24 07:59:21 2011 (r219949) +++ head/sys/geom/geom_disk.c Thu Mar 24 08:37:48 2011 (r219950) @@ -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> @@ -163,10 +162,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; @@ -177,16 +174,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?201103240837.p2O8bmKh022666>