aboutsummaryrefslogtreecommitdiff
path: root/sbin/gvinum/gvinum.c
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2014-05-02 23:23:18 +0000
committerMarius Strobl <marius@FreeBSD.org>2014-05-02 23:23:18 +0000
commit02e17f0b93420562b8f192d75ddad3d5d0d4220b (patch)
tree960de5389937d5d67606bbc729de427e3d28c5d3 /sbin/gvinum/gvinum.c
parentf2b1eaec33f16116533e1fbf0825ba45142ddf5c (diff)
downloadsrc-02e17f0b93420562b8f192d75ddad3d5d0d4220b.tar.gz
src-02e17f0b93420562b8f192d75ddad3d5d0d4220b.zip
Allow GEOM_VINUM to be statically compiled into the kernel.
Submitted by: gleb MFC after: 3 days
Notes
Notes: svn path=/head/; revision=265248
Diffstat (limited to 'sbin/gvinum/gvinum.c')
-rw-r--r--sbin/gvinum/gvinum.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c
index 5760d2b8bb28..7033b63bb4af 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;
}