building kernel including GEOM_VINUM

Gleb Kurtsou gleb.kurtsou at gmail.com
Sat Feb 5 21:14:20 UTC 2011


On (05/02/2011 10:07), Gary Jennejohn wrote:
> On Sat, 5 Feb 2011 00:48:56 +0200
> Gleb Kurtsou <gleb.kurtsou at gmail.com> wrote:
> > On (04/02/2011 14:12), Gary Jennejohn wrote:
> > > It would probably require some major hacking.  Apparently gvinum was
> > > designed with using it only as a KLD in mind.
> > The change it trivial, just add files listed in
> > sys/modules/geom/geom_vinum/Makefile to sys/files.
> > It was also necessary it tweak /sbin/gvinum to check if module loaded
> > during startup to eliminate useless warning (afair).
> 
> For someone not used to working with the kernel I'd say that what you
> describe is major hacking.  Especially the modification to gvinum.
The patch attached. Would you test if it's ok in both cases: built-in
and module. vinum(4) man page states that loading it as module is
preferred, I see no reason for it to still remain so, the text was
written in ~1999 and vinum was rewritten on top of geom afterwards.

Thanks,
Gleb.
-------------- next part --------------
commit 2200845bcf19dcf410a23429d2f1421060023992
Author: Gleb Kurtsou <gleb.kurtsou at gmail.com>
Date:   Sun Feb 6 01:04:09 2011 +0200

    Support building kernel with gvinum included

diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c
index f936a58..033a553 100644
--- a/sbin/gvinum/gvinum.c
+++ b/sbin/gvinum/gvinum.c
@@ -94,8 +94,10 @@ main(int argc, char **argv)
 	char buffer[BUFSIZ], *inputline, *token[GV_MAXARGS];
 
 	/* Load the module if necessary. */
-	if (kldfind(GVINUMMOD) < 0 && kldload(GVINUMMOD) < 0)
-		err(1, GVINUMMOD ": Kernel module not available");
+	if (modfind(GVINUMMOD) < 0) {
+		if (kldload(GVINUMKLD) < 0 && modfind(GVINUMMOD) < 0)
+			err(1, GVINUMKLD ": Kernel module not available");
+	}
 
 	/* Arguments given on the command line. */
 	if (argc > 1) {
@@ -1206,9 +1208,10 @@ gvinum_stop(int argc, char **argv)
 {
 	int err, fileid;
 
-	fileid = kldfind(GVINUMMOD);
+	fileid = kldfind(GVINUMKLD);
 	if (fileid == -1) {
-		warn("cannot find " GVINUMMOD);
+		if (modfind(GVINUMMOD) < 0)
+			warn("cannot find " GVINUMKLD);
 		return;
 	}
 
@@ -1218,7 +1221,7 @@ gvinum_stop(int argc, char **argv)
 	 * event thread will be free for the g_wither_geom() call from
 	 * gv_unload().  It's silly, but it works.
 	 */
-	printf("unloading " GVINUMMOD " kernel module... ");
+	printf("unloading " GVINUMKLD " kernel module... ");
 	fflush(stdout);
 	if ((err = kldunload(fileid)) != 0 && (errno == EAGAIN)) {
 		sleep(1);
@@ -1226,7 +1229,7 @@ gvinum_stop(int argc, char **argv)
 	}
 	if (err != 0) {
 		printf(" failed!\n");
-		warn("cannot unload " GVINUMMOD);
+		warn("cannot unload " GVINUMKLD);
 		return;
 	}
 
diff --git a/sbin/gvinum/gvinum.h b/sbin/gvinum/gvinum.h
index d1b45a0..14f7562 100644
--- a/sbin/gvinum/gvinum.h
+++ b/sbin/gvinum/gvinum.h
@@ -36,4 +36,5 @@
 
 /* $FreeBSD$ */
 
-#define GVINUMMOD	"geom_vinum"
+#define GVINUMMOD	"g_vinum"
+#define GVINUMKLD	"geom_vinum"
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index dc3d8f1..602cc23 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -168,6 +168,7 @@ options 	GEOM_SHSEC		# Shared secret.
 options 	GEOM_STRIPE		# Disk striping.
 options 	GEOM_SUNLABEL		# Sun/Solaris partitioning
 options 	GEOM_UZIP		# Read-only compressed disks
+options 	GEOM_VINUM		# Vinum logical volume manager
 options 	GEOM_VIRSTOR		# Virtual storage.
 options 	GEOM_VOL		# Volume names from UFS superblock
 options 	GEOM_ZERO		# Performance testing helper.
diff --git a/sys/conf/files b/sys/conf/files
index 3973bc9..4823fb0 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2075,6 +2075,21 @@ geom/raid3/g_raid3_ctl.c	optional geom_raid3
 geom/shsec/g_shsec.c		optional geom_shsec
 geom/stripe/g_stripe.c		optional geom_stripe
 geom/uzip/g_uzip.c		optional geom_uzip
+geom/vinum/geom_vinum.c		optional geom_vinum
+geom/vinum/geom_vinum_create.c	optional geom_vinum
+geom/vinum/geom_vinum_drive.c	optional geom_vinum
+geom/vinum/geom_vinum_plex.c	optional geom_vinum
+geom/vinum/geom_vinum_volume.c	optional geom_vinum
+geom/vinum/geom_vinum_subr.c	optional geom_vinum
+geom/vinum/geom_vinum_raid5.c	optional geom_vinum
+geom/vinum/geom_vinum_share.c	optional geom_vinum
+geom/vinum/geom_vinum_list.c	optional geom_vinum
+geom/vinum/geom_vinum_rm.c	optional geom_vinum
+geom/vinum/geom_vinum_init.c	optional geom_vinum
+geom/vinum/geom_vinum_state.c	optional geom_vinum
+geom/vinum/geom_vinum_rename.c	optional geom_vinum
+geom/vinum/geom_vinum_move.c	optional geom_vinum
+geom/vinum/geom_vinum_events.c	optional geom_vinum
 geom/virstor/binstream.c	optional geom_virstor
 geom/virstor/g_virstor.c	optional geom_virstor
 geom/virstor/g_virstor_md.c	optional geom_virstor
diff --git a/sys/conf/options b/sys/conf/options
index 440f89f..f311b79 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -106,6 +106,7 @@ GEOM_SHSEC	opt_geom.h
 GEOM_STRIPE	opt_geom.h
 GEOM_SUNLABEL	opt_geom.h
 GEOM_UZIP	opt_geom.h
+GEOM_VINUM	opt_geom.h
 GEOM_VIRSTOR	opt_geom.h
 GEOM_VOL	opt_geom.h
 GEOM_ZERO	opt_geom.h


More information about the freebsd-fs mailing list