From 5721c9c76a4ab8ff2d7f9d6a9811d8f647b7d3b6 Mon Sep 17 00:00:00 2001
From: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Sun, 8 Aug 2004 07:57:53 +0000
Subject: Tag all geom classes in the tree with a version number.

---
 sys/dev/ata/atapi-cd.c             | 7 ++++---
 sys/dev/md/md.c                    | 1 +
 sys/geom/bde/g_bde.c               | 1 +
 sys/geom/concat/g_concat.c         | 1 +
 sys/geom/gate/g_gate.c             | 1 +
 sys/geom/geom_aes.c                | 1 +
 sys/geom/geom_apple.c              | 1 +
 sys/geom/geom_bsd.c                | 1 +
 sys/geom/geom_ccd.c                | 1 +
 sys/geom/geom_dev.c                | 1 +
 sys/geom/geom_disk.c               | 1 +
 sys/geom/geom_fox.c                | 1 +
 sys/geom/geom_gpt.c                | 1 +
 sys/geom/geom_mbr.c                | 2 ++
 sys/geom/geom_pc98.c               | 1 +
 sys/geom/geom_sunlabel.c           | 1 +
 sys/geom/geom_vol_ffs.c            | 2 ++
 sys/geom/label/g_label.c           | 1 +
 sys/geom/mirror/g_mirror.c         | 1 +
 sys/geom/nop/g_nop.c               | 1 +
 sys/geom/stripe/g_stripe.c         | 1 +
 sys/geom/vinum/geom_vinum.c        | 1 +
 sys/geom/vinum/geom_vinum_drive.c  | 1 +
 sys/geom/vinum/geom_vinum_plex.c   | 1 +
 sys/geom/vinum/geom_vinum_volume.c | 1 +
 sys/vm/swap_pager.c                | 8 +++++---
 26 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 7722a1b91ea9..bc7a0db0252f 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -98,6 +98,10 @@ static u_int32_t acd_lun_map = 0;
 static MALLOC_DEFINE(M_ACD, "ACD driver", "ATAPI CD driver buffers");
 static struct g_class acd_class = {
 	.name = "ACD",
+	.version = G_VERSION,
+	.access = acd_geom_access,
+	.ioctl = acd_geom_ioctl,
+	.start = acd_geom_start,
 };
 DECLARE_GEOM_CLASS(acd_class, acd);
 
@@ -249,9 +253,6 @@ acd_geom_create(void *arg, int flag)
     cdp = arg;
     g_topology_assert();
     gp = g_new_geomf(&acd_class, "acd%d", cdp->lun);
