svn commit: r322941 - head/sys/boot/efi/boot1
Warner Losh
imp at FreeBSD.org
Sun Aug 27 03:10:18 UTC 2017
Author: imp
Date: Sun Aug 27 03:10:16 2017
New Revision: 322941
URL: https://svnweb.freebsd.org/changeset/base/322941
Log:
Eliminate redunant device path matching.
Use efi_devpath_match instead of device_paths_match. They are
functionally the same. Remove device_paths_match from boot1.c and call
efi_devpath_match instead.
Sponsored by: Netflix
Modified:
head/sys/boot/efi/boot1/boot1.c
Modified: head/sys/boot/efi/boot1/boot1.c
==============================================================================
--- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 23:13:18 2017 (r322940)
+++ head/sys/boot/efi/boot1/boot1.c Sun Aug 27 03:10:16 2017 (r322941)
@@ -76,53 +76,6 @@ Free(void *buf, const char *file __unused, int line __
}
/*
- * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match,
- * FALSE otherwise.
- */
-static BOOLEAN
-nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
-{
- size_t len;
-
- if (imgpath == NULL || imgpath->Type != devpath->Type ||
- imgpath->SubType != devpath->SubType)
- return (FALSE);
-
- len = DevicePathNodeLength(imgpath);
- if (len != DevicePathNodeLength(devpath))
- return (FALSE);
-
- return (memcmp(imgpath, devpath, (size_t)len) == 0);
-}
-
-/*
- * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes
- * in imgpath and devpath match up to their respective occurrences of a
- * media node, FALSE otherwise.
- */
-static BOOLEAN
-device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
-{
-
- if (imgpath == NULL)
- return (FALSE);
-
- while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) {
- if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) &&
- IsDevicePathType(devpath, MEDIA_DEVICE_PATH))
- return (TRUE);
-
- if (!nodes_match(imgpath, devpath))
- return (FALSE);
-
- imgpath = NextDevicePathNode(imgpath);
- devpath = NextDevicePathNode(devpath);
- }
-
- return (FALSE);
-}
-
-/*
* devpath_last returns the last non-path end node in devpath.
*/
static EFI_DEVICE_PATH *
@@ -318,7 +271,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B
if (!blkio->Media->LogicalPartition)
return (EFI_UNSUPPORTED);
- *preferred = device_paths_match(imgpath, devpath);
+ *preferred = efi_devpath_match(imgpath, devpath);
/* Run through each module, see if it can load this partition */
for (i = 0; i < NUM_BOOT_MODULES; i++) {
More information about the svn-src-all
mailing list