From f1a76ba80910f8c1eaa4b4924f8cbaa180e15d4b Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 11 Dec 2012 16:36:34 +0100 Subject: [PATCH] Cleanup include files in filesystem directory, prepare to run tests --- filesystems/Make.tiano | 2 +- filesystems/fsw_base.h | 8 +--- filesystems/fsw_core.h | 2 +- filesystems/fsw_efi.c | 7 +--- filesystems/fsw_efi_base.h | 6 ++- .../{VBoxFswParam.h => fsw_efi_edk2_base.h} | 40 +++++++++++++++---- filesystems/fsw_efi_lib.c | 2 - filesystems/hfs_format.h | 3 +- 8 files changed, 46 insertions(+), 24 deletions(-) rename filesystems/{VBoxFswParam.h => fsw_efi_edk2_base.h} (57%) diff --git a/filesystems/Make.tiano b/filesystems/Make.tiano index 9eea221..f709b3e 100644 --- a/filesystems/Make.tiano +++ b/filesystems/Make.tiano @@ -62,7 +62,7 @@ BUILDME = $(DRIVERNAME)_$(FILENAME_CODE).efi OPTIMFLAGS = -fno-strict-aliasing -mno-red-zone -Wno-address -Os DEBUGFLAGS = -Wall -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections -CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c -include AutoGen.h +CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c -include AutoGen.h -DHOST_EFI_EDK2 prefix = /usr/bin/ CC = $(prefix)gcc diff --git a/filesystems/fsw_base.h b/filesystems/fsw_base.h index 0d5e7ba..3405f57 100644 --- a/filesystems/fsw_base.h +++ b/filesystems/fsw_base.h @@ -51,15 +51,11 @@ #ifndef _FSW_BASE_H_ #define _FSW_BASE_H_ -//#define HOST_EFI 1 -#define VBOX -#ifdef VBOX -#include "VBoxFswParam.h" +#ifdef HOST_EFI_EDK2 +#define HOST_EFI #endif -//#include - #ifndef FSW_DEBUG_LEVEL /** * Global debugging level. Can be set locally for the scope of a single diff --git a/filesystems/fsw_core.h b/filesystems/fsw_core.h index 4464cbd..db26fc7 100644 --- a/filesystems/fsw_core.h +++ b/filesystems/fsw_core.h @@ -58,7 +58,7 @@ /** Maximum size for a path, specifically symlink target paths. */ -#ifndef VBOX +#ifndef HOST_EFI_EDK2 #define FSW_PATH_MAX (4096) #else /* Too big allocations are handled with alloca() */ diff --git a/filesystems/fsw_efi.c b/filesystems/fsw_efi.c index 1193684..7df71aa 100644 --- a/filesystems/fsw_efi.c +++ b/filesystems/fsw_efi.c @@ -57,11 +57,7 @@ #define DEBUG_LEVEL 0 #ifndef FSTYPE -#ifdef VBOX #error FSTYPE must be defined! -#else -#define FSTYPE ext2 -#endif #endif #define DEBUG_VBFS 1 @@ -192,7 +188,8 @@ EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE ImageHandle, { EFI_STATUS Status; -#ifndef VBOX +#ifndef HOST_EFI_EDK2 + // Not available in EDK2 toolkit InitializeLib(ImageHandle, SystemTable); #endif diff --git a/filesystems/fsw_efi_base.h b/filesystems/fsw_efi_base.h index 7c7af75..533be93 100644 --- a/filesystems/fsw_efi_base.h +++ b/filesystems/fsw_efi_base.h @@ -52,7 +52,11 @@ #ifndef _FSW_EFI_BASE_H_ #define _FSW_EFI_BASE_H_ -#ifndef VBOX +// If its EDK2 EFI Toolkit +#ifdef HOST_EFI_EDK2 +#include "fsw_efi_edk2_base.h" +#else +// Intel EFI Toolkit #include #include #define PROTO_NAME(x) x diff --git a/filesystems/VBoxFswParam.h b/filesystems/fsw_efi_edk2_base.h similarity index 57% rename from filesystems/VBoxFswParam.h rename to filesystems/fsw_efi_edk2_base.h index 0c44f89..a144a60 100644 --- a/filesystems/VBoxFswParam.h +++ b/filesystems/fsw_efi_edk2_base.h @@ -1,8 +1,34 @@ -/* $Id: VBoxFswParam.h 29125 2010-05-06 09:43:05Z vboxsync $ */ -/** @file - * VBoxFswParam.h +/* + * Copyright (c) 2012 Stefan Agner + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Christoph Pfisterer nor the names of the + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - /* * Copyright (C) 2010 Oracle Corporation * @@ -15,8 +41,8 @@ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ -#ifndef VBOXFSPARAM_H -#define VBOXFSPARAM_H +#ifndef _FSW_EFI_EDK2_BASE_H_ +#define _FSW_EFI_EDK2_BASE_H_ /* * Here is common declarations for EDK<->EDK2 compatibility */ @@ -62,8 +88,8 @@ // ); //#define CompareGuid(x, y) CompareGuidEdk1((x),(y)) -# define HOST_EFI 1 //# define FSW_DEBUG_LEVEL 3 int fsw_streq_ISO88591_UTF16(void *s1data, void *s2data, int len); + #endif diff --git a/filesystems/fsw_efi_lib.c b/filesystems/fsw_efi_lib.c index 956e9ee..93a7ff1 100644 --- a/filesystems/fsw_efi_lib.c +++ b/filesystems/fsw_efi_lib.c @@ -140,7 +140,6 @@ VOID fsw_efi_strcpy(CHAR16 *Dest, struct fsw_string *src) } } -#ifdef VBOX int fsw_streq_ISO88591_UTF16(void *s1data, void *s2data, int len) { int i; @@ -157,6 +156,5 @@ int fsw_streq_ISO88591_UTF16(void *s1data, void *s2data, int len) return 1; } -#endif // EOF diff --git a/filesystems/hfs_format.h b/filesystems/hfs_format.h index 9b800e9..0512dfa 100644 --- a/filesystems/hfs_format.h +++ b/filesystems/hfs_format.h @@ -47,7 +47,8 @@ #ifndef __HFS_FORMAT__ #define __HFS_FORMAT__ -#if !defined(VBOX) && !defined(HOST_POSIX) +#if !defined(HOST_EFI_EDK2) && !defined(HOST_POSIX) +// Only available on Mac? and Intel EFI Toolkit? #include #include #endif -- 2.39.2