Date: Wed, 4 Jan 2006 05:53:40 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 89125 for review Message-ID: <200601040553.k045rei6065890@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=89125 Change 89125 by scottl@scottl-junior on 2006/01/04 05:52:43 Use the modern disk API for the xen blockfront device. Affected files ... .. //depot/projects/xen3/src/sys/dev/xen/blkfront/blkfront.c#2 edit .. //depot/projects/xen3/src/sys/dev/xen/blkfront/block.h#2 edit Differences ... ==== //depot/projects/xen3/src/sys/dev/xen/blkfront/blkfront.c#2 (text+ko) ==== @@ -150,28 +150,30 @@ info->sc = sc; memset(&sc->xb_disk, 0, sizeof(sc->xb_disk)); - sc->xb_disk.d_unit = unit; - sc->xb_disk.d_open = blkif_open; - sc->xb_disk.d_close = blkif_close; - sc->xb_disk.d_ioctl = blkif_ioctl; - sc->xb_disk.d_strategy = xb_strategy; - sc->xb_disk.d_name = "xbd"; - sc->xb_disk.d_drv1 = sc; - sc->xb_disk.d_sectorsize = sector_size; + sc->xb_disk = disk_alloc(); + sc->xb_disk->d_unit = unit; + sc->xb_disk->d_open = blkif_open; + sc->xb_disk->d_close = blkif_close; + sc->xb_disk->d_ioctl = blkif_ioctl; + sc->xb_disk->d_strategy = xb_strategy; + sc->xb_disk->d_name = "xbd"; + sc->xb_disk->d_drv1 = sc; + sc->xb_disk->d_sectorsize = sector_size; /* XXX */ - sc->xb_disk.d_mediasize = capacity << XBD_SECTOR_SHFT; + sc->xb_disk->d_mediasize = capacity << XBD_SECTOR_SHFT; #if 0 - sc->xb_disk.d_maxsize = DFLTPHYS; + sc->xb_disk->d_maxsize = DFLTPHYS; #else /* XXX: xen can't handle large single i/o requests */ - sc->xb_disk.d_maxsize = 4096; + sc->xb_disk->d_maxsize = 4096; #endif #ifdef notyet XENPRINTF("attaching device 0x%x unit %d capacity %llu\n", xb_diskinfo[sc->xb_unit].device, sc->xb_unit, - sc->xb_disk.d_mediasize); + sc->xb_disk->d_mediasize); #endif - disk_create(&sc->xb_disk, DISK_VERSION_00); + sc->xb_disk->d_flags = 0; + disk_create(sc->xb_disk, DISK_VERSION_00); bioq_init(&sc->xb_bioq); return error; @@ -180,7 +182,10 @@ void xlvbd_del(struct blkfront_info *info) { - ; + struct xb_softc *sc; + + sc = info->sc; + disk_destroy(sc->xb_disk); } /************************ end VBD support *****************/ @@ -707,7 +712,7 @@ BLKIF_OP_WRITE; ring_req->sector_number= (blkif_sector_t)bp->bio_pblkno; - ring_req->handle = (unsigned long)&sc->xb_disk; + ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xb_disk; ring_req->nr_segments = 0; /* XXX not doing scatter/gather since buffer * chaining is not supported. ==== //depot/projects/xen3/src/sys/dev/xen/blkfront/block.h#2 (text+ko) ==== @@ -28,7 +28,7 @@ struct xb_softc { device_t xb_dev; - struct disk xb_disk; /* disk params */ + struct disk *xb_disk; /* disk params */ struct bio_queue_head xb_bioq; /* sort queue */ int xb_unit; int xb_flags;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601040553.k045rei6065890>