Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/efi/libefi/devpath.c
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | while (true) { | ||||
if (IsDevicePathEnd(devpath1)) | if (IsDevicePathEnd(devpath1)) | ||||
break; | break; | ||||
devpath1 = NextDevicePathNode(devpath1); | devpath1 = NextDevicePathNode(devpath1); | ||||
devpath2 = NextDevicePathNode(devpath2); | devpath2 = NextDevicePathNode(devpath2); | ||||
} | } | ||||
return (true); | return (true); | ||||
} | } | ||||
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); | |||||
} |