Index: sbin/mdconfig/mdconfig.c
===================================================================
--- sbin/mdconfig/mdconfig.c
+++ sbin/mdconfig/mdconfig.c
@@ -452,7 +452,8 @@
}
gc = &pp->lg_config;
type = geom_config_get(gc, "type");
- if (strcmp(type, "vnode") == 0) {
+ if (strcmp(type, "vnode") == 0 ||
+ strcmp(type, "preload") == 0) {
file = geom_config_get(gc, "file");
if (fflag != NULL &&
strcmp(fflag, file) != 0)
Index: sys/dev/md/md.c
===================================================================
--- sys/dev/md/md.c
+++ sys/dev/md/md.c
@@ -1689,7 +1689,8 @@
mdio->md_options = sc->flags;
mdio->md_mediasize = sc->mediasize;
mdio->md_sectorsize = sc->sectorsize;
- if (sc->type == MD_VNODE)
+ if (sc->type == MD_VNODE ||
+ (sc->type == MD_PRELOAD && mdio->md_file != NULL))
error = copyout(sc->file, mdio->md_file,
strlen(sc->file) + 1);
return (error);
@@ -1733,6 +1734,8 @@
sc->pl_ptr = image;
sc->pl_len = length;
sc->start = mdstart_preload;
+ if (name != NULL)
+ strlcpy(sc->file, name, sizeof(sc->file));
#if defined(MD_ROOT) && !defined(ROOTDEVNAME)
if (sc->unit == 0)
rootdevnames[0] = MD_ROOT_FSTYPE ":/dev/md0";
@@ -1835,7 +1838,8 @@
sbuf_printf(sb, " fs %ju", (uintmax_t) mp->fwsectors);
sbuf_printf(sb, " l %ju", (uintmax_t) mp->mediasize);
sbuf_printf(sb, " t %s", type);
- if (mp->type == MD_VNODE && mp->vnode != NULL)
+ if ((mp->type == MD_VNODE && mp->vnode != NULL) ||
+ (mp->type == MD_PRELOAD && mp->file[0] != '\0'))
sbuf_printf(sb, " file %s", mp->file);
} else {
sbuf_printf(sb, "%s%d\n", indent,
@@ -1855,7 +1859,8 @@
"read-only");
sbuf_printf(sb, "%s%s\n", indent,
type);
- if (mp->type == MD_VNODE && mp->vnode != NULL) {
+ if ((mp->type == MD_VNODE && mp->vnode != NULL) ||
+ (mp->type == MD_PRELOAD && mp->file[0] != '\0'))
sbuf_printf(sb, "%s", indent);
g_conf_printf_escaped(sb, "%s", mp->file);
sbuf_printf(sb, "\n");