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 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 |
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 |
215static void 216g_disk_start(struct bio *bp) 217{ 218 struct bio *bp2, *bp3; 219 struct disk *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); |
284 else |
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; |
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 --- |