* [PATCH 1/1] efi_loader: reformat efi_disk_add_dev()
@ 2022-10-07 9:30 Heinrich Schuchardt
0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-10-07 9:30 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt
Make it clearer why InstallMultipleProtocolInterfaces is invoked with two
NULLs:
* rename guid to esp_guid
* put protocol GUIDs and the related interfaces on same lines
* add comment
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index e6a356b589..3e392a4b51 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -395,7 +395,7 @@ static efi_status_t efi_disk_add_dev(
{
struct efi_disk_obj *diskobj;
struct efi_object *handle;
- const efi_guid_t *guid = NULL;
+ const efi_guid_t *esp_guid = NULL;
efi_status_t ret;
/* Don't add empty devices */
@@ -439,7 +439,7 @@ static efi_status_t efi_disk_add_dev(
efi_free_pool(node);
diskobj->media.last_block = part_info->size - 1;
if (part_info->bootable & PART_EFI_SYSTEM_PARTITION)
- guid = &efi_system_partition_guid;
+ esp_guid = &efi_system_partition_guid;
} else {
diskobj->dp = efi_dp_from_part(desc, part);
diskobj->media.last_block = desc->lba - 1;
@@ -454,12 +454,16 @@ static efi_status_t efi_disk_add_dev(
* in this case.
*/
handle = &diskobj->header;
- ret = efi_install_multiple_protocol_interfaces(&handle,
- &efi_guid_device_path,
- diskobj->dp,
- &efi_block_io_guid,
- &diskobj->ops, guid,
- NULL, NULL);
+ ret = efi_install_multiple_protocol_interfaces(
+ &handle,
+ &efi_guid_device_path, diskobj->dp,
+ &efi_block_io_guid, &diskobj->ops,
+ /*
+ * esp_guid must be last entry as it
+ * can be NULL. Its interface is NULL.
+ */
+ esp_guid, NULL,
+ NULL);
if (ret != EFI_SUCCESS)
goto error;
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/1] efi_loader: reformat efi_disk_add_dev()
@ 2022-10-08 7:09 Heinrich Schuchardt
2022-10-10 8:02 ` Ilias Apalodimas
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-10-08 7:09 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt
Make it clearer why InstallMultipleProtocolInterfaces is invoked with two
NULLs:
* rename guid to esp_guid
* put protocol GUIDs and the related interfaces on same lines
* add comment
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index a2095050fd..cef4e45124 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -395,7 +395,7 @@ static efi_status_t efi_disk_add_dev(
{
struct efi_disk_obj *diskobj;
struct efi_object *handle;
- const efi_guid_t *guid = NULL;
+ const efi_guid_t *esp_guid = NULL;
efi_status_t ret;
/* Don't add empty devices */
@@ -439,7 +439,7 @@ static efi_status_t efi_disk_add_dev(
efi_free_pool(node);
diskobj->media.last_block = part_info->size - 1;
if (part_info->bootable & PART_EFI_SYSTEM_PARTITION)
- guid = &efi_system_partition_guid;
+ esp_guid = &efi_system_partition_guid;
} else {
diskobj->dp = efi_dp_from_part(desc, part);
diskobj->media.last_block = desc->lba - 1;
@@ -454,12 +454,16 @@ static efi_status_t efi_disk_add_dev(
* in this case.
*/
handle = &diskobj->header;
- ret = efi_install_multiple_protocol_interfaces(&handle,
- &efi_guid_device_path,
- diskobj->dp,
- &efi_block_io_guid,
- &diskobj->ops, guid,
- NULL, NULL);
+ ret = efi_install_multiple_protocol_interfaces(
+ &handle,
+ &efi_guid_device_path, diskobj->dp,
+ &efi_block_io_guid, &diskobj->ops,
+ /*
+ * esp_guid must be last entry as it
+ * can be NULL. Its interface is NULL.
+ */
+ esp_guid, NULL,
+ NULL);
if (ret != EFI_SUCCESS)
goto error;
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] efi_loader: reformat efi_disk_add_dev()
2022-10-08 7:09 [PATCH 1/1] efi_loader: reformat efi_disk_add_dev() Heinrich Schuchardt
@ 2022-10-10 8:02 ` Ilias Apalodimas
0 siblings, 0 replies; 3+ messages in thread
From: Ilias Apalodimas @ 2022-10-10 8:02 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot
On Sat, Oct 08, 2022 at 09:09:54AM +0200, Heinrich Schuchardt wrote:
> Make it clearer why InstallMultipleProtocolInterfaces is invoked with two
> NULLs:
>
> * rename guid to esp_guid
> * put protocol GUIDs and the related interfaces on same lines
> * add comment
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index a2095050fd..cef4e45124 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -395,7 +395,7 @@ static efi_status_t efi_disk_add_dev(
> {
> struct efi_disk_obj *diskobj;
> struct efi_object *handle;
> - const efi_guid_t *guid = NULL;
> + const efi_guid_t *esp_guid = NULL;
> efi_status_t ret;
>
> /* Don't add empty devices */
> @@ -439,7 +439,7 @@ static efi_status_t efi_disk_add_dev(
> efi_free_pool(node);
> diskobj->media.last_block = part_info->size - 1;
> if (part_info->bootable & PART_EFI_SYSTEM_PARTITION)
> - guid = &efi_system_partition_guid;
> + esp_guid = &efi_system_partition_guid;
> } else {
> diskobj->dp = efi_dp_from_part(desc, part);
> diskobj->media.last_block = desc->lba - 1;
> @@ -454,12 +454,16 @@ static efi_status_t efi_disk_add_dev(
> * in this case.
> */
> handle = &diskobj->header;
> - ret = efi_install_multiple_protocol_interfaces(&handle,
> - &efi_guid_device_path,
> - diskobj->dp,
> - &efi_block_io_guid,
> - &diskobj->ops, guid,
> - NULL, NULL);
> + ret = efi_install_multiple_protocol_interfaces(
> + &handle,
> + &efi_guid_device_path, diskobj->dp,
> + &efi_block_io_guid, &diskobj->ops,
> + /*
> + * esp_guid must be last entry as it
> + * can be NULL. Its interface is NULL.
> + */
> + esp_guid, NULL,
> + NULL);
> if (ret != EFI_SUCCESS)
> goto error;
>
> --
> 2.37.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-10 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-08 7:09 [PATCH 1/1] efi_loader: reformat efi_disk_add_dev() Heinrich Schuchardt
2022-10-10 8:02 ` Ilias Apalodimas
-- strict thread matches above, loose matches on Subject: below --
2022-10-07 9:30 Heinrich Schuchardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox