From 1028a2d4b3c644dde39f8f091c24438c15f0cdfa Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 7 Sep 2017 07:30:14 +0000 Subject: [PATCH] Implement efidp_size efidp_size will return the size, in bytes, of a EFI device path structure. This is a convenience wrapper in the same style as the other linux routines. It's implemented by GetDevicePathSize from EDK2 we already needed for other things. Sponsored by: Netflix --- lib/libefivar/efivar-dp-format.c | 6 ++++++ lib/libefivar/efivar-dp.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index 0f5db4d12b60..ca122ef63c36 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -2430,3 +2430,9 @@ efidp_format_device_path(char *buf, size_t len, const_efidp dp, ssize_t max) return retval; } + +size_t +efidp_size(const_efidp dp) +{ + return GetDevicePathSize(__DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp)); +} diff --git a/lib/libefivar/efivar-dp.h b/lib/libefivar/efivar-dp.h index 94dd1189cebe..f620a67550a0 100644 --- a/lib/libefivar/efivar-dp.h +++ b/lib/libefivar/efivar-dp.h @@ -62,4 +62,6 @@ ssize_t efidp_format_device_path(char *buf, size_t len, const_efidp dp, ssize_t max); ssize_t efidp_parse_device_path(char *path, efidp out, size_t max); +size_t efidp_size(const_efidp); + #endif /* _EFIVAR_DP_H_ */