From 21500a434a813b41ac28f66a97e0149b4980f2a1 Mon Sep 17 00:00:00 2001 From: klu2 Date: Wed, 30 May 2007 08:17:24 +0000 Subject: [PATCH] Remove unused variable and function git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2606 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.c | 20 -- EdkUnixPkg/Include/Protocol/UnixThunk.h | 207 +++++++++--------- EdkUnixPkg/Sec/UnixThunk.c | 97 ++++---- 3 files changed, 149 insertions(+), 175 deletions(-) diff --git a/EdkUnixPkg/Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.c b/EdkUnixPkg/Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.c index 58cc68961e..e3fd034ab3 100644 --- a/EdkUnixPkg/Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.c +++ b/EdkUnixPkg/Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.c @@ -57,25 +57,6 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = { NULL }; -STATIC -VOID -PrintSerialParameter( - UNIX_SERIAL_IO_PRIVATE_DATA *Private - ) -{ - struct termios Options; - - if (Private->UnixThunk->Tcgetattr (Private->UnixHandle, &Options) == 0) { - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Input mode: 0x%x\r\n", Private->UnixHandle, Options.c_iflag)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Output mode: 0x%x\r\n", Private->UnixHandle, Options.c_oflag)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Control flag: 0x%x\r\n", Private->UnixHandle, Options.c_cflag)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Local mode flag: 0x%x\r\n", Private->UnixHandle, Options.c_lflag)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Line discipline: 0x%x\r\n", Private->UnixHandle, Options.c_line)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Input Speed: 0x%x\r\n", Private->UnixHandle, Options.c_ispeed)); - DEBUG ((EFI_D_INFO, "Serial[0x%x]:Output Speed: 0x%x\r\n", Private->UnixHandle, Options.c_ospeed)); - } -} - STATIC UINTN ConvertBaud2Unix ( @@ -1134,7 +1115,6 @@ Returns: UNIX_SERIAL_IO_PRIVATE_DATA *Private; UINTN Result; UINTN Status; - struct termios Options; UINT32 Bits; EFI_TPL Tpl; UINTN Bytes; diff --git a/EdkUnixPkg/Include/Protocol/UnixThunk.h b/EdkUnixPkg/Include/Protocol/UnixThunk.h index 1fa4e90204..36043a074c 100644 --- a/EdkUnixPkg/Include/Protocol/UnixThunk.h +++ b/EdkUnixPkg/Include/Protocol/UnixThunk.h @@ -1,52 +1,52 @@ -/*++ - -Copyright (c) 2004, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UnixThunk.h - -Abstract: - - This protocol allows an EFI driver in the Unix emulation environment - to make Posix calls. - - NEVER make an Unix call directly, always make the call via this protocol. - - There are no This pointers on the protocol member functions as they map - exactly into Unix system calls. - ---*/ - -#ifndef _UNIX_THUNK_H_ -#define _UNIX_THUNK_H_ - -#include +/*++ -#define EFI_UNIX_THUNK_PROTOCOL_GUID \ - { \ +Copyright (c) 2004, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + UnixThunk.h + +Abstract: + + This protocol allows an EFI driver in the Unix emulation environment + to make Posix calls. + + NEVER make an Unix call directly, always make the call via this protocol. + + There are no This pointers on the protocol member functions as they map + exactly into Unix system calls. + +--*/ + +#ifndef _UNIX_THUNK_H_ +#define _UNIX_THUNK_H_ + +#include + +#define EFI_UNIX_THUNK_PROTOCOL_GUID \ + { \ 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \ - } - -typedef -VOID -(*UnixSleep) ( - unsigned long Milliseconds - ); - -typedef -VOID -(*UnixExit) ( - int status // exit code for all threads - ); - + } + +typedef +VOID +(*UnixSleep) ( + unsigned long Milliseconds + ); + +typedef +VOID +(*UnixExit) ( + int status // exit code for all threads + ); + typedef VOID (*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)); @@ -138,55 +138,51 @@ typedef EFI_STATUS (*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title); - -typedef -int -(*UnixTcflush) (int fildes, int queue_selector); - -typedef -void -(*UnixPerror) (__const char *__s); - -typedef -void -(*UnixPrintf) (const char* format, ...); - -typedef -int -(*UnixIoCtl) (int fd, unsigned long int __request, ...); - -typedef -int -(*UnixFcntl) (int __fd, int __cmd, ...); - -typedef -int -(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed); - -typedef -int -(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed); - -typedef -int -(*UnixTcgetattr) (int __fd, struct termios *__termios_p); - -typedef -int -(*UnixTcsetattr) (int __fd, int __optional_actions, - __const struct termios *__termios_p); -// -// -// - -#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T') - -typedef struct _EFI_UNIX_THUNK_PROTOCOL { - UINT64 Signature; +typedef +int +(*UnixTcflush) (int fildes, int queue_selector); - UnixSleep Sleep; - UnixExit Exit; +typedef +void +(*UnixPerror) (__const char *__s); + +typedef +int +(*UnixIoCtl) (int fd, unsigned long int __request, ...); + +typedef +int +(*UnixFcntl) (int __fd, int __cmd, ...); + +typedef +int +(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed); + +typedef +int +(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed); + +typedef +int +(*UnixTcgetattr) (int __fd, struct termios *__termios_p); + +typedef +int +(*UnixTcsetattr) (int __fd, int __optional_actions, + __const struct termios *__termios_p); + +// +// +// + +#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T') + +typedef struct _EFI_UNIX_THUNK_PROTOCOL { + UINT64 Signature; + + UnixSleep Sleep; + UnixExit Exit; UnixSetTimer SetTimer; UnixGetLocalTime GetLocalTime; UnixGmTime GmTime; @@ -217,16 +213,15 @@ typedef struct _EFI_UNIX_THUNK_PROTOCOL { UnixUTime UTime; UnixTcflush Tcflush; UnixUgaCreate UgaCreate; - UnixPerror Perror; - UnixPrintf Printf; - UnixIoCtl IoCtl; - UnixFcntl Fcntl; - UnixCfsetispeed Cfsetispeed; - UnixCfsetospeed Cfsetospeed; - UnixTcgetattr Tcgetattr; - UnixTcsetattr Tcsetattr; + UnixPerror Perror; + UnixIoCtl IoCtl; + UnixFcntl Fcntl; + UnixCfsetispeed Cfsetispeed; + UnixCfsetospeed Cfsetospeed; + UnixTcgetattr Tcgetattr; + UnixTcsetattr Tcsetattr; } EFI_UNIX_THUNK_PROTOCOL; - -extern EFI_GUID gEfiUnixThunkProtocolGuid; - -#endif + +extern EFI_GUID gEfiUnixThunkProtocolGuid; + +#endif diff --git a/EdkUnixPkg/Sec/UnixThunk.c b/EdkUnixPkg/Sec/UnixThunk.c index 9d74b5b8c3..fcf290ddbb 100644 --- a/EdkUnixPkg/Sec/UnixThunk.c +++ b/EdkUnixPkg/Sec/UnixThunk.c @@ -1,43 +1,43 @@ -/*++ - -Copyright (c) 2004 - 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UnixThunk.c - -Abstract: - - Since the SEC is the only program in our emulation we - must use a Tiano mechanism to export APIs to other modules. - This is the role of the EFI_UNIX_THUNK_PROTOCOL. - - The mUnixThunkTable exists so that a change to EFI_UNIX_THUNK_PROTOCOL - will cause an error in initializing the array if all the member functions - are not added. It looks like adding a element to end and not initializing - it may cause the table to be initaliized with the members at the end being - set to zero. This is bad as jumping to zero will crash. - - - gUnix is a a public exported global that contains the initialized - data. - ---*/ - -#include "SecMain.h" +/*++ + +Copyright (c) 2004 - 2006, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + UnixThunk.c + +Abstract: + + Since the SEC is the only program in our emulation we + must use a Tiano mechanism to export APIs to other modules. + This is the role of the EFI_UNIX_THUNK_PROTOCOL. + + The mUnixThunkTable exists so that a change to EFI_UNIX_THUNK_PROTOCOL + will cause an error in initializing the array if all the member functions + are not added. It looks like adding a element to end and not initializing + it may cause the table to be initaliized with the members at the end being + set to zero. This is bad as jumping to zero will crash. + + + gUnix is a a public exported global that contains the initialized + data. + +--*/ + +#include "SecMain.h" #include "Library/UnixLib.h" #include #include #include #include -#include +#include #include static int settimer_initialized; @@ -156,8 +156,8 @@ GetErrno(void) extern EFI_STATUS UgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title); -EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { - EFI_UNIX_THUNK_PROTOCOL_SIGNATURE, +EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { + EFI_UNIX_THUNK_PROTOCOL_SIGNATURE, msSleep, /* Sleep */ exit, /* Exit */ SetTimer, @@ -189,16 +189,15 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { chmod, utime, tcflush, - UgaCreate, - perror, - printf, - ioctl, - fcntl, - cfsetispeed, - cfsetospeed, - tcgetattr, + UgaCreate, + perror, + ioctl, + fcntl, + cfsetispeed, + cfsetospeed, + tcgetattr, tcsetattr -}; - - -EFI_UNIX_THUNK_PROTOCOL *gUnix = &mUnixThunkTable; +}; + + +EFI_UNIX_THUNK_PROTOCOL *gUnix = &mUnixThunkTable;