summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-11-11 11:31:23 +0000
committerpjd <pjd@FreeBSD.org>2005-11-11 11:31:23 +0000
commit679cff6ef7b052a28621079e0148a60ab7568357 (patch)
treeadbb79f2bb84163c0101eba4499d186b0f814d5d
parent618c8789688d1bd81a105118d081c7e779f06a59 (diff)
downloadFreeBSD-src-679cff6ef7b052a28621079e0148a60ab7568357.zip
FreeBSD-src-679cff6ef7b052a28621079e0148a60ab7568357.tar.gz
Rename GEOM class kernel module g_md.ko to geom_md.ko for consistency
with the rest. mdconfig.c: Simplify mdmaybeload() function. mdioctl.h: Removed (now unused) #define. loader.conf: Sort GEOM classes properly. OK'ed by: phk
-rw-r--r--sbin/mdconfig/mdconfig.c39
-rw-r--r--sys/boot/forth/loader.conf8
-rw-r--r--sys/modules/md/Makefile2
-rw-r--r--sys/sys/mdioctl.h1
4 files changed, 17 insertions, 33 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index e3ca148..03747aa 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -334,32 +334,17 @@ query(const int fd, const int unit)
void
mdmaybeload(void)
{
- struct module_stat mstat;
- int fileid, modid;
- const char *name;
- char *cp;
+ char name1[64], name2[64];
- name = MD_MODNAME;
- /* scan files in kernel */
- mstat.version = sizeof(struct module_stat);
- for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) {
- /* scan modules in file */
- for (modid = kldfirstmod(fileid); modid > 0;
- modid = modfnext(modid)) {
- if (modstat(modid, &mstat) < 0)
- continue;
- /* strip bus name if present */
- if ((cp = strchr(mstat.name, '/')) != NULL) {
- cp++;
- } else {
- cp = mstat.name;
- }
- /* already loaded? */
- if (!strcmp(name, cp))
- return;
- }
- }
- /* not present, we should try to load it */
- kldload(name);
+ snprintf(name1, sizeof(name1), "g_%s", MD_NAME);
+ snprintf(name2, sizeof(name2), "geom_%s", MD_NAME);
+ if (modfind(name1) == -1) {
+ /* Not present in kernel, try loading it. */
+ if (kldload(name2) == -1 || modfind(name1) == -1) {
+ if (errno != EEXIST) {
+ errx(EXIT_FAILURE,
+ "%s module not available!", name2);
+ }
+ }
+ }
}
-
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index 60d7bfe..a43f087 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -135,23 +135,23 @@ unionfs_load="NO" # Union filesystem
# Related stuff
-g_md_load="NO" # Memory disk driver (vnode/swap/malloc) (see
- # md(4), mdconfig(8))
geom_bde_load="NO" # Disk encryption driver (see gbde(4,8))
geom_ccd_load="NO" # Concatenated disk driver (see ccd(4),
# ccdconfig(8))
geom_concat_load="NO" # Concatenated disk driver (see gconcat(8))
+geom_eli_load="NO" # Disk encryption driver (see geli(8))
geom_gate_load="NO" # Userland disk driver (see geom_gate(4),
# ggatec(8), ggated(8), ggatel(8))
-geom_eli_load="NO" # Disk encryption driver (see geli(8))
geom_label_load="NO" # File system labels (see glabel(8))
+geom_md_load="NO" # Memory disk driver (vnode/swap/malloc) (see
geom_mirror_load="NO" # RAID1 disk driver (see gmirror(8))
geom_nop_load="NO" # Transparent disk driver (see gnop(8))
geom_raid3_load="NO" # RAID3 disk driver (see graid3(8))
geom_shsec_load="NO" # Shared secret disk driver (see gshsec(8))
geom_stripe_load="NO" # RAID0 disk driver (see gstripe(8))
-geom_vinum_load="NO" # Concatenated/mirror/raid driver (see vinum(4))
geom_uzip_load="NO" # Compressed disk images driver (see mkuzip(8))
+ # md(4), mdconfig(8))
+geom_vinum_load="NO" # Concatenated/mirror/raid driver (see vinum(4))
##############################################################
diff --git a/sys/modules/md/Makefile b/sys/modules/md/Makefile
index 3f0654f..19851e6 100644
--- a/sys/modules/md/Makefile
+++ b/sys/modules/md/Makefile
@@ -2,7 +2,7 @@
.PATH: ${.CURDIR}/../../dev/md
-KMOD= g_md
+KMOD= geom_md
SRCS= md.c opt_md.h opt_geom.h vnode_if.h
.include <bsd.kmod.mk>
diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h
index 57dc04c..be63b8c 100644
--- a/sys/sys/mdioctl.h
+++ b/sys/sys/mdioctl.h
@@ -65,7 +65,6 @@ struct md_ioctl {
};
#define MD_NAME "md"
-#define MD_MODNAME "g_md"
#define MDCTL_NAME "mdctl"
#define MDIOVERSION 0
OpenPOWER on IntegriCloud