libefi: efi_devpath_match() should return bool
The current implementation of efi_devpath_match() is returning values 0 or 1, so it should be updated to return bool.
This commit is contained in:
parent
07f2d905e6
commit
59fcc285f4
@ -139,30 +139,30 @@ efi_devpath_handle(EFI_DEVICE_PATH *devpath)
|
|||||||
return (h);
|
return (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
|
efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (devpath1 == NULL || devpath2 == NULL)
|
if (devpath1 == NULL || devpath2 == NULL)
|
||||||
return (0);
|
return (false);
|
||||||
|
|
||||||
while (1) {
|
while (true) {
|
||||||
if (DevicePathType(devpath1) != DevicePathType(devpath2) ||
|
if (DevicePathType(devpath1) != DevicePathType(devpath2) ||
|
||||||
DevicePathSubType(devpath1) != DevicePathSubType(devpath2))
|
DevicePathSubType(devpath1) != DevicePathSubType(devpath2))
|
||||||
return (0);
|
return (false);
|
||||||
|
|
||||||
len = DevicePathNodeLength(devpath1);
|
len = DevicePathNodeLength(devpath1);
|
||||||
if (len != DevicePathNodeLength(devpath2))
|
if (len != DevicePathNodeLength(devpath2))
|
||||||
return (0);
|
return (false);
|
||||||
|
|
||||||
if (memcmp(devpath1, devpath2, (size_t)len) != 0)
|
if (memcmp(devpath1, devpath2, (size_t)len) != 0)
|
||||||
return (0);
|
return (false);
|
||||||
|
|
||||||
if (IsDevicePathEnd(devpath1))
|
if (IsDevicePathEnd(devpath1))
|
||||||
break;
|
break;
|
||||||
devpath1 = NextDevicePathNode(devpath1);
|
devpath1 = NextDevicePathNode(devpath1);
|
||||||
devpath2 = NextDevicePathNode(devpath2);
|
devpath2 = NextDevicePathNode(devpath2);
|
||||||
}
|
}
|
||||||
return (1);
|
return (true);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias,
|
|||||||
|
|
||||||
unit = 0;
|
unit = 0;
|
||||||
STAILQ_FOREACH(pd, &cdinfo, pd_link) {
|
STAILQ_FOREACH(pd, &cdinfo, pd_link) {
|
||||||
if (efi_devpath_match(pd->pd_devpath, devpath) != 0) {
|
if (efi_devpath_match(pd->pd_devpath, devpath) == true) {
|
||||||
pd->pd_handle = handle;
|
pd->pd_handle = handle;
|
||||||
pd->pd_alias = alias;
|
pd->pd_alias = alias;
|
||||||
return (0);
|
return (0);
|
||||||
@ -394,7 +394,7 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE part_handle)
|
|||||||
STAILQ_INIT(&pd->pd_part);
|
STAILQ_INIT(&pd->pd_part);
|
||||||
|
|
||||||
STAILQ_FOREACH(hd, &hdinfo, pd_link) {
|
STAILQ_FOREACH(hd, &hdinfo, pd_link) {
|
||||||
if (efi_devpath_match(hd->pd_devpath, disk_devpath) != 0) {
|
if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) {
|
||||||
/* Add the partition. */
|
/* Add the partition. */
|
||||||
pd->pd_handle = part_handle;
|
pd->pd_handle = part_handle;
|
||||||
pd->pd_unit = node->PartitionNumber;
|
pd->pd_unit = node->PartitionNumber;
|
||||||
|
Loading…
Reference in New Issue
Block a user