summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-05-31 18:13:07 +0000
committerphk <phk@FreeBSD.org>2003-05-31 18:13:07 +0000
commit3325608f8fa53330fcc9b5026fa2c3b75952fb2b (patch)
tree3f90e7d4dfd582f7fd53c28d5179880e31ba2090 /sys/geom/geom_disk.c
parentb96117501d4c56f42bb3d80d9841e97999192258 (diff)
downloadFreeBSD-src-3325608f8fa53330fcc9b5026fa2c3b75952fb2b.zip
FreeBSD-src-3325608f8fa53330fcc9b5026fa2c3b75952fb2b.tar.gz
Introduce a init and fini member functions on a class.
Use ->init() and ->fini() to handle the mutex in geom_disk.c Remove the g_add_class() function and replace it with a standardized g_modevent() function. This adds the basic infrastructure for loading/unloading GEOM classes
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index a6ce15e..5bbb56d 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -58,21 +58,30 @@
static struct mtx g_disk_done_mtx;
static g_access_t g_disk_access;
+static g_init_t g_disk_init;
+static g_fini_t g_disk_fini;
struct g_class g_disk_class = {
.name = "DISK",
+ .init = g_disk_init,
+ .fini = g_disk_fini,
};
static void
-g_disk_init(void)
+g_disk_init(struct g_class *mp __unused)
{
- mtx_unlock(&Giant);
- g_add_class(&g_disk_class);
+
mtx_init(&g_disk_done_mtx, "g_disk_done", MTX_DEF, 0);
- mtx_lock(&Giant);
}
-DECLARE_GEOM_CLASS_INIT(g_disk_class, g_disk, g_disk_init);
+static void
+g_disk_fini(struct g_class *mp __unused)
+{
+
+ mtx_destroy(&g_disk_done_mtx);
+}
+
+DECLARE_GEOM_CLASS(g_disk_class, g_disk);
static void __inline
g_disk_lock_giant(struct disk *dp)
OpenPOWER on IntegriCloud