geom_disk.c (227309) | geom_disk.c (237518) |
---|---|
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 227309 2011-11-07 15:43:11Z ed $"); | 37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 237518 2012-06-24 04:29:03Z ken $"); |
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> --- 24 unchanged lines hidden (view full) --- 70static struct mtx g_disk_done_mtx; 71 72static g_access_t g_disk_access; 73static g_init_t g_disk_init; 74static g_fini_t g_disk_fini; 75static g_start_t g_disk_start; 76static g_ioctl_t g_disk_ioctl; 77static g_dumpconf_t g_disk_dumpconf; | 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> --- 24 unchanged lines hidden (view full) --- 70static struct mtx g_disk_done_mtx; 71 72static g_access_t g_disk_access; 73static g_init_t g_disk_init; 74static g_fini_t g_disk_fini; 75static g_start_t g_disk_start; 76static g_ioctl_t g_disk_ioctl; 77static g_dumpconf_t g_disk_dumpconf; |
78static g_provgone_t g_disk_providergone; |
|
78 79static struct g_class g_disk_class = { 80 .name = "DISK", 81 .version = G_VERSION, 82 .init = g_disk_init, 83 .fini = g_disk_fini, 84 .start = g_disk_start, 85 .access = g_disk_access, 86 .ioctl = g_disk_ioctl, | 79 80static struct g_class g_disk_class = { 81 .name = "DISK", 82 .version = G_VERSION, 83 .init = g_disk_init, 84 .fini = g_disk_fini, 85 .start = g_disk_start, 86 .access = g_disk_access, 87 .ioctl = g_disk_ioctl, |
88 .providergone = g_disk_providergone, |
|
87 .dumpconf = g_disk_dumpconf, 88}; 89 90SYSCTL_DECL(_kern_geom); 91static SYSCTL_NODE(_kern_geom, OID_AUTO, disk, CTLFLAG_RW, 0, 92 "GEOM_DISK stuff"); 93 94static void --- 387 unchanged lines hidden (view full) --- 482 CTLFLAG_RW | CTLFLAG_TUN, sc->led, sizeof(sc->led), 483 "LED name"); 484 } 485 pp->private = sc; 486 dp->d_geom = gp; 487 g_error_provider(pp, 0); 488} 489 | 89 .dumpconf = g_disk_dumpconf, 90}; 91 92SYSCTL_DECL(_kern_geom); 93static SYSCTL_NODE(_kern_geom, OID_AUTO, disk, CTLFLAG_RW, 0, 94 "GEOM_DISK stuff"); 95 96static void --- 387 unchanged lines hidden (view full) --- 484 CTLFLAG_RW | CTLFLAG_TUN, sc->led, sizeof(sc->led), 485 "LED name"); 486 } 487 pp->private = sc; 488 dp->d_geom = gp; 489 g_error_provider(pp, 0); 490} 491 |
492/* 493 * We get this callback after all of the consumers have gone away, and just 494 * before the provider is freed. If the disk driver provided a d_gone 495 * callback, let them know that it is okay to free resources -- they won't 496 * be getting any more accesses from GEOM. 497 */ |
|
490static void | 498static void |
499g_disk_providergone(struct g_provider *pp) 500{ 501 struct disk *dp; 502 struct g_disk_softc *sc; 503 504 sc = (struct g_disk_softc *)pp->geom->softc; 505 dp = sc->dp; 506 507 if (dp->d_gone != NULL) 508 dp->d_gone(dp); 509} 510 511static void |
|
491g_disk_destroy(void *ptr, int flag) 492{ 493 struct disk *dp; 494 struct g_geom *gp; 495 struct g_disk_softc *sc; 496 497 g_topology_assert(); 498 dp = ptr; --- 46 unchanged lines hidden (view full) --- 545 546 return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); 547} 548 549void 550disk_create(struct disk *dp, int version) 551{ 552 | 512g_disk_destroy(void *ptr, int flag) 513{ 514 struct disk *dp; 515 struct g_geom *gp; 516 struct g_disk_softc *sc; 517 518 g_topology_assert(); 519 dp = ptr; --- 46 unchanged lines hidden (view full) --- 566 567 return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); 568} 569 570void 571disk_create(struct disk *dp, int version) 572{ 573 |
553 if (version != DISK_VERSION_00 && version != DISK_VERSION_01) { | 574 if (version != DISK_VERSION_02) { |
554 printf("WARNING: Attempt to add disk %s%d %s", 555 dp->d_name, dp->d_unit, 556 " using incompatible ABI version of disk(9)\n"); 557 printf("WARNING: Ignoring disk %s%d\n", 558 dp->d_name, dp->d_unit); 559 return; 560 } 561 KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy")); --- 80 unchanged lines hidden --- | 575 printf("WARNING: Attempt to add disk %s%d %s", 576 dp->d_name, dp->d_unit, 577 " using incompatible ABI version of disk(9)\n"); 578 printf("WARNING: Ignoring disk %s%d\n", 579 dp->d_name, dp->d_unit); 580 return; 581 } 582 KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy")); --- 80 unchanged lines hidden --- |