On 2018-09-05 13:12, Andreas Reichel wrote:
On Tue, Sep 04, 2018 at 05:44:07PM +0200, Jan Kiszka wrote:
On 2018-09-03 16:09, [ext] Andreas J. Reichel wrote:
From: Andreas Reichel <[email protected]>

Get the boot device out of the loaded image's handle and add a
function to compare a device path with the boot device's one.

                           status);
        }
+       tmp = DevicePathToStr(DevicePathFromHandle(loaded_image->DeviceHandle));

For my understanding: What is actually cut off there, ie. who does that path
look like so that we only to cut off the last element, and there is not
filesystem directory element remaining in it?

The DevicePath is pointing to the device, not to the file. That was my
argumentation all along regarding dirname/RemoveLastNodeFromDevicePath.
Since it is not just a directory.

Please read below.

+BOOLEAN IsOnBootDevice(EFI_DEVICE_PATH *dp)
+{
+       extern CHAR16 *boot_device_path;
+       CHAR16 *device_path, *tmp;
+       BOOLEAN result = FALSE;
+
+       tmp = DevicePathToStr(dp);
+       device_path = dirname(tmp);
+       mfree(tmp);
+
+       if (StrCmp(device_path, boot_device_path) == 0) {
+               result = TRUE;
+       }
+       mfree(device_path);
+
+       return result;
+}
+
   uint32_t calc_crc32(void *data, int32_t size)
   {
        uint32_t crc;


Looks good, /me just needs to understand the path structure, and maybe that
should then also be documented in the code.

Agreed. We have something like

controller/bus/device/partition

in all cases.

Like

PciRoot(0)/Pci(0x1,0x1)/Ata(Primary,Master)/HD(Part2,Sig870E7D1B-3D9F-4E49-98BA-7283AB6AA632)

which gets cut to

PciRoot(0)/Pci(0x1,0x1)/Ata(Primary,Master)

I will add that to the documentation.

OK, so you are removing the disk/partition element from the boot device path. Is it UEFI standard that this path will always have the above structure?

It's probably the question what "device" is in this UEFI context, but you are passing in a device according to the type (EFI_DEVICE_PATH), and the extracted path is maybe rather the "boot medium".

As I said on patch 1: Make the extraction helper context specific in its naming. Then you can do all the shortcuts you like, and we can settle that topic.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

--
You received this message because you are subscribed to the Google Groups "EFI Boot 
Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/2fa75629-a5c9-957e-117a-99f663d378a8%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to