geom_disk.c (119652) | geom_disk.c (119660) |
---|---|
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 --- 20 unchanged lines hidden (view full) --- 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 36#include <sys/cdefs.h> | 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 --- 20 unchanged lines hidden (view full) --- 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 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 119652 2003-09-01 12:03:13Z phk $"); | 37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 119660 2003-09-01 20:45:32Z phk $"); |
38 39#include "opt_geom.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/sysctl.h> 45#include <sys/bio.h> --- 143 unchanged lines hidden (view full) --- 189 if (bp2->bio_children == bp2->bio_inbed) { 190 bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed; 191 devstat_end_transaction_bio(dp->d_devstat, bp2); 192 g_io_deliver(bp2, bp2->bio_error); 193 } 194 mtx_unlock(&g_disk_done_mtx); 195} 196 | 38 39#include "opt_geom.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/sysctl.h> 45#include <sys/bio.h> --- 143 unchanged lines hidden (view full) --- 189 if (bp2->bio_children == bp2->bio_inbed) { 190 bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed; 191 devstat_end_transaction_bio(dp->d_devstat, bp2); 192 g_io_deliver(bp2, bp2->bio_error); 193 } 194 mtx_unlock(&g_disk_done_mtx); 195} 196 |
197static int 198g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, struct thread *td) 199{ 200 struct g_geom *gp; 201 struct disk *dp; 202 int error; 203 204 gp = pp->geom; 205 dp = gp->softc; 206 207 if (dp->d_ioctl == NULL) 208 return (ENOIOCTL); 209 g_disk_lock_giant(dp); 210 error = dp->d_ioctl(dp, cmd, data, 0, td); 211 g_disk_unlock_giant(dp); 212 return(error); 213} 214 |
|
197static void 198g_disk_start(struct bio *bp) 199{ 200 struct bio *bp2, *bp3; 201 struct disk *dp; | 215static void 216g_disk_start(struct bio *bp) 217{ 218 struct bio *bp2, *bp3; 219 struct disk *dp; |
202 struct g_ioctl *gio; | |
203 int error; 204 off_t off; 205 206 dp = bp->bio_to->geom->softc; 207 if (dp == NULL) 208 g_io_deliver(bp, ENXIO); 209 error = EJUSTRETURN; 210 switch(bp->bio_cmd) { --- 48 unchanged lines hidden (view full) --- 259 if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_fwsectors)) 260 break; 261 else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_fwheads)) 262 break; 263 else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) 264 break; 265 else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) 266 g_disk_kerneldump(bp, dp); | 220 int error; 221 off_t off; 222 223 dp = bp->bio_to->geom->softc; 224 if (dp == NULL) 225 g_io_deliver(bp, ENXIO); 226 error = EJUSTRETURN; 227 switch(bp->bio_cmd) { --- 48 unchanged lines hidden (view full) --- 276 if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_fwsectors)) 277 break; 278 else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_fwheads)) 279 break; 280 else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) 281 break; 282 else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) 283 g_disk_kerneldump(bp, dp); |
267 else if ((g_debugflags & G_F_DISKIOCTL) && 268 (dp->d_ioctl != NULL) && 269 !strcmp(bp->bio_attribute, "GEOM::ioctl") && 270 bp->bio_length == sizeof *gio) { 271 gio = (struct g_ioctl *)bp->bio_data; 272 gio->dev = dp; 273 gio->func = (d_ioctl_t *)(dp->d_ioctl); 274 error = EDIRIOCTL; 275 } else | 284 else |
276 error = ENOIOCTL; 277 break; 278 default: 279 error = EOPNOTSUPP; 280 break; 281 } 282 if (error != EJUSTRETURN) 283 g_io_deliver(bp, error); --- 28 unchanged lines hidden (view full) --- 312 313 if (flag == EV_CANCEL) 314 return; 315 g_topology_assert(); 316 dp = arg; 317 gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); 318 gp->start = g_disk_start; 319 gp->access = g_disk_access; | 285 error = ENOIOCTL; 286 break; 287 default: 288 error = EOPNOTSUPP; 289 break; 290 } 291 if (error != EJUSTRETURN) 292 g_io_deliver(bp, error); --- 28 unchanged lines hidden (view full) --- 321 322 if (flag == EV_CANCEL) 323 return; 324 g_topology_assert(); 325 dp = arg; 326 gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); 327 gp->start = g_disk_start; 328 gp->access = g_disk_access; |
329 gp->ioctl = g_disk_ioctl; |
|
320 gp->softc = dp; 321 gp->dumpconf = g_disk_dumpconf; 322 pp = g_new_providerf(gp, "%s", gp->name); 323 pp->mediasize = dp->d_mediasize; 324 pp->sectorsize = dp->d_sectorsize; 325 if (dp->d_flags & DISKFLAG_CANDELETE) 326 pp->flags |= G_PF_CANDELETE; 327 pp->stripeoffset = dp->d_stripeoffset; --- 90 unchanged lines hidden --- | 330 gp->softc = dp; 331 gp->dumpconf = g_disk_dumpconf; 332 pp = g_new_providerf(gp, "%s", gp->name); 333 pp->mediasize = dp->d_mediasize; 334 pp->sectorsize = dp->d_sectorsize; 335 if (dp->d_flags & DISKFLAG_CANDELETE) 336 pp->flags |= G_PF_CANDELETE; 337 pp->stripeoffset = dp->d_stripeoffset; --- 90 unchanged lines hidden --- |