From owner-p4-projects@FreeBSD.ORG Mon Mar 27 16:36:33 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 97A6016A41F; Mon, 27 Mar 2006 16:36:33 +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 733ED16A422 for ; Mon, 27 Mar 2006 16:36:33 +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 BAC6943D73 for ; Mon, 27 Mar 2006 16:36:29 +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 k2RGaTQV024547 for ; Mon, 27 Mar 2006 16:36:29 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2RGaTsi024544 for perforce@freebsd.org; Mon, 27 Mar 2006 16:36:29 GMT (envelope-from jhb@freebsd.org) Date: Mon, 27 Mar 2006 16:36:29 GMT Message-Id: <200603271636.k2RGaTsi024544@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 94114 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: Mon, 27 Mar 2006 16:36:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=94114 Change 94114 by jhb@jhb_slimer on 2006/03/27 16:36:13 Compile. Affected files ... .. //depot/projects/smpng/sys/kern/kern_linker.c#45 edit .. //depot/projects/smpng/sys/kern/link_elf.c#34 edit .. //depot/projects/smpng/sys/kern/link_elf_obj.c#10 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_linker.c#45 (text+ko) ==== @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -110,6 +111,8 @@ static int linker_load_module_internal(const char *kldname, const char *modname, struct linker_file *parent, struct mod_depend *verinfo, struct linker_file **lfpp); +static int linker_lookup_set(linker_file_t file, const char *name, + void *firstp, void *lastp, int *countp); static modlist_t modlist_lookup2(const char *name, struct mod_depend *verinfo); static char * @@ -167,7 +170,7 @@ KLD_DPF(FILE, ("linker_file_sysinit: calling SYSINITs for %s\n", lf->filename)); - if (LINKER_LOOKUP_SET(lf, "sysinit_set", &start, &stop, NULL) != 0) + if (linker_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0) return; /* * Perform a bubble sort of the system initialization objects by @@ -209,7 +212,7 @@ KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", lf->filename)); - if (LINKER_LOOKUP_SET(lf, "sysuninit_set", &start, &stop, NULL) != 0) + if (linker_lookup_set(lf, "sysuninit_set", &start, &stop, NULL) != 0) return; /* @@ -253,7 +256,7 @@ ("linker_file_register_sysctls: registering SYSCTLs for %s\n", lf->filename)); - if (LINKER_LOOKUP_SET(lf, "sysctl_set", &start, &stop, NULL) != 0) + if (linker_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; for (oidp = start; oidp < stop; oidp++) @@ -268,7 +271,7 @@ KLD_DPF(FILE, ("linker_file_unregister_sysctls: registering SYSCTLs" " for %s\n", lf->filename)); - if (LINKER_LOOKUP_SET(lf, "sysctl_set", &start, &stop, NULL) != 0) + if (linker_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; for (oidp = start; oidp < stop; oidp++) @@ -285,7 +288,7 @@ KLD_DPF(FILE, ("linker_file_register_modules: registering modules" " in %s\n", lf->filename)); - if (LINKER_LOOKUP_SET(lf, "modmetadata_set", &start, &stop, + if (linker_lookup_set(lf, "modmetadata_set", &start, &stop, NULL) != 0) { /* * This fallback should be unnecessary, but if we get booted @@ -346,6 +349,7 @@ return (0); } foundfile = 0; + error = ENOENT; /* * We do not need to protect (lock) classes here because there is @@ -393,7 +397,6 @@ error = ENOEXEC; } else error = ENOENT; /* Nothing found */ -out: return (error); } @@ -599,8 +602,19 @@ /* * Locate a linker set and its contents. This is a helper function to avoid - * linker_if.h exposure elsewhere. Note: firstp and lastp are really void *** + * linker_if.h exposure elsewhere. Note: firstp and lastp are really void **. + * The first function is an internal wrapper so we can avoid having lots of + * (void **) casts. */ +static int +linker_lookup_set(linker_file_t file, const char *name, + void *firstp, void *lastp, int *countp) +{ + + KLD_LOCK_ASSERT(); + return (LINKER_LOOKUP_SET(file, name, firstp, lastp, countp)); +} + int linker_file_lookup_set(linker_file_t file, const char *name, void *firstp, void *lastp, int *countp) @@ -608,7 +622,7 @@ int error; KLD_LOCK(); - error = LINKER_LOOKUP_SET(file, name, firstp, lastp, countp); + error = linker_lookup_set(file, name, firstp, lastp, countp); KLD_UNLOCK(); return (error); } @@ -979,10 +993,10 @@ if (namelen > MAXPATHLEN) namelen = MAXPATHLEN; bcopy(lf->filename, &stat.name[0], namelen); - stat.refs = lf.refs; - stat.id = lf.id; - stat.address = lf.address; - stat.size = lf.size; + stat.refs = lf->refs; + stat.id = lf->id; + stat.address = lf->address; + stat.size = lf->size; KLD_UNLOCK(); td->td_retval[0] = 0; @@ -1219,7 +1233,7 @@ /* * First get a list of stuff in the kernel. */ - if (LINKER_LOOKUP_SET(linker_kernel_file, MDT_SETNAME, &start, + if (linker_lookup_set(linker_kernel_file, MDT_SETNAME, &start, &stop, NULL) == 0) linker_addmodules(linker_kernel_file, start, stop, 1); @@ -1229,7 +1243,7 @@ */ restart: TAILQ_FOREACH(lf, &loaded_files, loaded) { - error = LINKER_LOOKUP_SET(lf, MDT_SETNAME, &start, &stop, NULL); + error = linker_lookup_set(lf, MDT_SETNAME, &start, &stop, NULL); /* * First, look to see if we would successfully link with this * stuff. @@ -1322,7 +1336,7 @@ panic("cannot add dependency"); } lf->userrefs++; /* so we can (try to) kldunload it */ - error = LINKER_LOOKUP_SET(lf, MDT_SETNAME, &start, &stop, NULL); + error = linker_lookup_set(lf, MDT_SETNAME, &start, &stop, NULL); if (!error) { for (mdp = start; mdp < stop; mdp++) { mp = *mdp; @@ -1353,7 +1367,7 @@ continue; } linker_file_register_modules(lf); - if (LINKER_LOOKUP_SET(lf, "sysinit_set", &si_start, + if (linker_lookup_set(lf, "sysinit_set", &si_start, &si_stop, NULL) == 0) sysinit_add(si_start, si_stop); linker_file_register_sysctls(lf); @@ -1485,7 +1499,7 @@ goto bad; vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); - if (nd.ni_vp->v_type != VREG) { + if (nd.ni_vp->v_type != VREG) goto bad; best = cp = NULL; error = VOP_GETATTR(nd.ni_vp, &vattr, cred, td); @@ -1769,7 +1783,7 @@ if (error) return (error); } - if (LINKER_LOOKUP_SET(lf, MDT_SETNAME, &start, &stop, &count) != 0) + if (linker_lookup_set(lf, MDT_SETNAME, &start, &stop, &count) != 0) return (0); for (mdp = start; mdp < stop; mdp++) { mp = *mdp; ==== //depot/projects/smpng/sys/kern/link_elf.c#34 (text+ko) ==== @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include ==== //depot/projects/smpng/sys/kern/link_elf_obj.c#10 (text+ko) ==== @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include