Date: Thu, 30 Mar 2006 20:55:41 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94325 for review Message-ID: <200603302055.k2UKtfbx084552@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94325 Change 94325 by jhb@jhb_slimer on 2006/03/30 20:55:32 Various diff-reduction and cleanups. Affected files ... .. //depot/projects/smpng/sys/kern/kern_linker.c#53 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_linker.c#53 (text+ko) ==== @@ -473,7 +473,6 @@ const char *filename; KLD_LOCK_ASSERT(); - lf = NULL; filename = linker_basename(pathname); KLD_DPF(FILE, ("linker_make_file: new file, filename=%s\n", filename)); @@ -484,11 +483,11 @@ lf->userrefs = 0; lf->flags = 0; lf->filename = linker_strdup(filename); + LINKER_GET_NEXT_FILE_ID(lf->id); lf->ndeps = 0; lf->deps = NULL; STAILQ_INIT(&lf->common); TAILQ_INIT(&lf->modules); - LINKER_GET_NEXT_FILE_ID(lf->id); TAILQ_INSERT_TAIL(&linker_files, lf, link); return (lf); } @@ -522,7 +521,7 @@ error = mac_check_kld_unload(curthread->td_ucred); if (error) return (error); -#endif +#endif KLD_LOCK_ASSERT(); KLD_DPF(FILE, ("linker_file_unload: lf->refs=%d\n", file->refs)); @@ -843,17 +842,19 @@ modname = pathname; } + KLD_LOCK(); + error = linker_load_module_internal(kldname, modname, NULL, NULL, &lf); + if (error) { + KLD_UNLOCK(); + goto out; + } #ifdef HWPMC_HOOKS pkm.pm_file = lf->filename; pkm.pm_address = (uintptr_t) lf->address; PMC_CALL_HOOK(td, PMC_FN_KLD_LOAD, (void *) &pkm); #endif - KLD_LOCK(); - error = linker_load_module_internal(kldname, modname, NULL, NULL, &lf); - if (error == 0) { - lf->userrefs++; - td->td_retval[0] = lf->id; - } + lf->userrefs++; + td->td_retval[0] = lf->id; KLD_UNLOCK(); out: free(pathname, M_TEMP);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603302055.k2UKtfbx084552>