geom_subr.c (e805e8f0e8f9f762bfb5bffd72380a1b101b1a8b) geom_subr.c (b1876192f015b1cf392b52b82b124265fc9683a7)
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

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

53#include <sys/proc.h>
54#include <sys/kthread.h>
55#include <sys/lock.h>
56#include <sys/mutex.h>
57#endif
58#include <sys/errno.h>
59#include <sys/sbuf.h>
60#include <geom/geom.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

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

53#include <sys/proc.h>
54#include <sys/kthread.h>
55#include <sys/lock.h>
56#include <sys/mutex.h>
57#endif
58#include <sys/errno.h>
59#include <sys/sbuf.h>
60#include <geom/geom.h>
61#include <geom/geom_int.h>
61#include <machine/stdarg.h>
62
63struct class_list_head g_classs = LIST_HEAD_INITIALIZER(g_classs);
64static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms);
65static int g_nproviders;
66char *g_wait_event, *g_wait_up, *g_wait_down, *g_wait_sim;
67
68static int g_ignition;

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

585 sbuf_vprintf(sb, fmt, ap);
586 sbuf_finish(sb);
587 mtx_unlock(&Giant);
588 s = sbuf_data(sb);
589 } else {
590 s = NULL;
591 }
592 if (pp != NULL)
62#include <machine/stdarg.h>
63
64struct class_list_head g_classs = LIST_HEAD_INITIALIZER(g_classs);
65static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms);
66static int g_nproviders;
67char *g_wait_event, *g_wait_up, *g_wait_down, *g_wait_sim;
68
69static int g_ignition;

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

586 sbuf_vprintf(sb, fmt, ap);
587 sbuf_finish(sb);
588 mtx_unlock(&Giant);
589 s = sbuf_data(sb);
590 } else {
591 s = NULL;
592 }
593 if (pp != NULL)
593 gp = mp->taste(mp, pp, NULL, G_TF_INSIST);
594 gp = mp->taste(mp, pp, G_TF_INSIST);
594 if (gp == NULL && mp->create_geom == NULL)
595 return (NULL);
596 if (gp == NULL)
597 gp = mp->create_geom(mp, pp, s);
598 /* XXX: delete sbuf */
599 return (gp);
600}
601

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

613 KASSERT(cp->provider != NULL, ("g_insert_geomf but not attached"));
614 /* XXX: check for events ?? */
615 mp = g_class_by_name(class);
616 if (mp == NULL)
617 return (NULL);
618 if (mp->create_geom == NULL)
619 return (NULL);
620 pp = cp->provider;
595 if (gp == NULL && mp->create_geom == NULL)
596 return (NULL);
597 if (gp == NULL)
598 gp = mp->create_geom(mp, pp, s);
599 /* XXX: delete sbuf */
600 return (gp);
601}
602

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

614 KASSERT(cp->provider != NULL, ("g_insert_geomf but not attached"));
615 /* XXX: check for events ?? */
616 mp = g_class_by_name(class);
617 if (mp == NULL)
618 return (NULL);
619 if (mp->create_geom == NULL)
620 return (NULL);
621 pp = cp->provider;
621 gp = mp->taste(mp, pp, NULL, G_TF_TRANSPARENT);
622 gp = mp->taste(mp, pp, G_TF_TRANSPARENT);
622 if (gp == NULL)
623 return (NULL);
624 pp2 = LIST_FIRST(&gp->provider);
625 cp2 = LIST_FIRST(&gp->consumer);
626 cp2->acr += pp->acr;
627 cp2->acw += pp->acw;
628 cp2->ace += pp->ace;
629 pp2->acr += pp->acr;
630 pp2->acw += pp->acw;
631 pp2->ace += pp->ace;
632 LIST_REMOVE(cp, consumers);
633 LIST_INSERT_HEAD(&pp2->consumers, cp, consumers);
634 cp->provider = pp2;
635 error = redo_rank(gp);
636 KASSERT(error == 0, ("redo_rank failed in g_insert_geom"));
637 return (gp);
638}
639
623 if (gp == NULL)
624 return (NULL);
625 pp2 = LIST_FIRST(&gp->provider);
626 cp2 = LIST_FIRST(&gp->consumer);
627 cp2->acr += pp->acr;
628 cp2->acw += pp->acw;
629 cp2->ace += pp->ace;
630 pp2->acr += pp->acr;
631 pp2->acw += pp->acw;
632 pp2->ace += pp->ace;
633 LIST_REMOVE(cp, consumers);
634 LIST_INSERT_HEAD(&pp2->consumers, cp, consumers);
635 cp->provider = pp2;
636 error = redo_rank(gp);
637 KASSERT(error == 0, ("redo_rank failed in g_insert_geom"));
638 return (gp);
639}
640