From owner-p4-projects@FreeBSD.ORG Wed Jan 4 05:53:41 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6A3AD16A422; Wed, 4 Jan 2006 05:53:41 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4051D16A41F for ; Wed, 4 Jan 2006 05:53:41 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1FC343D55 for ; Wed, 4 Jan 2006 05:53:40 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k045refr065893 for ; Wed, 4 Jan 2006 05:53:40 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k045rei6065890 for perforce@freebsd.org; Wed, 4 Jan 2006 05:53:40 GMT (envelope-from scottl@freebsd.org) Date: Wed, 4 Jan 2006 05:53:40 GMT Message-Id: <200601040553.k045rei6065890@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 89125 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2006 05:53:42 -0000 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;