From owner-svn-src-all@freebsd.org Thu Dec 14 16:41:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0975E86C9E; Thu, 14 Dec 2017 16:41:53 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A29D66C096; Thu, 14 Dec 2017 16:41:53 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBEGfqEf067599; Thu, 14 Dec 2017 16:41:52 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBEGfqX9067594; Thu, 14 Dec 2017 16:41:52 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201712141641.vBEGfqX9067594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 14 Dec 2017 16:41:52 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/stand/efi: boot1 include libefi X-SVN-Commit-Revision: 326854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 16:41:54 -0000 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 #include -typedef CHAR16 efi_char; #include #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 + +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 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 #include -#ifdef LIBEFI +#ifdef _STANDALONE #include #else #include #include #include #include -#endif #include #include +#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 #include #include +#include #include 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);