Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/efi/libefi/devpath.c
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | if (textProtocol == NULL) | ||||
return (NULL); | return (NULL); | ||||
return (textProtocol->ConvertDevicePathToText(devpath, TRUE, TRUE)); | return (textProtocol->ConvertDevicePathToText(devpath, TRUE, TRUE)); | ||||
} | } | ||||
void | void | ||||
efi_free_devpath_name(CHAR16 *text) | efi_free_devpath_name(CHAR16 *text) | ||||
{ | { | ||||
BS->FreePool(text); | BS->FreePool(text); | ||||
} | } | ||||
EFI_DEVICE_PATH * | EFI_DEVICE_PATH * | ||||
efi_devpath_last_node(EFI_DEVICE_PATH *devpath) | efi_devpath_last_node(EFI_DEVICE_PATH *devpath) | ||||
{ | { | ||||
if (IsDevicePathEnd(devpath)) | if (IsDevicePathEnd(devpath)) | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | while (1) { | ||||
if (memcmp(devpath1, devpath2, (size_t)len) != 0) | if (memcmp(devpath1, devpath2, (size_t)len) != 0) | ||||
return (0); | return (0); | ||||
if (IsDevicePathEnd(devpath1)) | if (IsDevicePathEnd(devpath1)) | ||||
break; | break; | ||||
devpath1 = NextDevicePathNode(devpath1); | devpath1 = NextDevicePathNode(devpath1); | ||||
devpath2 = NextDevicePathNode(devpath2); | devpath2 = NextDevicePathNode(devpath2); | ||||
} | |||||
return (1); | |||||
} | |||||
int | |||||
efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path) | |||||
{ | |||||
int len; | |||||
if (prefix == NULL || path == NULL) | |||||
return (0); | |||||
while (1) { | |||||
if (IsDevicePathEnd(prefix)) | |||||
break; | |||||
if (DevicePathType(prefix) != DevicePathType(path) || | |||||
DevicePathSubType(prefix) != DevicePathSubType(path)) | |||||
return (0); | |||||
len = DevicePathNodeLength(prefix); | |||||
if (len != DevicePathNodeLength(path)) | |||||
return (0); | |||||
if (memcmp(prefix, path, (size_t)len) != 0) | |||||
return (0); | |||||
prefix = NextDevicePathNode(prefix); | |||||
path = NextDevicePathNode(path); | |||||
} | } | ||||
return (1); | return (1); | ||||
} | } |