Author: imp
Date: Mon Jul 23 20:36:50 2018
New Revision: 336654
URL: https://svnweb.freebsd.org/changeset/base/336654

Log:
  Implement efi_devpath_length
  
  Return the total length, in bytes, of the device path (including the
  terminating node at the end).
  
  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 20:36:45 2018        
(r336653)
+++ head/stand/efi/include/efilib.h     Mon Jul 23 20:36:50 2018        
(r336654)
@@ -90,6 +90,7 @@ bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVI
 CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
 void efi_free_devpath_name(CHAR16 *);
 EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
+UINTN efi_devpath_length(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 20:36:45 2018        
(r336653)
+++ head/stand/efi/libefi/devpath.c     Mon Jul 23 20:36:50 2018        
(r336654)
@@ -219,3 +219,13 @@ efi_devpath_to_media_path(EFI_DEVICE_PATH *path)
        }
        return (NULL);
 }
+
+UINTN
+efi_devpath_length(EFI_DEVICE_PATH  *path)
+{
+       EFI_DEVICE_PATH *start = path;
+
+       while (!IsDevicePathEnd(path))
+               path = NextDevicePathNode(path);
+       return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path);
+}
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to