geom_dev.c (936cc4614b5187681f3a1c76a7740ead4845a548) geom_dev.c (801bb689ca8be76700b0c16c159683b5fa89472d)
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

--- 416 unchanged lines hidden (view full) ---

425g_dev_orphan(struct g_consumer *cp)
426{
427 struct g_geom *gp;
428 dev_t dev;
429
430 gp = cp->geom;
431 g_trace(G_T_TOPOLOGY, "g_dev_orphan(%p(%s))", cp, gp->name);
432 g_topology_assert();
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

--- 416 unchanged lines hidden (view full) ---

425g_dev_orphan(struct g_consumer *cp)
426{
427 struct g_geom *gp;
428 dev_t dev;
429
430 gp = cp->geom;
431 g_trace(G_T_TOPOLOGY, "g_dev_orphan(%p(%s))", cp, gp->name);
432 g_topology_assert();
433 if (cp->biocount > 0)
433 if (cp->stat.nop != cp->stat.nend) /* XXX ? */
434 return;
435 dev = gp->softc;
436 if (dev->si_flags & SI_DUMPDEV)
437 set_dumper(NULL);
438 /* XXX: we may need Giant for now */
439 destroy_dev(dev);
440 if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
441 g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace);
442 g_detach(cp);
443 g_destroy_consumer(cp);
444 g_destroy_geom(gp);
445}
446
447DECLARE_GEOM_CLASS(g_dev_class, g_dev);
434 return;
435 dev = gp->softc;
436 if (dev->si_flags & SI_DUMPDEV)
437 set_dumper(NULL);
438 /* XXX: we may need Giant for now */
439 destroy_dev(dev);
440 if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
441 g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace);
442 g_detach(cp);
443 g_destroy_consumer(cp);
444 g_destroy_geom(gp);
445}
446
447DECLARE_GEOM_CLASS(g_dev_class, g_dev);