]>
git.proxmox.com Git - systemd.git/blob - src/boot/efi/disk.c
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU Lesser General Public License as published by
4 * the Free Software Foundation; either version 2.1 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * Copyright (C) 2015 Kay Sievers <kay@vrfy.org>
20 EFI_STATUS
disk_get_part_uuid(EFI_HANDLE
*handle
, CHAR16 uuid
[37]) {
21 EFI_DEVICE_PATH
*device_path
;
22 EFI_STATUS r
= EFI_NOT_FOUND
;
24 /* export the device path this image is started from */
25 device_path
= DevicePathFromHandle(handle
);
27 EFI_DEVICE_PATH
*path
, *paths
;
29 paths
= UnpackDevicePath(device_path
);
30 for (path
= paths
; !IsDevicePathEnd(path
); path
= NextDevicePathNode(path
)) {
31 HARDDRIVE_DEVICE_PATH
*drive
;
33 if (DevicePathType(path
) != MEDIA_DEVICE_PATH
)
35 if (DevicePathSubType(path
) != MEDIA_HARDDRIVE_DP
)
37 drive
= (HARDDRIVE_DEVICE_PATH
*)path
;
38 if (drive
->SignatureType
!= SIGNATURE_TYPE_GUID
)
41 GuidToString(uuid
, (EFI_GUID
*)&drive
->Signature
);