diff options
author | marius <marius@FreeBSD.org> | 2014-05-02 23:23:18 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2014-05-02 23:23:18 +0000 |
commit | ed48e9a0db7699d2d1249014920957127f258657 (patch) | |
tree | 960de5389937d5d67606bbc729de427e3d28c5d3 /sbin | |
parent | 1b83ce15243b4ce6c21f6e2b1bde734b589fc453 (diff) | |
download | FreeBSD-src-ed48e9a0db7699d2d1249014920957127f258657.zip FreeBSD-src-ed48e9a0db7699d2d1249014920957127f258657.tar.gz |
Allow GEOM_VINUM to be statically compiled into the kernel.
Submitted by: gleb
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/gvinum/gvinum.c | 15 | ||||
-rw-r--r-- | sbin/gvinum/gvinum.h | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c index 5760d2b..7033b63 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) { @@ -1207,9 +1209,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; } @@ -1219,7 +1222,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); @@ -1227,7 +1230,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" |