1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Use the preload_fetch_addr() and preload_fetch_size() convenience

functions and only create the MD device when we have a non-zero
pointer and size.

Sponsored by: Juniper Networks
This commit is contained in:
Marcel Moolenaar 2011-02-09 19:31:10 +00:00
parent 278e79707e
commit 8d5ac6c3cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218495

View File

@ -1235,7 +1235,6 @@ static void
g_md_init(struct g_class *mp __unused)
{
caddr_t mod;
caddr_t c;
u_char *ptr, *name, *type;
unsigned len;
int i;
@ -1263,16 +1262,16 @@ g_md_init(struct g_class *mp __unused)
continue;
if (strcmp(type, "md_image") && strcmp(type, "mfs_root"))
continue;
c = preload_search_info(mod, MODINFO_ADDR);
ptr = *(u_char **)c;
c = preload_search_info(mod, MODINFO_SIZE);
len = *(size_t *)c;
ptr = preload_fetch_addr(mod);
len = preload_fetch_size(mod);
if (ptr != NULL && len != 0) {
printf("%s%d: Preloaded image <%s> %d bytes at %p\n",
MD_NAME, mdunits, name, len, ptr);
sx_xlock(&md_sx);
md_preloaded(ptr, len);
sx_xunlock(&md_sx);
}
}
status_dev = make_dev(&mdctl_cdevsw, INT_MAX, UID_ROOT, GID_WHEEL,
0600, MDCTL_NAME);
g_topology_lock();