Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Aug 2016 17:17:02 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303723 - head/sys/boot/efi/boot1
Message-ID:  <201608031717.u73HH2Ui082337@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Aug  3 17:17:01 2016
New Revision: 303723
URL: https://svnweb.freebsd.org/changeset/base/303723

Log:
  Fix a few cosmetic issues in boot1.efi.
  
  - Use ANSI function signatures.
  - Remove unneeded checks for a NULL boot module.
  - Use nitems().
  
  MFC after:	1 week
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/boot/efi/boot1/boot1.c
  head/sys/boot/efi/boot1/ufs_module.c
  head/sys/boot/efi/boot1/zfs_module.c

Modified: head/sys/boot/efi/boot1/boot1.c
==============================================================================
--- head/sys/boot/efi/boot1/boot1.c	Wed Aug  3 17:11:08 2016	(r303722)
+++ head/sys/boot/efi/boot1/boot1.c	Wed Aug  3 17:17:01 2016	(r303723)
@@ -43,7 +43,7 @@ static const boot_module_t *boot_modules
 #endif
 };
 
-#define NUM_BOOT_MODULES (sizeof(boot_modules) / sizeof(boot_module_t*))
+#define	NUM_BOOT_MODULES	nitems(boot_modules)
 /* The initial number of handles used to query EFI for partitions. */
 #define NUM_HANDLES_INIT	24
 
@@ -331,8 +331,6 @@ load_loader(const boot_module_t **modp, 
 	const boot_module_t *mod;
 
 	for (i = 0; i < NUM_BOOT_MODULES; i++) {
-		if (boot_modules[i] == NULL)
-			continue;
 		mod = boot_modules[i];
 		for (dev = mod->devices(); dev != NULL; dev = dev->next) {
 			if (dev->preferred != preferred)
@@ -355,7 +353,7 @@ load_loader(const boot_module_t **modp, 
  * it simply boots, otherwise it returns the status of last EFI call.
  */
 static EFI_STATUS
-try_boot()
+try_boot(void)
 {
 	size_t bufsize, loadersize, cmdsize;
 	void *buf, *loaderbuf;
@@ -498,9 +496,6 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PA
 
 	/* Run through each module, see if it can load this partition */
 	for (i = 0; i < NUM_BOOT_MODULES; i++) {
-		if (boot_modules[i] == NULL)
-			continue;
-
 		if ((status = bs->AllocatePool(EfiLoaderData,
 		    sizeof(*devinfo), (void **)&devinfo)) !=
 		    EFI_SUCCESS) {
@@ -605,9 +600,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T
 	printf("   Loader path: %s\n\n", PATH_LOADER_EFI);
 	printf("   Initializing modules:");
 	for (i = 0; i < NUM_BOOT_MODULES; i++) {
-		if (boot_modules[i] == NULL)
-			continue;
-
 		printf(" %s", boot_modules[i]->name);
 		if (boot_modules[i]->init != NULL)
 			boot_modules[i]->init();
@@ -667,10 +659,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T
 
 	/* Status summary. */
 	for (i = 0; i < NUM_BOOT_MODULES; i++) {
-		if (boot_modules[i] != NULL) {
-			printf("    ");
-			boot_modules[i]->status();
-		}
+		printf("    ");
+		boot_modules[i]->status();
 	}
 
 	try_boot();

Modified: head/sys/boot/efi/boot1/ufs_module.c
==============================================================================
--- head/sys/boot/efi/boot1/ufs_module.c	Wed Aug  3 17:11:08 2016	(r303722)
+++ head/sys/boot/efi/boot1/ufs_module.c	Wed Aug  3 17:17:01 2016	(r303723)
@@ -142,7 +142,7 @@ load(const char *filepath, dev_info_t *d
 }
 
 static void
-status()
+status(void)
 {
 	int i;
 	dev_info_t *dev;
@@ -164,7 +164,7 @@ status()
 }
 
 static dev_info_t *
-_devices()
+_devices(void)
 {
 
 	return (devices);

Modified: head/sys/boot/efi/boot1/zfs_module.c
==============================================================================
--- head/sys/boot/efi/boot1/zfs_module.c	Wed Aug  3 17:11:08 2016	(r303722)
+++ head/sys/boot/efi/boot1/zfs_module.c	Wed Aug  3 17:17:01 2016	(r303723)
@@ -154,7 +154,7 @@ load(const char *filepath, dev_info_t *d
 }
 
 static void
-status()
+status(void)
 {
 	spa_t *spa;
 
@@ -172,14 +172,14 @@ status()
 }
 
 static void
-init()
+init(void)
 {
 
 	zfs_init();
 }
 
 static dev_info_t *
-_devices()
+_devices(void)
 {
 
 	return (devices);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608031717.u73HH2Ui082337>