From owner-p4-projects@FreeBSD.ORG Thu Mar 30 21:17:09 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7D7E116A420; Thu, 30 Mar 2006 21:17:09 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3BDEB16A401 for ; Thu, 30 Mar 2006 21:17:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09D3C43D53 for ; Thu, 30 Mar 2006 21:17:09 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2ULH8pt086665 for ; Thu, 30 Mar 2006 21:17:08 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2ULH81p086654 for perforce@freebsd.org; Thu, 30 Mar 2006 21:17:08 GMT (envelope-from jhb@freebsd.org) Date: Thu, 30 Mar 2006 21:17:08 GMT Message-Id: <200603302117.k2ULH81p086654@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 94326 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2006 21:17:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=94326 Change 94326 by jhb@jhb_slimer on 2006/03/30 21:16:27 More cleanups and fix kld_unlock in linker_file_lookup_set(). Affected files ... .. //depot/projects/smpng/sys/kern/kern_linker.c#54 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_linker.c#54 (text+ko) ==== @@ -639,7 +639,8 @@ if (!locked) KLD_LOCK(); error = linker_lookup_set(file, name, firstp, lastp, countp); - KLD_UNLOCK(); + if (!locked) + KLD_UNLOCK(); return (error); } @@ -844,10 +845,8 @@ KLD_LOCK(); error = linker_load_module_internal(kldname, modname, NULL, NULL, &lf); - if (error) { - KLD_UNLOCK(); - goto out; - } + if (error) + goto unlock; #ifdef HWPMC_HOOKS pkm.pm_file = lf->filename; pkm.pm_address = (uintptr_t) lf->address; @@ -855,6 +854,7 @@ #endif lf->userrefs++; td->td_retval[0] = lf->id; +unlock: KLD_UNLOCK(); out: free(pathname, M_TEMP); @@ -961,9 +961,9 @@ filename = linker_basename(pathname); KLD_LOCK(); lf = linker_find_file_by_name(filename); - if (lf) { + if (lf) td->td_retval[0] = lf->id; - } else + else error = ENOENT; KLD_UNLOCK(); out: @@ -1116,12 +1116,9 @@ KLD_LOCK(); if (uap->fileid != 0) { lf = linker_find_file_by_id(uap->fileid); - if (lf == NULL) { + if (lf == NULL) error = ENOENT; - KLD_UNLOCK(); - goto out; - } - if (LINKER_LOOKUP_SYMBOL(lf, symstr, &sym) == 0 && + else if (LINKER_LOOKUP_SYMBOL(lf, symstr, &sym) == 0 && LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) { lookup.symvalue = (uintptr_t) symval.value; lookup.symsize = symval.size;