module.c (294058) | module.c (298230) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/boot/common/module.c 294058 2016-01-15 00:55:36Z smh $"); | 28__FBSDID("$FreeBSD: head/sys/boot/common/module.c 298230 2016-04-18 23:09:22Z allanjude $"); |
29 30/* 31 * file/module function dispatcher, support, etc. 32 */ 33 34#include <stand.h> 35#include <string.h> 36#include <sys/param.h> --- 727 unchanged lines hidden (view full) --- 764 recptr = mdp->d_hints; 765 bufend = recptr + mdp->d_hintsz; 766 clen = blen = 0; 767 best = cp = NULL; 768 while (recptr < bufend && !found) { 769 intp = (int*)recptr; 770 reclen = *intp++; 771 ival = *intp++; | 29 30/* 31 * file/module function dispatcher, support, etc. 32 */ 33 34#include <stand.h> 35#include <string.h> 36#include <sys/param.h> --- 727 unchanged lines hidden (view full) --- 764 recptr = mdp->d_hints; 765 bufend = recptr + mdp->d_hintsz; 766 clen = blen = 0; 767 best = cp = NULL; 768 while (recptr < bufend && !found) { 769 intp = (int*)recptr; 770 reclen = *intp++; 771 ival = *intp++; |
772 cp = (char*)intp; | 772 cp = (u_char*)intp; |
773 switch (ival) { 774 case MDT_VERSION: 775 clen = *cp++; 776 if (clen != modnamelen || bcmp(cp, modname, clen) != 0) 777 break; 778 cp += clen; 779 INT_ALIGN(mdp->d_hints, cp); 780 ival = *(int*)cp; --- 15 unchanged lines hidden (view full) --- 796 break; 797 } 798 recptr += reclen + sizeof(int); 799 } 800 /* 801 * Finally check if KLD is in the place 802 */ 803 if (found) | 773 switch (ival) { 774 case MDT_VERSION: 775 clen = *cp++; 776 if (clen != modnamelen || bcmp(cp, modname, clen) != 0) 777 break; 778 cp += clen; 779 INT_ALIGN(mdp->d_hints, cp); 780 ival = *(int*)cp; --- 15 unchanged lines hidden (view full) --- 796 break; 797 } 798 recptr += reclen + sizeof(int); 799 } 800 /* 801 * Finally check if KLD is in the place 802 */ 803 if (found) |
804 result = file_lookup(mdp->d_path, cp, clen, NULL); | 804 result = file_lookup(mdp->d_path, (const char *)cp, clen, NULL); |
805 else if (best) | 805 else if (best) |
806 result = file_lookup(mdp->d_path, best, blen, NULL); | 806 result = file_lookup(mdp->d_path, (const char *)best, blen, NULL); |
807bad: 808 /* 809 * If nothing found or hints is absent - fallback to the old way 810 * by using "kldname[.ko]" as module name. 811 */ 812 if (!found && !bestver && result == NULL) 813 result = file_lookup(mdp->d_path, modname, modnamelen, kld_ext_list); 814 return result; --- 241 unchanged lines hidden --- | 807bad: 808 /* 809 * If nothing found or hints is absent - fallback to the old way 810 * by using "kldname[.ko]" as module name. 811 */ 812 if (!found && !bestver && result == NULL) 813 result = file_lookup(mdp->d_path, modname, modnamelen, kld_ext_list); 814 return result; --- 241 unchanged lines hidden --- |