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_subr.c 237518 2012-06-24 04:29:03Z ken $");
38
39#include "opt_ddb.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/devicestat.h>
44#include <sys/kernel.h>
45#include <sys/malloc.h>
--- 300 unchanged lines hidden (view full) ---
346 LIST_INSERT_HEAD(&mp->geom, gp, geom);
347 TAILQ_INSERT_HEAD(&geoms, gp, geoms);
348 strcpy(gp->name, sbuf_data(sb));
349 sbuf_delete(sb);
350 /* Fill in defaults from class */
351 gp->start = mp->start;
352 gp->spoiled = mp->spoiled;
353 gp->attrchanged = mp->attrchanged;
354 gp->providergone = mp->providergone;
355 gp->dumpconf = mp->dumpconf;
356 gp->access = mp->access;
357 gp->orphan = mp->orphan;
358 gp->ioctl = mp->ioctl;
359 return (gp);
360}
361
362void
--- 267 unchanged lines hidden (view full) ---
630 ("g_destroy_provider but attached"));
631 KASSERT (pp->acr == 0, ("g_destroy_provider with acr"));
632 KASSERT (pp->acw == 0, ("g_destroy_provider with acw"));
633 KASSERT (pp->ace == 0, ("g_destroy_provider with ace"));
634 g_cancel_event(pp);
635 LIST_REMOVE(pp, provider);
636 gp = pp->geom;
637 devstat_remove_entry(pp->stat);
638 /*
639 * If a callback was provided, send notification that the provider
640 * is now gone.
641 */
642 if (gp->providergone != NULL)
643 gp->providergone(pp);
644
645 g_free(pp);
646 if ((gp->flags & G_GEOM_WITHER))
647 g_do_wither();
648}
649
650/*
651 * We keep the "geoms" list sorted by topological order (== increasing
652 * numerical rank) at all times.
--- 740 unchanged lines hidden ---
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_subr.c 237518 2012-06-24 04:29:03Z ken $");
38
39#include "opt_ddb.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/devicestat.h>
44#include <sys/kernel.h>
45#include <sys/malloc.h>
--- 300 unchanged lines hidden (view full) ---
346 LIST_INSERT_HEAD(&mp->geom, gp, geom);
347 TAILQ_INSERT_HEAD(&geoms, gp, geoms);
348 strcpy(gp->name, sbuf_data(sb));
349 sbuf_delete(sb);
350 /* Fill in defaults from class */
351 gp->start = mp->start;
352 gp->spoiled = mp->spoiled;
353 gp->attrchanged = mp->attrchanged;
354 gp->providergone = mp->providergone;
355 gp->dumpconf = mp->dumpconf;
356 gp->access = mp->access;
357 gp->orphan = mp->orphan;
358 gp->ioctl = mp->ioctl;
359 return (gp);
360}
361
362void
--- 267 unchanged lines hidden (view full) ---
630 ("g_destroy_provider but attached"));
631 KASSERT (pp->acr == 0, ("g_destroy_provider with acr"));
632 KASSERT (pp->acw == 0, ("g_destroy_provider with acw"));
633 KASSERT (pp->ace == 0, ("g_destroy_provider with ace"));
634 g_cancel_event(pp);
635 LIST_REMOVE(pp, provider);
636 gp = pp->geom;
637 devstat_remove_entry(pp->stat);
638 /*
639 * If a callback was provided, send notification that the provider
640 * is now gone.
641 */
642 if (gp->providergone != NULL)
643 gp->providergone(pp);
644
645 g_free(pp);
646 if ((gp->flags & G_GEOM_WITHER))
647 g_do_wither();
648}
649
650/*
651 * We keep the "geoms" list sorted by topological order (== increasing
652 * numerical rank) at all times.
--- 740 unchanged lines hidden ---