From: srs5694 Date: Tue, 1 Jul 2014 02:37:08 +0000 (-0400) Subject: Initial steps of purging GPLv2 code from core filesystem functions, X-Git-Url: https://code.delx.au/refind/commitdiff_plain/23bacafa3d234a028a8870a6cf8f1a2af61b1d97 Initial steps of purging GPLv2 code from core filesystem functions, since it's incompatible with the GPLv3 used by the Btrfs driver (and maybe ext4fs). --- diff --git a/filesystems/fsw_base.h b/filesystems/fsw_base.h index 31b78dc..2f6dc5f 100644 --- a/filesystems/fsw_base.h +++ b/filesystems/fsw_base.h @@ -1,18 +1,6 @@ -/* $Id: fsw_base.h 29125 2010-05-06 09:43:05Z vboxsync $ */ -/** @file - * fsw_base.h - Base definitions switch. - */ - -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +/** + * \file fsw_base.h + * Base definitions switch. */ /*- diff --git a/filesystems/fsw_efi.c b/filesystems/fsw_efi.c index 4c5dafd..add1bd8 100644 --- a/filesystems/fsw_efi.c +++ b/filesystems/fsw_efi.c @@ -1,23 +1,9 @@ -/* $Id: fsw_efi.c 29125 2010-05-06 09:43:05Z vboxsync $ */ -/** @file - * fsw_efi.c - EFI host environment code. - */ - -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +/** + * \file fsw_efi.c + * EFI host environment code. */ /*- - * This code is based on: - * * Copyright (c) 2006 Christoph Pfisterer * * Redistribution and use in source and binary forms, with or without @@ -60,17 +46,8 @@ #define DEBUG_LEVEL 0 #ifndef FSTYPE -#error FSTYPE must be defined! -#endif - -#define DEBUG_VBFS 1 - -#if DEBUG_VBFS==2 -#define DBG(x...) AsciiPrint(x) -#elif DEBUG_VBFS==1 -#define DBG(x...) BootLog(x) -#else -#define DBG(x...) +/** The file system type name to use. */ +#define FSTYPE ext2 #endif #ifdef __MAKEWITH_GNUEFI @@ -87,12 +64,12 @@ EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID; EFI_GUID gEfiComponentNameProtocolGuid = EFI_COMPONENT_NAME_PROTOCOL_GUID; -EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; -EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; +extern EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; +extern EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID; EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID; EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID; -#define SimpleFileSystemProtocol FileSystemProtocol +#define gEfiSimpleFileSystemProtocolGuid FileSystemProtocol #endif /** Helper macro for stringification. */ @@ -214,7 +191,6 @@ struct fsw_host_table fsw_efi_host_table = { extern struct fsw_fstype_table FSW_FSTYPE_TABLE_NAME(FSTYPE); -//#include "OverrideFunctions-kabyl.edk2.c.include" static VOID EFIAPI fsw_efi_clear_cache(VOID) { int i; @@ -302,7 +278,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL // first, open DiskIO Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle, - &PROTO_NAME(DiskIoProtocol), + &gEfiDiskIoProtocolGuid, (VOID **) &DiskIo, This->DriverBindingHandle, ControllerHandle, @@ -312,13 +288,13 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL // we were just checking, close it again refit_call4_wrapper(BS->CloseProtocol, ControllerHandle, - &PROTO_NAME(DiskIoProtocol), + &gEfiDiskIoProtocolGuid, This->DriverBindingHandle, ControllerHandle); // next, check BlockIO without actually opening it Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle, - &PROTO_NAME(BlockIoProtocol), + &gEfiBlockIoProtocolGuid, NULL, This->DriverBindingHandle, ControllerHandle, @@ -354,7 +330,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T // open consumed protocols Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle, - &PROTO_NAME(BlockIoProtocol), + &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo, This->DriverBindingHandle, ControllerHandle, @@ -365,12 +341,13 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T } Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle, - &PROTO_NAME(DiskIoProtocol), + &gEfiDiskIoProtocolGuid, (VOID **) &DiskIo, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER); if (EFI_ERROR(Status)) { + Print(L"Fsw ERROR: OpenProtocol(DiskIo) returned %x\n", Status); return Status; } @@ -392,7 +369,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T Volume->FileSystem.Revision = EFI_FILE_IO_INTERFACE_REVISION; Volume->FileSystem.OpenVolume = fsw_efi_FileSystem_OpenVolume; Status = refit_call4_wrapper(BS->InstallMultipleProtocolInterfaces, &ControllerHandle, - &PROTO_NAME(SimpleFileSystemProtocol), + &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem, NULL); if (EFI_ERROR(Status)) { @@ -407,7 +384,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL *T FreePool(Volume); refit_call4_wrapper(BS->CloseProtocol, ControllerHandle, - &PROTO_NAME(DiskIoProtocol), + &gEfiDiskIoProtocolGuid, This->DriverBindingHandle, ControllerHandle); } @@ -440,7 +417,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T // get the installed SimpleFileSystem interface Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle, - &PROTO_NAME(SimpleFileSystemProtocol), + &gEfiSimpleFileSystemProtocolGuid, (VOID **) &FileSystem, This->DriverBindingHandle, ControllerHandle, @@ -453,7 +430,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T // uninstall Simple File System protocol Status = refit_call4_wrapper(BS->UninstallMultipleProtocolInterfaces, ControllerHandle, - &PROTO_NAME(SimpleFileSystemProtocol), &Volume->FileSystem, + &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem, NULL); if (EFI_ERROR(Status)) { // Print(L"Fsw ERROR: UninstallMultipleProtocolInterfaces returned %x\n", Status); @@ -470,7 +447,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T // close the consumed protocols Status = refit_call4_wrapper(BS->CloseProtocol, ControllerHandle, - &PROTO_NAME(DiskIoProtocol), + &gEfiDiskIoProtocolGuid, This->DriverBindingHandle, ControllerHandle); diff --git a/filesystems/fsw_efi.h b/filesystems/fsw_efi.h index f323db5..bc9dac3 100644 --- a/filesystems/fsw_efi.h +++ b/filesystems/fsw_efi.h @@ -1,24 +1,10 @@ -/* $Id: fsw_efi.h 33540 2010-10-28 09:27:05Z vboxsync $ */ -/** @file - * fsw_efi.h - EFI host environment header. - */ - -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ +/** + * \file fsw_efi.h + * EFI host environment header. +*/ /*- - * This code is based on: - * - * Copyright (c) 2006 Christoph Pfisterer + * Copyright (c) 2006 Christoph Pfisterer * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -58,9 +44,6 @@ #define CompareGuid(a, b) CompareGuid(a, b)==0 #endif -// extern CHAR8 *msgCursor; -// extern MESSAGE_LOG_PROTOCOL *Msg; - /** * EFI Host: Private per-volume structure. */ diff --git a/filesystems/fsw_efi_base.h b/filesystems/fsw_efi_base.h index 533be93..37d20ed 100644 --- a/filesystems/fsw_efi_base.h +++ b/filesystems/fsw_efi_base.h @@ -59,7 +59,7 @@ // Intel EFI Toolkit #include #include -#define PROTO_NAME(x) x +//#define PROTO_NAME(x) x #endif #define FSW_LITTLE_ENDIAN (1) diff --git a/filesystems/fsw_efi_edk2_base.h b/filesystems/fsw_efi_edk2_base.h index 27c6d58..4552829 100644 --- a/filesystems/fsw_efi_edk2_base.h +++ b/filesystems/fsw_efi_edk2_base.h @@ -76,7 +76,7 @@ # include # define BS gBS -# define PROTO_NAME(x) gEfi ## x ## Guid +//# define PROTO_NAME(x) gEfi ## x ## Guid # define GUID_NAME(x) gEfi ## x ## Guid # define EFI_FILE_HANDLE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION diff --git a/filesystems/fsw_strfunc.h b/filesystems/fsw_strfunc.h index 61cf25d..8bbbb26 100644 --- a/filesystems/fsw_strfunc.h +++ b/filesystems/fsw_strfunc.h @@ -1,20 +1,3 @@ -/* $Id: fsw_strfunc.h 29125 2010-05-06 09:43:05Z vboxsync $ */ -/** @file - * fsw_strfunc.h - */ - -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - /* fsw_strfunc.h generated by mk_fsw_strfunc.py */ static int fsw_streq_ISO88591_UTF8(void *s1data, void *s2data, int len) @@ -43,7 +26,7 @@ static int fsw_streq_ISO88591_UTF8(void *s1data, void *s2data, int len) return 1; } -#ifndef HOST_EFI +#ifdef __MAKEWITH_TIANO static int fsw_streq_ISO88591_UTF16(void *s1data, void *s2data, int len) { int i; diff --git a/filesystems/scandisk.c b/filesystems/scandisk.c index b175c9e..6ae5cf8 100644 --- a/filesystems/scandisk.c +++ b/filesystems/scandisk.c @@ -9,6 +9,8 @@ #ifdef __MAKEWITH_GNUEFI #include "edk2/DriverBinding.h" #include "edk2/ComponentName.h" +extern EFI_GUID gEfiDiskIoProtocolGuid; +extern EFI_GUID gEfiBlockIoProtocolGuid; #endif #include "../include/refit_call_wrapper.h" @@ -82,16 +84,16 @@ static int scan_disks(int (*hook)(struct fsw_volume *, struct fsw_volume *), str Print(L" "); #endif DPRINT(L"Scanning disks\n"); - Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &PROTO_NAME(DiskIoProtocol), NULL, &HandleCount, &Handles); + Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &gEfiDiskIoProtocolGuid, NULL, &HandleCount, &Handles); if (Status == EFI_NOT_FOUND) return -1; // no filesystems. strange, but true... for (i = 0; i < HandleCount; i++) { EFI_DISK_IO *diskio; EFI_BLOCK_IO *blockio; - Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &PROTO_NAME(DiskIoProtocol), (VOID **) &diskio); + Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiDiskIoProtocolGuid, (VOID **) &diskio); if (Status != 0) continue; - Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &PROTO_NAME(BlockIoProtocol), (VOID **) &blockio); + Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiBlockIoProtocolGuid, (VOID **) &blockio); if (Status != 0) continue; struct fsw_volume *vol = create_dummy_volume(diskio, blockio->Media->MediaId);