summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2014-05-07 09:55:47 +0000
committermarius <marius@FreeBSD.org>2014-05-07 09:55:47 +0000
commitc1f0e5c458662203e8f4e90eba04e1abaa920ad7 (patch)
tree445e8eb227683f9b8ade0b4c9eb9f5acece3cf22 /sbin
parentebef83dbd2b82b4ddf471e1d2b423eef86ccf414 (diff)
downloadFreeBSD-src-c1f0e5c458662203e8f4e90eba04e1abaa920ad7.zip
FreeBSD-src-c1f0e5c458662203e8f4e90eba04e1abaa920ad7.tar.gz
MFC: r265248
Allow GEOM_VINUM to be statically compiled into the kernel. Submitted by: gleb
Diffstat (limited to 'sbin')
-rw-r--r--sbin/gvinum/gvinum.c15
-rw-r--r--sbin/gvinum/gvinum.h3
2 files changed, 11 insertions, 7 deletions
diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c
index bb4b47d..d5b859c 100644
--- a/sbin/gvinum/gvinum.c
+++ b/sbin/gvinum/gvinum.c
@@ -95,8 +95,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) {
@@ -1204,9 +1206,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;
}
@@ -1216,7 +1219,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);
@@ -1224,7 +1227,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..8b72eea 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"
OpenPOWER on IntegriCloud