Date: Mon, 27 Mar 2006 16:36:29 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94114 for review Message-ID: <200603271636.k2RGaTsi024544@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/sx.h> #include <sys/mac.h> #include <sys/module.h> +#include <sys/mount.h> #include <sys/linker.h> #include <sys/fcntl.h> #include <sys/libkern.h> @@ -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 <sys/mac.h> #include <sys/malloc.h> #include <sys/mutex.h> +#include <sys/mount.h> #include <sys/proc.h> #include <sys/namei.h> #include <sys/fcntl.h> ==== //depot/projects/smpng/sys/kern/link_elf_obj.c#10 (text+ko) ==== @@ -38,6 +38,7 @@ #include <sys/mac.h> #include <sys/malloc.h> #include <sys/mutex.h> +#include <sys/mount.h> #include <sys/proc.h> #include <sys/namei.h> #include <sys/fcntl.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603271636.k2RGaTsi024544>