From 769ae4addbf6858819cbd29266fea18785c822a4 Mon Sep 17 00:00:00 2001
From: Peter Wemm <peter@FreeBSD.org>
Date: Mon, 5 Apr 1999 06:30:12 +0000
Subject: [PATCH] kldload("ccd") if the ccd module isn't present.

---
 sbin/ccdconfig/ccdconfig.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c
index ed91a6dae0ec..e27ada40eb61 100644
--- a/sbin/ccdconfig/ccdconfig.c
+++ b/sbin/ccdconfig/ccdconfig.c
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-	"$Id: ccdconfig.c,v 1.9 1998/06/04 06:41:26 charnier Exp $";
+	"$Id: ccdconfig.c,v 1.10 1998/09/15 08:15:22 gibbs Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -42,6 +42,7 @@ static const char rcsid[] =
 #include <sys/device.h>
 #include <sys/disk.h>
 #include <sys/stat.h>
+#include <sys/module.h>
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
@@ -170,6 +171,12 @@ main(argc, argv)
 		setgid(getgid());
 	}
 
+	if (modfind("ccd") < 0) {
+		/* Not present in kernel, try loading it */
+		if (kldload("ccd") < 0 || modfind("ccd") < 0)
+			warn("ccd module not available!");
+	}
+
 	switch (action) {
 		case CCD_CONFIG:
 		case CCD_UNCONFIG: