/* @full_path: device path including device and file path @device_path: path of the device @file_path: relative path of the file or NULL if there is none Return: status code  */
efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, struct efi_device_path **device_path, struct efi_device_path **file_path)
/* @full_path: device path including device and file path @device_path: path of the device @file_path: relative path of the file or NULL if there is none Return: status code  */
efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, struct efi_device_path **device_path, struct efi_device_path **file_path)
{
	struct efi_device_path *p, *dp, *fp = NULL;
	*device_path = NULL;
	*file_path = NULL;
	dp = efi_dp_dup(full_path);
	if (!dp)
		return EFI_OUT_OF_RESOURCES;
	p = dp;
	while (!EFI_DP_TYPE(p, MEDIA_DEVICE, FILE_PATH)) {
		p = efi_dp_next(p);
		if (!p)
			goto out;
	}
	fp = efi_dp_dup(p);
	if (!fp)
		return EFI_OUT_OF_RESOURCES;
	p->type = DEVICE_PATH_TYPE_END;
	p->sub_type = DEVICE_PATH_SUB_TYPE_END;
	p->length = sizeof(*p);
out:
	*device_path = dp;
	*file_path = fp;
	return EFI_SUCCESS;
}