/* Compare two device-paths, stopping when the shorter of the two hits an End* node. This is useful to, for example, compare a device-path representing a device with one representing a file on the device, or a device with a parent device.  */
int efi_dp_match(const struct efi_device_path *a, const struct efi_device_path *b)
/* Compare two device-paths, stopping when the shorter of the two hits an End* node. This is useful to, for example, compare a device-path representing a device with one representing a file on the device, or a device with a parent device.  */
int efi_dp_match(const struct efi_device_path *a, const struct efi_device_path *b)
{
	while (1) {
		int ret;
		ret = memcmp(&a->length, &b->length, sizeof(a->length));
		if (ret)
			return ret;
		ret = memcmp(a, b, a->length);
		if (ret)
			return ret;
		a = efi_dp_next(a);
		b = efi_dp_next(b);
		if (!a || !b)
			return 0;
	}
}