1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 12 unchanged lines hidden (view full) ---
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/geom/geom_fox.c 133314 2004-08-08 06:49:07Z phk $
30 *
31 * This is a GEOM module for handling path selection for multi-path
32 * storage devices. It is named "fox" because it, like they, prefer
33 * to have multiple exits to choose from.
34 *
35 */
36
37#include <sys/param.h>
--- 314 unchanged lines hidden (view full) ---
352 g_trace(G_T_TOPOLOGY, "fox_taste(%s, %s)", mp->name, pp->name);
353 g_topology_assert();
354 if (!strcmp(pp->geom->class->name, mp->name))
355 return (NULL);
356 gp = g_new_geomf(mp, "%s.fox", pp->name);
357 gp->softc = g_malloc(sizeof(struct g_fox_softc), M_WAITOK | M_ZERO);
358 sc = gp->softc;
359
360 cp = g_new_consumer(gp);
361 g_attach(cp, pp);
362 error = g_access(cp, 1, 0, 0);
363 if (error) {
364 g_free(sc);
365 g_detach(cp);
366 g_destroy_consumer(cp);
367 g_destroy_geom(gp);
--- 89 unchanged lines hidden (view full) ---
457 g_wither_geom(gp, ENXIO);
458 return (0);
459}
460
461static struct g_class g_fox_class = {
462 .name = FOX_CLASS_NAME,
463 .taste = g_fox_taste,
464 .destroy_geom = g_fox_destroy_geom,
465 .start = g_fox_start,
466 .spoiled = g_fox_orphan,
467 .orphan = g_fox_orphan,
468 .access= g_fox_access,
469};
470
471DECLARE_GEOM_CLASS(g_fox_class, g_fox);
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 12 unchanged lines hidden (view full) ---
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/geom/geom_fox.c 133314 2004-08-08 06:49:07Z phk $
30 *
31 * This is a GEOM module for handling path selection for multi-path
32 * storage devices. It is named "fox" because it, like they, prefer
33 * to have multiple exits to choose from.
34 *
35 */
36
37#include <sys/param.h>
--- 314 unchanged lines hidden (view full) ---
352 g_trace(G_T_TOPOLOGY, "fox_taste(%s, %s)", mp->name, pp->name);
353 g_topology_assert();
354 if (!strcmp(pp->geom->class->name, mp->name))
355 return (NULL);
356 gp = g_new_geomf(mp, "%s.fox", pp->name);
357 gp->softc = g_malloc(sizeof(struct g_fox_softc), M_WAITOK | M_ZERO);
358 sc = gp->softc;
359
360 cp = g_new_consumer(gp);
361 g_attach(cp, pp);
362 error = g_access(cp, 1, 0, 0);
363 if (error) {
364 g_free(sc);
365 g_detach(cp);
366 g_destroy_consumer(cp);
367 g_destroy_geom(gp);
--- 89 unchanged lines hidden (view full) ---
457 g_wither_geom(gp, ENXIO);
458 return (0);
459}
460
461static struct g_class g_fox_class = {
462 .name = FOX_CLASS_NAME,
463 .taste = g_fox_taste,
464 .destroy_geom = g_fox_destroy_geom,
465 .start = g_fox_start,
466 .spoiled = g_fox_orphan,
467 .orphan = g_fox_orphan,
468 .access= g_fox_access,
469};
470
471DECLARE_GEOM_CLASS(g_fox_class, g_fox);