1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

sd-boot: Invert if in disk_get_part_uuid()

This commit is contained in:
Jan Janssen 2021-09-24 10:24:38 +02:00 committed by Lennart Poettering
parent 6f47ab1bb1
commit 6e7bb7d3ee

View File

@ -8,29 +8,29 @@
EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]) {
EFI_DEVICE_PATH *device_path;
_cleanup_freepool_ EFI_DEVICE_PATH *paths = NULL;
assert(handle);
/* export the device path this image is started from */
device_path = DevicePathFromHandle(handle);
if (device_path) {
_cleanup_freepool_ EFI_DEVICE_PATH *paths = NULL;
if (!device_path)
return EFI_NOT_FOUND;
paths = UnpackDevicePath(device_path);
for (EFI_DEVICE_PATH *path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
HARDDRIVE_DEVICE_PATH *drive;
paths = UnpackDevicePath(device_path);
for (EFI_DEVICE_PATH *path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
HARDDRIVE_DEVICE_PATH *drive;
if (DevicePathType(path) != MEDIA_DEVICE_PATH)
continue;
if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP)
continue;
drive = (HARDDRIVE_DEVICE_PATH *)path;
if (drive->SignatureType != SIGNATURE_TYPE_GUID)
continue;
if (DevicePathType(path) != MEDIA_DEVICE_PATH)
continue;
if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP)
continue;
drive = (HARDDRIVE_DEVICE_PATH *)path;
if (drive->SignatureType != SIGNATURE_TYPE_GUID)
continue;
GuidToString(uuid, (EFI_GUID *)&drive->Signature);
return EFI_SUCCESS;
}
GuidToString(uuid, (EFI_GUID *)&drive->Signature);
return EFI_SUCCESS;
}
return EFI_NOT_FOUND;