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_dev.c 133314 2004-08-08 06:49:07Z phk $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/malloc.h>
42#include <sys/kernel.h>
43#include <sys/conf.h>
44#include <sys/bio.h>
45#include <sys/lock.h>
--- 26 unchanged lines hidden (view full) ---
72};
73
74static g_taste_t g_dev_taste;
75static g_orphan_t g_dev_orphan;
76
77static struct g_class g_dev_class = {
78 .name = "DEV",
79 .taste = g_dev_taste,
80 .orphan = g_dev_orphan,
81};
82
83void
84g_dev_print(void)
85{
86 struct g_geom *gp;
87 char const *p = "";
88
--- 28 unchanged lines hidden (view full) ---
117 struct cdev *dev;
118
119 g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
120 g_topology_assert();
121 LIST_FOREACH(cp, &pp->consumers, consumers)
122 if (cp->geom->class == mp)
123 return (NULL);
124 gp = g_new_geomf(mp, pp->name);
125 cp = g_new_consumer(gp);
126 error = g_attach(cp, pp);
127 KASSERT(error == 0,
128 ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error));
129 /*
130 * XXX: I'm not 100% sure we can call make_dev(9) without Giant
131 * yet. Once we can, we don't need to drop topology here either.
132 */
--- 281 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_dev.c 133314 2004-08-08 06:49:07Z phk $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/malloc.h>
42#include <sys/kernel.h>
43#include <sys/conf.h>
44#include <sys/bio.h>
45#include <sys/lock.h>
--- 26 unchanged lines hidden (view full) ---
72};
73
74static g_taste_t g_dev_taste;
75static g_orphan_t g_dev_orphan;
76
77static struct g_class g_dev_class = {
78 .name = "DEV",
79 .taste = g_dev_taste,
80 .orphan = g_dev_orphan,
81};
82
83void
84g_dev_print(void)
85{
86 struct g_geom *gp;
87 char const *p = "";
88
--- 28 unchanged lines hidden (view full) ---
117 struct cdev *dev;
118
119 g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
120 g_topology_assert();
121 LIST_FOREACH(cp, &pp->consumers, consumers)
122 if (cp->geom->class == mp)
123 return (NULL);
124 gp = g_new_geomf(mp, pp->name);
125 cp = g_new_consumer(gp);
126 error = g_attach(cp, pp);
127 KASSERT(error == 0,
128 ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error));
129 /*
130 * XXX: I'm not 100% sure we can call make_dev(9) without Giant
131 * yet. Once we can, we don't need to drop topology here either.
132 */
--- 281 unchanged lines hidden ---