Author: marcel Date: Wed Feb 9 19:31:10 2011 New Revision: 218495 URL: http://svn.freebsd.org/changeset/base/218495
Log: 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 Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Wed Feb 9 19:08:21 2011 (r218494) +++ head/sys/dev/md/md.c Wed Feb 9 19:31:10 2011 (r218495) @@ -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,15 +1262,15 @@ 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; - 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); + 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); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"