Bläddra i källkod

[efi] Avoid unnecessarily passing pointers to EFI_HANDLEs

efi_file_install() and efi_download_install() are both used to install
onto existing handles.  There is therefore no need to allow for each
of their calls to InstallMultipleProtocolInterfaces() to create a new
handle.

By passing the handle directly (rather than a pointer to the handle),
we avoid potential confusion (and erroneous debug message colours).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 år sedan
förälder
incheckning
4a480f1d15

+ 2
- 2
src/image/efi_image.c Visa fil

@@ -157,14 +157,14 @@ static int efi_image_exec ( struct image *image ) {
157 157
 	}
158 158
 
159 159
 	/* Install file I/O protocols */
160
-	if ( ( rc = efi_file_install ( &snpdev->handle ) ) != 0 ) {
160
+	if ( ( rc = efi_file_install ( snpdev->handle ) ) != 0 ) {
161 161
 		DBGC ( image, "EFIIMAGE %p could not install file protocol: "
162 162
 		       "%s\n", image, strerror ( rc ) );
163 163
 		goto err_file_install;
164 164
 	}
165 165
 
166 166
 	/* Install iPXE download protocol */
167
-	if ( ( rc = efi_download_install ( &snpdev->handle ) ) != 0 ) {
167
+	if ( ( rc = efi_download_install ( snpdev->handle ) ) != 0 ) {
168 168
 		DBGC ( image, "EFIIMAGE %p could not install iPXE download "
169 169
 		       "protocol: %s\n", image, strerror ( rc ) );
170 170
 		goto err_download_install;

+ 2
- 2
src/include/ipxe/efi/efi_download.h Visa fil

@@ -151,7 +151,7 @@ struct _IPXE_DOWNLOAD_PROTOCOL {
151 151
     0x3eaeaebd, 0xdecf, 0x493b, { 0x9b, 0xd1, 0xcd, 0xb2, 0xde, 0xca, 0xe7, 0x19 } \
152 152
   }
153 153
 
154
-extern int efi_download_install ( EFI_HANDLE *device );
155
-extern void efi_download_uninstall ( EFI_HANDLE device );
154
+extern int efi_download_install ( EFI_HANDLE handle );
155
+extern void efi_download_uninstall ( EFI_HANDLE handle );
156 156
 
157 157
 #endif /* _IPXE_DOWNLOAD_H */

+ 1
- 1
src/include/ipxe/efi/efi_file.h Visa fil

@@ -7,7 +7,7 @@
7 7
  *
8 8
  */
9 9
 
10
-extern int efi_file_install ( EFI_HANDLE *handle );
10
+extern int efi_file_install ( EFI_HANDLE handle );
11 11
 extern void efi_file_uninstall ( EFI_HANDLE handle );
12 12
 
13 13
 #endif /* _IPXE_EFI_FILE_H */

+ 2
- 2
src/interface/efi/efi_download.c Visa fil

@@ -205,13 +205,13 @@ static IPXE_DOWNLOAD_PROTOCOL ipxe_download_protocol_interface = {
205 205
  * @v handle		EFI handle
206 206
  * @ret rc		Return status code
207 207
  */
208
-int efi_download_install ( EFI_HANDLE *handle ) {
208
+int efi_download_install ( EFI_HANDLE handle ) {
209 209
 	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
210 210
 	EFI_STATUS efirc;
211 211
 	int rc;
212 212
 
213 213
 	efirc = bs->InstallMultipleProtocolInterfaces (
214
-			handle,
214
+			&handle,
215 215
 			&ipxe_download_protocol_guid,
216 216
 			&ipxe_download_protocol_interface,
217 217
 			NULL );

+ 7
- 7
src/interface/efi/efi_file.c Visa fil

@@ -575,7 +575,7 @@ static EFI_DISK_IO_PROTOCOL efi_disk_io_protocol = {
575 575
  * @v handle		EFI handle
576 576
  * @ret rc		Return status code
577 577
  */
578
-int efi_file_install ( EFI_HANDLE *handle ) {
578
+int efi_file_install ( EFI_HANDLE handle ) {
579 579
 	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
580 580
 	union {
581 581
 		EFI_DISK_IO_PROTOCOL *diskio;
@@ -592,7 +592,7 @@ int efi_file_install ( EFI_HANDLE *handle ) {
592 592
 	 * handle just to keep things looking normal.
593 593
 	 */
594 594
 	if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
595
-			handle,
595
+			&handle,
596 596
 			&efi_block_io_protocol_guid,
597 597
 			&efi_block_io_protocol,
598 598
 			&efi_disk_io_protocol_guid,
@@ -624,9 +624,9 @@ int efi_file_install ( EFI_HANDLE *handle ) {
624 624
 	 * of calls to our DRIVER_STOP method when starting the EFI
625 625
 	 * shell.  I have no idea why this is.
626 626
 	 */
627
-	if ( ( efirc = bs->OpenProtocol ( *handle, &efi_disk_io_protocol_guid,
627
+	if ( ( efirc = bs->OpenProtocol ( handle, &efi_disk_io_protocol_guid,
628 628
 					  &diskio.interface, efi_image_handle,
629
-					  *handle,
629
+					  handle,
630 630
 					  EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
631 631
 		rc = -EEFI ( efirc );
632 632
 		DBGC ( handle, "Could not open disk I/O protocol: %s\n",
@@ -637,11 +637,11 @@ int efi_file_install ( EFI_HANDLE *handle ) {
637 637
 
638 638
 	return 0;
639 639
 
640
-	bs->CloseProtocol ( *handle, &efi_disk_io_protocol_guid,
641
-			    efi_image_handle, *handle );
640
+	bs->CloseProtocol ( handle, &efi_disk_io_protocol_guid,
641
+			    efi_image_handle, handle );
642 642
  err_open:
643 643
 	bs->UninstallMultipleProtocolInterfaces (
644
-			*handle,
644
+			handle,
645 645
 			&efi_simple_file_system_protocol_guid,
646 646
 			&efi_simple_file_system_protocol,
647 647
 			&efi_disk_io_protocol_guid,

Laddar…
Avbryt
Spara