-    gp->access = acd_geom_access;
-    gp->ioctl = acd_geom_ioctl;
-    gp->start = acd_geom_start;
     gp->softc = cdp;
     cdp->gp = gp;
     pp = g_new_providerf(gp, "acd%d", cdp->lun);
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index eb5171fdf747..bc61930fb83d 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -123,6 +123,7 @@ static struct cdevsw mdctl_cdevsw = {
 
 struct g_class g_md_class = {
 	.name = "MD",
+	.version = G_VERSION,
 	.init = g_md_init,
 	.fini = g_md_fini,
 	.start = g_md_start,
diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c
index 73d85ab850f4..bb9cbf07f7df 100644
--- a/sys/geom/bde/g_bde.c
+++ b/sys/geom/bde/g_bde.c
@@ -272,6 +272,7 @@ g_bde_ctlreq(struct gctl_req *req, struct g_class *mp, char const *verb)
 
 static struct g_class g_bde_class	= {
 	.name = BDE_CLASS_NAME,
+	.version = G_VERSION,
 	.destroy_geom = g_bde_destroy_geom,
 	.ctlreq = g_bde_ctlreq,
 	.start = g_bde_start,
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index c87839d1a863..943ac2bff082 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -58,6 +58,7 @@ static g_dumpconf_t g_concat_dumpconf;
 
 struct g_class g_concat_class = {
 	.name = G_CONCAT_CLASS_NAME,
+	.version = G_VERSION,
 	.ctlreq = g_concat_config,
 	.taste = g_concat_taste,
 	.destroy_geom = g_concat_destroy_geom
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index f70068f31959..bf756595904f 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -60,6 +60,7 @@ static int g_gate_destroy_geom(struct gctl_req *, struct g_class *,
     struct g_geom *);
 struct g_class g_gate_class = {
 	.name = G_GATE_CLASS_NAME,
+	.version = G_VERSION,
 	.destroy_geom = g_gate_destroy_geom
 };
 
diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c
index ea0ce52f61b8..db073d4f13fa 100644
--- a/sys/geom/geom_aes.c
+++ b/sys/geom/geom_aes.c
@@ -364,6 +364,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 
 static struct g_class g_aes_class	= {
 	.name = AES_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_aes_taste,
 	.start = g_aes_start,
 	.orphan = g_aes_orphan,
diff --git a/sys/geom/geom_apple.c b/sys/geom/geom_apple.c
index 1b4363331e60..04f5cac1af80 100644
--- a/sys/geom/geom_apple.c
+++ b/sys/geom/geom_apple.c
@@ -255,6 +255,7 @@ g_apple_taste(struct g_class *mp, struct g_provider *pp, int insist)
 
 static struct g_class g_apple_class	= {
 	.name = APPLE_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_apple_taste,
 	.dumpconf = g_apple_dumpconf,
 };
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c
index 66cff5cf7fa0..0f880a37c5f1 100644
--- a/sys/geom/geom_bsd.c
+++ b/sys/geom/geom_bsd.c
@@ -662,6 +662,7 @@ g_bsd_config(struct gctl_req *req, struct g_class *mp, char const *verb)
 /* Finally, register with GEOM infrastructure. */
 static struct g_class g_bsd_class = {
 	.name = BSD_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_bsd_taste,
 	.ctlreq = g_bsd_config,
 	.dumpconf = g_bsd_dumpconf,
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index 586fd7448ea7..c638a3b8d3b8 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -858,6 +858,7 @@ g_ccd_config(struct gctl_req *req, struct g_class *mp, char const *verb)
 
 static struct g_class g_ccd_class = {
 	.name = "CCD",
+	.version = G_VERSION,
 	.ctlreq = g_ccd_config,
 	.destroy_geom = g_ccd_destroy_geom,
 	.start = g_ccd_start,
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 9cd9e815bac9..8d0b7035b657 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -76,6 +76,7 @@ static g_orphan_t g_dev_orphan;
 
 static struct g_class g_dev_class	= {
 	.name = "DEV",
+	.version = G_VERSION,
 	.taste = g_dev_taste,
 	.orphan = g_dev_orphan,
 };
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index eed2bdaf22cd..bf101e68fb74 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -67,6 +67,7 @@ static g_dumpconf_t g_disk_dumpconf;
 
 struct g_class g_disk_class = {
 	.name = "DISK",
+	.version = G_VERSION,
 	.init = g_disk_init,
 	.fini = g_disk_fini,
 	.start = g_disk_start,
diff --git a/sys/geom/geom_fox.c b/sys/geom/geom_fox.c
index f112d861df33..76255e2879cb 100644
--- a/sys/geom/geom_fox.c
+++ b/sys/geom/geom_fox.c
@@ -460,6 +460,7 @@ g_fox_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
 
 static struct g_class g_fox_class	= {
 	.name = FOX_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_fox_taste,
 	.destroy_geom = g_fox_destroy_geom,
 	.start = g_fox_start,
diff --git a/sys/geom/geom_gpt.c b/sys/geom/geom_gpt.c
index 0a75e9eb34bf..3f545906297d 100644
--- a/sys/geom/geom_gpt.c
+++ b/sys/geom/geom_gpt.c
@@ -229,6 +229,7 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
 
 static struct g_class g_gpt_class = {
 	.name = "GPT",
+	.version = G_VERSION,
 	.taste = g_gpt_taste,
 	.dumpconf = g_gpt_dumpconf,
 };
diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c
index c3beeeda5e00..941458fae861 100644
--- a/sys/geom/geom_mbr.c
+++ b/sys/geom/geom_mbr.c
@@ -276,6 +276,7 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist)
 
 static struct g_class g_mbr_class	= {
 	.name = MBR_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_mbr_taste,
 	.dumpconf = g_mbr_dumpconf,
 	.ioctl = g_mbr_ioctl,
@@ -418,6 +419,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
 
 static struct g_class g_mbrext_class	= {
 	.name = MBREXT_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_mbrext_taste,
 	.dumpconf = g_mbrext_dumpconf,
 };
diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c
index 07e131b7cccd..afbc59fcb126 100644
--- a/sys/geom/geom_pc98.c
+++ b/sys/geom/geom_pc98.c
@@ -281,6 +281,7 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
 
 static struct g_class g_pc98_class = {
 	.name = PC98_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_pc98_taste,
 	.dumpconf = g_pc98_dumpconf,
 	.ioctl = g_pc98_ioctl,
diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c
index 4225dd5ecc46..ece8e1eba771 100644
--- a/sys/geom/geom_sunlabel.c
+++ b/sys/geom/geom_sunlabel.c
@@ -273,6 +273,7 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
 
 static struct g_class g_sunlabel_class = {
 	.name = SUNLABEL_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_sunlabel_taste,
 	.ctlreq = g_sunlabel_config,
 	.dumpconf = g_sunlabel_dumpconf,
diff --git a/sys/geom/geom_vol_ffs.c b/sys/geom/geom_vol_ffs.c
index afc41487b3f6..9972486ae431 100644
--- a/sys/geom/geom_vol_ffs.c
+++ b/sys/geom/geom_vol_ffs.c
@@ -137,6 +137,8 @@ g_vol_ffs_taste(struct g_class *mp, struct g_provider *pp, int flags)
 
 static struct g_class g_vol_ffs_class	= {
 	.name = VOL_FFS_CLASS_NAME,
+	.version = G_VERSION,
+	.version = G_VERSION,
 	.taste = g_vol_ffs_taste,
 };
 
diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c
index 0067a33a6c8a..fdc05c15cce8 100644
--- a/sys/geom/label/g_label.c
+++ b/sys/geom/label/g_label.c
@@ -55,6 +55,7 @@ static void g_label_config(struct gctl_req *req, struct g_class *mp,
 
 struct g_class g_label_class = {
 	.name = G_LABEL_CLASS_NAME,
+	.version = G_VERSION,
 	.ctlreq = g_label_config,
 	.taste = g_label_taste
 };
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 1ba1bc84e9f7..427bc449ee78 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -81,6 +81,7 @@ static g_taste_t g_mirror_taste;
 
 struct g_class g_mirror_class = {
 	.name = G_MIRROR_CLASS_NAME,
+	.version = G_VERSION,
 	.ctlreq = g_mirror_config,
 	.taste = g_mirror_taste,
 	.destroy_geom = g_mirror_destroy_geom
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index bedc2ef4ddc9..2b4034a7d680 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -56,6 +56,7 @@ static void g_nop_dumpconf(struct sbuf *sb, const char *indent,
 
 struct g_class g_nop_class = {
 	.name = G_NOP_CLASS_NAME,
+	.version = G_VERSION,
 	.ctlreq = g_nop_config,
 	.destroy_geom = g_nop_destroy_geom
 };
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index e490c79eb2fa..e3106b4a8f84 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -58,6 +58,7 @@ static g_fini_t g_stripe_fini;
 
 struct g_class g_stripe_class = {
 	.name = G_STRIPE_CLASS_NAME,
+	.version = G_VERSION,
 	.ctlreq = g_stripe_config,
 	.taste = g_stripe_taste,
 	.destroy_geom = g_stripe_destroy_geom,
diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c
index b535f56d2b56..24232029331e 100644
--- a/sys/geom/vinum/geom_vinum.c
+++ b/sys/geom/vinum/geom_vinum.c
@@ -623,6 +623,7 @@ gv_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
 
 static struct g_class g_vinum_class	= {
 	.name = VINUM_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = gv_taste,
 	/*.destroy_geom = gv_destroy_geom,*/
 	.ctlreq = gv_config,
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c
index a7fa0d60740e..17a3737ca800 100644
--- a/sys/geom/vinum/geom_vinum_drive.c
+++ b/sys/geom/vinum/geom_vinum_drive.c
@@ -512,6 +512,7 @@ gv_drive_destroy_geom(struct gctl_req *req, struct g_class *mp,
 
 static struct g_class g_vinum_drive_class = {
 	.name = VINUMDRIVE_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = gv_drive_taste,
 	.destroy_geom = gv_drive_destroy_geom
 };
diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c
index e44a64ef5cd9..02855e4d7ae5 100644
--- a/sys/geom/vinum/geom_vinum_plex.c
+++ b/sys/geom/vinum/geom_vinum_plex.c
@@ -479,6 +479,7 @@ gv_plex_destroy_geom(struct gctl_req *req, struct g_class *mp,
 
 static struct g_class g_vinum_plex_class = {
 	.name = VINUMPLEX_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = gv_plex_taste,
 	.destroy_geom = gv_plex_destroy_geom,
 };
diff --git a/sys/geom/vinum/geom_vinum_volume.c b/sys/geom/vinum/geom_vinum_volume.c
index 7f4216ae4384..c6cc128470ba 100644
--- a/sys/geom/vinum/geom_vinum_volume.c
+++ b/sys/geom/vinum/geom_vinum_volume.c
@@ -253,6 +253,7 @@ gv_volume_destroy_geom(struct gctl_req *req, struct g_class *mp,
 
 static struct g_class g_vinum_volume_class = {
 	.name = VINUMVOLUME_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = gv_volume_taste,
 	.destroy_geom = gv_volume_destroy_geom,
 };
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 3a41c3360140..c3e3fc6ec5bd 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2355,8 +2355,12 @@ vmspace_swap_count(struct vmspace *vmspace)
  *
  */
 
+static g_orphan_t swapgeom_orphan;
+
 static struct g_class g_swap_class = {
 	.name = "SWAP",
+	.version = G_VERSION,
+	.orphan = swapgeom_orphan,
 };
 
 DECLARE_GEOM_CLASS(g_swap_class, g_class);
@@ -2473,10 +2477,8 @@ swapongeom_ev(void *arg, int flags)
 		}
 	}
 	mtx_unlock(&sw_dev_mtx);
-	if (gp == NULL) {
+	if (gp == NULL)
 		gp = g_new_geomf(&g_swap_class, "swap", NULL);
-		gp->orphan = swapgeom_orphan;
-	}
 	cp = g_new_consumer(gp);
 	g_attach(cp, pp);
 	/*
-- 
cgit v1.2.3