1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_disk.c 95038 2002-04-19 09:24:12Z phk $ |
36 */ 37 38#include "opt_geom.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/sysctl.h> --- 50 unchanged lines hidden (view full) --- 94 error = 0; 95 } 96 pp->mediasize = 97 dp->d_label.d_secsize * (off_t)dp->d_label.d_secperunit; 98 return (error); 99} 100 101static void |
102g_disk_kerneldump(struct bio *bp, struct disk *dp) 103{ 104 int error; 105 struct g_kerneldump *gkd; 106 struct dumperinfo di; 107 108 gkd = (struct g_kerneldump*)bp->bio_data; 109 printf("Kerneldump off=%lld len=%lld\n", gkd->offset, gkd->length); 110 di.dumper = (dumper_t *)dp->d_devsw->d_dump; 111 di.priv = dp->d_dev; 112 di.blocksize = dp->d_label.d_secsize; 113 di.mediaoffset = gkd->offset; 114 di.mediasize = gkd->length; 115 error = set_dumper(&di); 116 g_io_fail(bp, error); 117} 118 119static void |
120g_disk_done(struct bio *bp) 121{ 122 123 mtx_unlock(&Giant); 124 bp->bio_completed = bp->bio_length - bp->bio_resid; 125 g_std_done(bp); 126 mtx_lock(&Giant); 127} --- 33 unchanged lines hidden (view full) --- 161 else if (g_haveattr_int(bp, "GEOM::fwheads", 162 dp->d_label.d_ntracks)) 163 break; 164 else if (g_haveattr_off_t(bp, "GEOM::mediasize", 165 dp->d_label.d_secsize * (off_t)dp->d_label.d_secperunit)) 166 break; 167 else if (g_haveattr_off_t(bp, "GEOM::frontstuff", 0)) 168 break; |
169 else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) 170 g_disk_kerneldump(bp, dp); |
171 else if (!strcmp(bp->bio_attribute, "GEOM::ioctl") && 172 bp->bio_length == sizeof *gio) { 173 gio = (struct g_ioctl *)bp->bio_data; 174 mtx_lock(&Giant); 175 error = devsw(dev)->d_ioctl(dev, gio->cmd, 176 gio->data, gio->fflag, gio->td); 177 mtx_unlock(&Giant); 178 } else --- 81 unchanged lines hidden --- |