svn commit: r300785 - head/sys/boot/efi/libefi
John Baldwin
jhb at FreeBSD.org
Thu May 26 22:13:41 UTC 2016
Author: jhb
Date: Thu May 26 22:13:40 2016
New Revision: 300785
URL: https://svnweb.freebsd.org/changeset/base/300785
Log:
Use routines from the recently added devpath.c.
These efipart layer did several devpath related operations inline. This
just switches it over to using shared code for working with device paths.
Sponsored by: Cisco Systems
Modified:
head/sys/boot/efi/libefi/efipart.c
Modified: head/sys/boot/efi/libefi/efipart.c
==============================================================================
--- head/sys/boot/efi/libefi/efipart.c Thu May 26 22:07:09 2016 (r300784)
+++ head/sys/boot/efi/libefi/efipart.c Thu May 26 22:13:40 2016 (r300785)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include <efiprot.h>
static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
-static EFI_GUID devpath_guid = DEVICE_PATH_PROTOCOL;
static int efipart_init(void);
static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *,
@@ -85,7 +84,6 @@ efipart_init(void)
UINTN sz;
u_int n, nin, nout;
int err;
- size_t devpathlen;
sz = 0;
hin = NULL;
@@ -112,20 +110,11 @@ efipart_init(void)
return (ENOMEM);
for (n = 0; n < nin; n++) {
- status = BS->HandleProtocol(hin[n], &devpath_guid,
- (void **)&devpath);
- if (EFI_ERROR(status)) {
+ devpath = efi_lookup_devpath(hin[n]);
+ if (devpath == NULL) {
continue;
}
- node = devpath;
- devpathlen = DevicePathNodeLength(node);
- while (!IsDevicePathEnd(NextDevicePathNode(node))) {
- node = NextDevicePathNode(node);
- devpathlen += DevicePathNodeLength(node);
- }
- devpathlen += DevicePathNodeLength(NextDevicePathNode(node));
-
status = BS->HandleProtocol(hin[n], &blkio_guid,
(void**)&blkio);
if (EFI_ERROR(status))
@@ -140,14 +129,10 @@ efipart_init(void)
* we try to find the parent device and add that instead as
* that will be the CD filesystem.
*/
+ node = efi_devpath_last_node(devpath);
if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
DevicePathSubType(node) == MEDIA_CDROM_DP) {
- devpathcpy = malloc(devpathlen);
- memcpy(devpathcpy, devpath, devpathlen);
- node = devpathcpy;
- while (!IsDevicePathEnd(NextDevicePathNode(node)))
- node = NextDevicePathNode(node);
- SetDevicePathEndNode(node);
+ devpathcpy = efi_devpath_trim(devpath);
tmpdevpath = devpathcpy;
status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath,
&handle);
More information about the svn-src-head
mailing list