Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2017 16:41:52 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326854 - in head/stand/efi: boot1 include libefi
Message-ID:  <201712141641.vBEGfqX9067594@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Thu Dec 14 16:41:52 2017
New Revision: 326854
URL: https://svnweb.freebsd.org/changeset/base/326854

Log:
  libefi: make efichar.h more usable in stand code
  
  Use _STANDALONE for guard expression in efichar.[ch] and add efi_char typedef.
  clean up boot1.c, and replace for loop in efipart.c with ucs2len().
  
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D13488

Modified:
  head/stand/efi/boot1/boot1.c
  head/stand/efi/include/efichar.h
  head/stand/efi/libefi/Makefile
  head/stand/efi/libefi/efichar.c
  head/stand/efi/libefi/efipart.c

Modified: head/stand/efi/boot1/boot1.c
==============================================================================
--- head/stand/efi/boot1/boot1.c	Thu Dec 14 15:41:32 2017	(r326853)
+++ head/stand/efi/boot1/boot1.c	Thu Dec 14 16:41:52 2017	(r326854)
@@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$");
 
 #include <efi.h>
 #include <eficonsctl.h>
-typedef CHAR16 efi_char;
 #include <efichar.h>
 
 #include "boot_module.h"

Modified: head/stand/efi/include/efichar.h
==============================================================================
--- head/stand/efi/include/efichar.h	Thu Dec 14 15:41:32 2017	(r326853)
+++ head/stand/efi/include/efichar.h	Thu Dec 14 16:41:52 2017	(r326854)
@@ -29,6 +29,12 @@
 #ifndef _BOOT_EFI_EFICHAR_H_
 #define	_BOOT_EFI_EFICHAR_H_
 
+#ifdef _STANDALONE
+#include <efi.h>
+
+typedef CHAR16 efi_char;
+#endif
+
 int ucs2_to_utf8(const efi_char *, char **);
 int utf8_to_ucs2(const char *, efi_char **, size_t *);
 int ucs2len(const efi_char *);

Modified: head/stand/efi/libefi/Makefile
==============================================================================
--- head/stand/efi/libefi/Makefile	Thu Dec 14 15:41:32 2017	(r326853)
+++ head/stand/efi/libefi/Makefile	Thu Dec 14 16:41:52 2017	(r326854)
@@ -52,6 +52,4 @@ CFLAGS+= ${FORMAT_EXTENSIONS}
 CFLAGS+= -DTERM_EMU
 .endif
 
-CFLAGS+= -DLIBEFI
-
 .include <bsd.lib.mk>

Modified: head/stand/efi/libefi/efichar.c
==============================================================================
--- head/stand/efi/libefi/efichar.c	Thu Dec 14 15:41:32 2017	(r326853)
+++ head/stand/efi/libefi/efichar.c	Thu Dec 14 16:41:52 2017	(r326854)
@@ -29,16 +29,16 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <errno.h>
-#ifdef LIBEFI
+#ifdef _STANDALONE
 #include <stand.h>
 #else
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#endif
 #include <sys/efi.h>
 #include <machine/efi.h>
+#endif
 
 #include "efichar.h"
 

Modified: head/stand/efi/libefi/efipart.c
==============================================================================
--- head/stand/efi/libefi/efipart.c	Thu Dec 14 15:41:32 2017	(r326853)
+++ head/stand/efi/libefi/efipart.c	Thu Dec 14 16:41:52 2017	(r326854)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <efi.h>
 #include <efilib.h>
 #include <efiprot.h>
+#include <efichar.h>
 #include <disk.h>
 
 static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
@@ -564,8 +565,7 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle)
 		unit = 0;
 
 	/* FILEPATH_DEVICE_PATH has 0 terminated string */
-	for (len = 0; node->PathName[len] != 0; len++)
-		;
+	len = ucs2len(node->PathName);
 	if ((pathname = malloc(len + 1)) == NULL) {
 		printf("Failed to add disk, out of memory\n");
 		free(pd);



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