aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/efi
diff options
context:
space:
mode:
authorToomas Soome <tsoome@FreeBSD.org>2017-11-10 12:07:56 +0000
committerToomas Soome <tsoome@FreeBSD.org>2017-11-10 12:07:56 +0000
commit694dab3ecb205f2010de43356ad54afdd40f67e5 (patch)
tree56786b13c2dc0b5da699ad2da2175f9e73c91c30 /sys/boot/efi
parentbd5bd02583dde9d3bee714758c15a20eeb2614b7 (diff)
loader.efi: efi_devpath_is_prefix should return bool
efi_devpath_is_prefix() is currently returning values 0 or 1, which means it really should return bool. Additionally, use unsigned len, because we only get unsigned values from DevicePathNodeLength().
Notes
Notes: svn path=/head/; revision=325641
Diffstat (limited to 'sys/boot/efi')
-rw-r--r--sys/boot/efi/include/efilib.h2
-rw-r--r--sys/boot/efi/libefi/devpath.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/sys/boot/efi/include/efilib.h b/sys/boot/efi/include/efilib.h
index eaaae613dca0..8721bc576626 100644
--- a/sys/boot/efi/include/efilib.h
+++ b/sys/boot/efi/include/efilib.h
@@ -82,7 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
-int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
+bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
void efi_free_devpath_name(CHAR16 *);
diff --git a/sys/boot/efi/libefi/devpath.c b/sys/boot/efi/libefi/devpath.c
index fd863019fd3b..f881cfce9896 100644
--- a/sys/boot/efi/libefi/devpath.c
+++ b/sys/boot/efi/libefi/devpath.c
@@ -167,13 +167,13 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
return (true);
}
-int
+bool
efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
{
- int len;
+ size_t len;
if (prefix == NULL || path == NULL)
- return (0);
+ return (false);
while (1) {
if (IsDevicePathEnd(prefix))
@@ -181,17 +181,17 @@ efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
if (DevicePathType(prefix) != DevicePathType(path) ||
DevicePathSubType(prefix) != DevicePathSubType(path))
- return (0);
+ return (false);
len = DevicePathNodeLength(prefix);
if (len != DevicePathNodeLength(path))
- return (0);
+ return (false);
- if (memcmp(prefix, path, (size_t)len) != 0)
- return (0);
+ if (memcmp(prefix, path, len) != 0)
+ return (false);
prefix = NextDevicePathNode(prefix);
path = NextDevicePathNode(path);
}
- return (1);
+ return (true);
}