svn commit: r336651 - in head/stand/efi: include libefi
Warner Losh
imp at FreeBSD.org
Mon Jul 23 20:36:26 UTC 2018
Author: imp
Date: Mon Jul 23 20:36:25 2018
New Revision: 336651
URL: https://svnweb.freebsd.org/changeset/base/336651
Log:
Implement efi_devpath_to_media_path
Takes a generic device path as its input. Scans through it to find the
first media_path node in it and returns a pointer to it. If none is
found, NULL is returned.
Sponsored by: Netflix
Modified:
head/stand/efi/include/efilib.h
head/stand/efi/libefi/devpath.c
Modified: head/stand/efi/include/efilib.h
==============================================================================
--- head/stand/efi/include/efilib.h Mon Jul 23 19:49:54 2018 (r336650)
+++ head/stand/efi/include/efilib.h Mon Jul 23 20:36:25 2018 (r336651)
@@ -88,6 +88,7 @@ bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_P
bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
void efi_free_devpath_name(CHAR16 *);
+EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
int efi_status_to_errno(EFI_STATUS);
EFI_STATUS errno_to_efi_status(int errno);
Modified: head/stand/efi/libefi/devpath.c
==============================================================================
--- head/stand/efi/libefi/devpath.c Mon Jul 23 19:49:54 2018 (r336650)
+++ head/stand/efi/libefi/devpath.c Mon Jul 23 20:36:25 2018 (r336651)
@@ -195,3 +195,19 @@ efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEV
}
return (true);
}
+
+/*
+ * Skip over the 'prefix' part of path and return the part of the path
+ * that starts with the first node that's a MEDIA_DEVICE_PATH.
+ */
+EFI_DEVICE_PATH *
+efi_devpath_to_media_path(EFI_DEVICE_PATH *path)
+{
+
+ while (!IsDevicePathEnd(path)) {
+ if (DevicePathType(path) == MEDIA_DEVICE_PATH)
+ return (path);
+ path = NextDevicePathNode(path);
+ }
+ return (NULL);
+}
More information about the svn-src-head
mailing list