mirror of https://github.com/acidanthera/audk.git
Fix component name bugs when input Controller Name is invalid
Fix the driver binding version for platform/OEM specific drivers git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2275 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
61fb1657e5
commit
caea5554ab
|
@ -160,7 +160,17 @@ UnixBlockIoComponentNameGetControllerName (
|
||||||
if (ChildHandle != NULL) {
|
if (ChildHandle != NULL) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Make sure this driver is currently managing ControllerHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestManagedDevice (
|
||||||
|
ControllerHandle,
|
||||||
|
gUnixBlockIoDriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiUnixIoProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
|
|
@ -60,8 +60,8 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "UnixBlockIo.h"
|
#include "UnixBlockIo.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -318,7 +318,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixBlockIoDriverBinding = {
|
||||||
UnixBlockIoDriverBindingSupported,
|
UnixBlockIoDriverBindingSupported,
|
||||||
UnixBlockIoDriverBindingStart,
|
UnixBlockIoDriverBindingStart,
|
||||||
UnixBlockIoDriverBindingStop,
|
UnixBlockIoDriverBindingStop,
|
||||||
0x10,
|
0xa,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -372,7 +372,7 @@ Returns:
|
||||||
//
|
//
|
||||||
// Check the GUID to see if this is a handle type the driver supports
|
// Check the GUID to see if this is a handle type the driver supports
|
||||||
//
|
//
|
||||||
if (CompareGuid (UnixIo->TypeGuid, &gEfiUnixVirtualDisksGuid) ) {
|
if (CompareGuid (UnixIo->TypeGuid, &gEfiUnixVirtualDisksGuid) ) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ Returns:
|
||||||
BOOLEAN WriteProtected;
|
BOOLEAN WriteProtected;
|
||||||
UINTN NumberOfBlocks;
|
UINTN NumberOfBlocks;
|
||||||
UINTN BlockSize;
|
UINTN BlockSize;
|
||||||
INTN i;
|
INTN i;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Grab the protocols we need
|
// Grab the protocols we need
|
||||||
|
@ -446,47 +446,47 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
// Extract filename.
|
// Extract filename.
|
||||||
Str = UnixIo->EnvString;
|
Str = UnixIo->EnvString;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (*Str && *Str != ':')
|
while (*Str && *Str != ':')
|
||||||
Buffer[i++] = *Str++;
|
Buffer[i++] = *Str++;
|
||||||
Buffer[i] = 0;
|
Buffer[i] = 0;
|
||||||
if (*Str != ':') {
|
if (*Str != ':') {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Str++;
|
Str++;
|
||||||
|
|
||||||
RemovableMedia = FALSE;
|
RemovableMedia = FALSE;
|
||||||
WriteProtected = TRUE;
|
WriteProtected = TRUE;
|
||||||
NumberOfBlocks = 0;
|
NumberOfBlocks = 0;
|
||||||
BlockSize = 512;
|
BlockSize = 512;
|
||||||
do {
|
do {
|
||||||
if (*Str == 'R' || *Str == 'F') {
|
if (*Str == 'R' || *Str == 'F') {
|
||||||
RemovableMedia = (BOOLEAN) (*Str == 'R');
|
RemovableMedia = (BOOLEAN) (*Str == 'R');
|
||||||
Str++;
|
Str++;
|
||||||
}
|
}
|
||||||
if (*Str == 'O' || *Str == 'W') {
|
if (*Str == 'O' || *Str == 'W') {
|
||||||
WriteProtected = (BOOLEAN) (*Str == 'O');
|
WriteProtected = (BOOLEAN) (*Str == 'O');
|
||||||
Str++;
|
Str++;
|
||||||
}
|
}
|
||||||
if (*Str == 0)
|
if (*Str == 0)
|
||||||
break;
|
break;
|
||||||
if (*Str != ';')
|
if (*Str != ';')
|
||||||
goto Done;
|
goto Done;
|
||||||
Str++;
|
Str++;
|
||||||
|
|
||||||
NumberOfBlocks = Atoi (Str);
|
NumberOfBlocks = Atoi (Str);
|
||||||
Str = GetNextElementPastTerminator (Str, ';');
|
Str = GetNextElementPastTerminator (Str, ';');
|
||||||
if (NumberOfBlocks == 0)
|
if (NumberOfBlocks == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
BlockSize = Atoi (Str);
|
BlockSize = Atoi (Str);
|
||||||
if (BlockSize != 0)
|
if (BlockSize != 0)
|
||||||
Str = GetNextElementPastTerminator (Str, ';');
|
Str = GetNextElementPastTerminator (Str, ';');
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we get here the variable is valid so do the work.
|
// If we get here the variable is valid so do the work.
|
||||||
//
|
//
|
||||||
|
@ -693,10 +693,10 @@ Returns:
|
||||||
|
|
||||||
Private->Filename[Index] = 0;
|
Private->Filename[Index] = 0;
|
||||||
|
|
||||||
Private->Mode = (ReadOnly ? O_RDONLY : O_RDWR);
|
Private->Mode = (ReadOnly ? O_RDONLY : O_RDWR);
|
||||||
|
|
||||||
Private->NumberOfBlocks = NumberOfBlocks;
|
Private->NumberOfBlocks = NumberOfBlocks;
|
||||||
Private->fd = -1;
|
Private->fd = -1;
|
||||||
|
|
||||||
Private->ControllerNameTable = NULL;
|
Private->ControllerNameTable = NULL;
|
||||||
|
|
||||||
|
@ -780,19 +780,19 @@ Returns:
|
||||||
//
|
//
|
||||||
// If the device is already opened, close it
|
// If the device is already opened, close it
|
||||||
//
|
//
|
||||||
if (Private->fd >= 0) {
|
if (Private->fd >= 0) {
|
||||||
BlockIo->Reset (BlockIo, FALSE);
|
BlockIo->Reset (BlockIo, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open the device
|
// Open the device
|
||||||
//
|
//
|
||||||
Private->fd = Private->UnixThunk->Open
|
Private->fd = Private->UnixThunk->Open
|
||||||
(Private->Filename, Private->Mode, 0644);
|
(Private->Filename, Private->Mode, 0644);
|
||||||
|
|
||||||
if (Private->fd < 0) {
|
if (Private->fd < 0) {
|
||||||
DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %s\n",
|
DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %s\n",
|
||||||
Private->Filename));
|
Private->Filename));
|
||||||
BlockIo->Media->MediaPresent = FALSE;
|
BlockIo->Media->MediaPresent = FALSE;
|
||||||
Status = EFI_NO_MEDIA;
|
Status = EFI_NO_MEDIA;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -834,12 +834,12 @@ Returns:
|
||||||
//
|
//
|
||||||
// first set it to 0
|
// first set it to 0
|
||||||
//
|
//
|
||||||
Private->UnixThunk->FTruncate (Private->fd, 0);
|
Private->UnixThunk->FTruncate (Private->fd, 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// then set it to the needed file size (OS will zero fill it)
|
// then set it to the needed file size (OS will zero fill it)
|
||||||
//
|
//
|
||||||
Private->UnixThunk->FTruncate (Private->fd, EndOfFile);
|
Private->UnixThunk->FTruncate (Private->fd, EndOfFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %s%N\n", Private->Filename));
|
DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %s%N\n", Private->Filename));
|
||||||
|
@ -878,13 +878,13 @@ Returns:
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN ReinstallBlockIoFlag;
|
BOOLEAN ReinstallBlockIoFlag;
|
||||||
|
|
||||||
|
|
||||||
BlockIo = &Private->BlockIo;
|
BlockIo = &Private->BlockIo;
|
||||||
|
|
||||||
switch (Private->UnixThunk->GetLastError ()) {
|
switch (Private->UnixThunk->GetLastError ()) {
|
||||||
|
@ -928,7 +928,7 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
|
@ -1017,7 +1017,7 @@ Returns:
|
||||||
// Seek to End of File
|
// Seek to End of File
|
||||||
//
|
//
|
||||||
DistanceToMove = MultU64x32 (Lba, BlockSize);
|
DistanceToMove = MultU64x32 (Lba, BlockSize);
|
||||||
Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, SEEK_SET);
|
Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, SEEK_SET);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));
|
DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));
|
||||||
|
@ -1062,7 +1062,7 @@ UnixBlockIoReadBlocks (
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
UNIX_BLOCK_IO_PRIVATE *Private;
|
UNIX_BLOCK_IO_PRIVATE *Private;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
@ -1072,9 +1072,9 @@ UnixBlockIoReadBlocks (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = Private->UnixThunk->Read (Private->fd, Buffer, BufferSize);
|
len = Private->UnixThunk->Read (Private->fd, Buffer, BufferSize);
|
||||||
if (len != BufferSize) {
|
if (len != BufferSize) {
|
||||||
DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed.\n"));
|
DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed.\n"));
|
||||||
return UnixBlockIoError (Private);
|
return UnixBlockIoError (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1121,7 @@ UnixBlockIoWriteBlocks (
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
UNIX_BLOCK_IO_PRIVATE *Private;
|
UNIX_BLOCK_IO_PRIVATE *Private;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
Private = UNIX_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
@ -1131,9 +1131,9 @@ UnixBlockIoWriteBlocks (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = Private->UnixThunk->Write (Private->fd, Buffer, BufferSize);
|
len = Private->UnixThunk->Write (Private->fd, Buffer, BufferSize);
|
||||||
if (len != BufferSize) {
|
if (len != BufferSize) {
|
||||||
DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed.\n"));
|
DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed.\n"));
|
||||||
return UnixBlockIoError (Private);
|
return UnixBlockIoError (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,7 +1198,7 @@ UnixBlockIoResetBlock (
|
||||||
|
|
||||||
if (Private->fd >= 0) {
|
if (Private->fd >= 0) {
|
||||||
Private->UnixThunk->Close (Private->fd);
|
Private->UnixThunk->Close (Private->fd);
|
||||||
Private->fd = -1;
|
Private->fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -1272,15 +1272,15 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
|
||||||
// TODO: MoveMethod - add argument and description to function comment
|
// TODO: MoveMethod - add argument and description to function comment
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
off_t res;
|
off_t res;
|
||||||
|
|
||||||
res = Private->UnixThunk->Lseek(Private->fd, DistanceToMove, MoveMethod);
|
res = Private->UnixThunk->Lseek(Private->fd, DistanceToMove, MoveMethod);
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NewFilePointer != NULL) {
|
if (NewFilePointer != NULL) {
|
||||||
*NewFilePointer = res;
|
*NewFilePointer = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -160,7 +160,17 @@ UnixConsoleComponentNameGetControllerName (
|
||||||
if (ChildHandle != NULL) {
|
if (ChildHandle != NULL) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Make sure this driver is currently managing ControllerHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestManagedDevice (
|
||||||
|
ControllerHandle,
|
||||||
|
gUnixConsoleDriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiUnixIoProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Get out context back
|
// Get out context back
|
||||||
//
|
//
|
||||||
|
|
|
@ -50,7 +50,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixConsoleDriverBinding = {
|
||||||
UnixConsoleDriverBindingSupported,
|
UnixConsoleDriverBindingSupported,
|
||||||
UnixConsoleDriverBindingStart,
|
UnixConsoleDriverBindingStart,
|
||||||
UnixConsoleDriverBindingStop,
|
UnixConsoleDriverBindingStop,
|
||||||
0x10,
|
0xa,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -205,11 +205,11 @@ Done:
|
||||||
|
|
||||||
FreeUnicodeStringTable (Private->ControllerNameTable);
|
FreeUnicodeStringTable (Private->ControllerNameTable);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (Private->NtOutHandle != NULL) {
|
if (Private->NtOutHandle != NULL) {
|
||||||
Private->UnixThunk->CloseHandle (Private->NtOutHandle);
|
Private->UnixThunk->CloseHandle (Private->NtOutHandle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Private->SimpleTextIn.WaitForKey != NULL) {
|
if (Private->SimpleTextIn.WaitForKey != NULL) {
|
||||||
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
||||||
|
@ -294,9 +294,9 @@ Returns:
|
||||||
Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
Private->UnixThunk->CloseHandle (Private->NtOutHandle);
|
Private->UnixThunk->CloseHandle (Private->NtOutHandle);
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
// DO NOT close Private->NtInHandle. It points to StdIn and not
|
// DO NOT close Private->NtInHandle. It points to StdIn and not
|
||||||
// the Private->NtOutHandle is StdIn and should not be closed!
|
// the Private->NtOutHandle is StdIn and should not be closed!
|
||||||
|
|
|
@ -167,6 +167,17 @@ UnixSimpleFileSystemComponentNameGetControllerName (
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure this driver is currently managing ControllerHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestManagedDevice (
|
||||||
|
ControllerHandle,
|
||||||
|
gUnixSimpleFileSystemDriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiUnixIoProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,7 +30,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixSimpleFileSystemDriverBinding = {
|
||||||
UnixSimpleFileSystemDriverBindingSupported,
|
UnixSimpleFileSystemDriverBindingSupported,
|
||||||
UnixSimpleFileSystemDriverBindingStart,
|
UnixSimpleFileSystemDriverBindingStart,
|
||||||
UnixSimpleFileSystemDriverBindingStop,
|
UnixSimpleFileSystemDriverBindingStop,
|
||||||
0x10,
|
0xa,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -257,7 +257,7 @@ Returns:
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_UNIX_IO_PROTOCOL *UnixIo;
|
EFI_UNIX_IO_PROTOCOL *UnixIo;
|
||||||
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
|
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
|
||||||
INTN i;
|
INTN i;
|
||||||
|
|
||||||
Private = NULL;
|
Private = NULL;
|
||||||
|
|
||||||
|
@ -295,8 +295,8 @@ Returns:
|
||||||
|
|
||||||
Private->Signature = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
|
Private->Signature = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
|
||||||
Private->UnixThunk = UnixIo->UnixThunk;
|
Private->UnixThunk = UnixIo->UnixThunk;
|
||||||
Private->FilePath = NULL;
|
Private->FilePath = NULL;
|
||||||
Private->VolumeLabel = NULL;
|
Private->VolumeLabel = NULL;
|
||||||
|
|
||||||
Status = gBS->AllocatePool (
|
Status = gBS->AllocatePool (
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
|
@ -307,10 +307,10 @@ Returns:
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; UnixIo->EnvString[i] != 0; i++)
|
for (i = 0; UnixIo->EnvString[i] != 0; i++)
|
||||||
Private->FilePath[i] = UnixIo->EnvString[i];
|
Private->FilePath[i] = UnixIo->EnvString[i];
|
||||||
Private->FilePath[i] = 0;
|
Private->FilePath[i] = 0;
|
||||||
|
|
||||||
Private->VolumeLabel = NULL;
|
Private->VolumeLabel = NULL;
|
||||||
Status = gBS->AllocatePool (
|
Status = gBS->AllocatePool (
|
||||||
|
@ -349,10 +349,10 @@ Done:
|
||||||
|
|
||||||
if (Private != NULL) {
|
if (Private != NULL) {
|
||||||
|
|
||||||
if (Private->VolumeLabel != NULL)
|
if (Private->VolumeLabel != NULL)
|
||||||
gBS->FreePool (Private->VolumeLabel);
|
gBS->FreePool (Private->VolumeLabel);
|
||||||
if (Private->FilePath != NULL)
|
if (Private->FilePath != NULL)
|
||||||
gBS->FreePool (Private->FilePath);
|
gBS->FreePool (Private->FilePath);
|
||||||
FreeUnicodeStringTable (Private->ControllerNameTable);
|
FreeUnicodeStringTable (Private->ControllerNameTable);
|
||||||
|
|
||||||
gBS->FreePool (Private);
|
gBS->FreePool (Private);
|
||||||
|
@ -540,20 +540,20 @@ Returns:
|
||||||
PrivateFile->EfiFile.GetInfo = UnixSimpleFileSystemGetInfo;
|
PrivateFile->EfiFile.GetInfo = UnixSimpleFileSystemGetInfo;
|
||||||
PrivateFile->EfiFile.SetInfo = UnixSimpleFileSystemSetInfo;
|
PrivateFile->EfiFile.SetInfo = UnixSimpleFileSystemSetInfo;
|
||||||
PrivateFile->EfiFile.Flush = UnixSimpleFileSystemFlush;
|
PrivateFile->EfiFile.Flush = UnixSimpleFileSystemFlush;
|
||||||
PrivateFile->fd = -1;
|
PrivateFile->fd = -1;
|
||||||
PrivateFile->Dir = NULL;
|
PrivateFile->Dir = NULL;
|
||||||
PrivateFile->Dirent = NULL;
|
PrivateFile->Dirent = NULL;
|
||||||
|
|
||||||
*Root = &PrivateFile->EfiFile;
|
*Root = &PrivateFile->EfiFile;
|
||||||
|
|
||||||
PrivateFile->Dir = PrivateFile->UnixThunk->OpenDir(PrivateFile->FileName);
|
PrivateFile->Dir = PrivateFile->UnixThunk->OpenDir(PrivateFile->FileName);
|
||||||
|
|
||||||
if (PrivateFile->Dir == NULL) {
|
if (PrivateFile->Dir == NULL) {
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -629,8 +629,8 @@ Returns:
|
||||||
UNIX_EFI_FILE_PRIVATE *NewPrivateFile;
|
UNIX_EFI_FILE_PRIVATE *NewPrivateFile;
|
||||||
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR16 *Src;
|
CHAR16 *Src;
|
||||||
char *Dst;
|
char *Dst;
|
||||||
CHAR8 *RealFileName;
|
CHAR8 *RealFileName;
|
||||||
//CHAR16 *TempFileName;
|
//CHAR16 *TempFileName;
|
||||||
char *ParseFileName;
|
char *ParseFileName;
|
||||||
|
@ -683,7 +683,7 @@ Returns:
|
||||||
// BUGBUG: assume an open of root
|
// BUGBUG: assume an open of root
|
||||||
// if current location, return current data
|
// if current location, return current data
|
||||||
//
|
//
|
||||||
if (StrCmp (FileName, L"\\") == 0
|
if (StrCmp (FileName, L"\\") == 0
|
||||||
|| (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
|
|| (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
|
||||||
//
|
//
|
||||||
// BUGBUG: assume an open root
|
// BUGBUG: assume an open root
|
||||||
|
@ -727,25 +727,25 @@ OpenRoot:
|
||||||
|
|
||||||
if (*FileName == L'\\') {
|
if (*FileName == L'\\') {
|
||||||
AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
|
AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
|
||||||
// Skip first '\'.
|
// Skip first '\'.
|
||||||
Src = FileName + 1;
|
Src = FileName + 1;
|
||||||
} else {
|
} else {
|
||||||
AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName);
|
AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName);
|
||||||
Src = FileName;
|
Src = FileName;
|
||||||
}
|
}
|
||||||
Dst = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName);
|
Dst = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName);
|
||||||
GuardPointer = NewPrivateFile->FileName + AsciiStrLen(PrivateRoot->FilePath);
|
GuardPointer = NewPrivateFile->FileName + AsciiStrLen(PrivateRoot->FilePath);
|
||||||
*Dst++ = '/';
|
*Dst++ = '/';
|
||||||
// Convert unicode to ascii and '\' to '/'
|
// Convert unicode to ascii and '\' to '/'
|
||||||
while (*Src) {
|
while (*Src) {
|
||||||
if (*Src == '\\')
|
if (*Src == '\\')
|
||||||
*Dst++ = '/';
|
*Dst++ = '/';
|
||||||
else
|
else
|
||||||
*Dst++ = *Src;
|
*Dst++ = *Src;
|
||||||
Src++;
|
Src++;
|
||||||
}
|
}
|
||||||
*Dst = 0;
|
*Dst = 0;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get rid of . and .., except leading . or ..
|
// Get rid of . and .., except leading . or ..
|
||||||
|
@ -810,22 +810,22 @@ OpenRoot:
|
||||||
}
|
}
|
||||||
|
|
||||||
RealFileName = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName) - 1;
|
RealFileName = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName) - 1;
|
||||||
while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/')
|
while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/')
|
||||||
RealFileName--;
|
RealFileName--;
|
||||||
|
|
||||||
TempChar = *(RealFileName - 1);
|
TempChar = *(RealFileName - 1);
|
||||||
*(RealFileName - 1) = 0;
|
*(RealFileName - 1) = 0;
|
||||||
|
|
||||||
*(RealFileName - 1) = TempChar;
|
*(RealFileName - 1) = TempChar;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test whether file or directory
|
// Test whether file or directory
|
||||||
//
|
//
|
||||||
NewPrivateFile->IsRootDirectory = FALSE;
|
NewPrivateFile->IsRootDirectory = FALSE;
|
||||||
NewPrivateFile->fd = -1;
|
NewPrivateFile->fd = -1;
|
||||||
NewPrivateFile->Dir = NULL;
|
NewPrivateFile->Dir = NULL;
|
||||||
if (OpenMode & EFI_FILE_MODE_CREATE) {
|
if (OpenMode & EFI_FILE_MODE_CREATE) {
|
||||||
if (Attributes & EFI_FILE_DIRECTORY) {
|
if (Attributes & EFI_FILE_DIRECTORY) {
|
||||||
NewPrivateFile->IsDirectoryPath = TRUE;
|
NewPrivateFile->IsDirectoryPath = TRUE;
|
||||||
|
@ -833,11 +833,11 @@ OpenRoot:
|
||||||
NewPrivateFile->IsDirectoryPath = FALSE;
|
NewPrivateFile->IsDirectoryPath = FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct stat finfo;
|
struct stat finfo;
|
||||||
int res = NewPrivateFile->UnixThunk->Stat (NewPrivateFile->FileName, &finfo);
|
int res = NewPrivateFile->UnixThunk->Stat (NewPrivateFile->FileName, &finfo);
|
||||||
if (res == 0 && S_ISDIR(finfo.st_mode))
|
if (res == 0 && S_ISDIR(finfo.st_mode))
|
||||||
NewPrivateFile->IsDirectoryPath = TRUE;
|
NewPrivateFile->IsDirectoryPath = TRUE;
|
||||||
else
|
else
|
||||||
NewPrivateFile->IsDirectoryPath = FALSE;
|
NewPrivateFile->IsDirectoryPath = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,10 +859,10 @@ OpenRoot:
|
||||||
// Create a directory
|
// Create a directory
|
||||||
//
|
//
|
||||||
if (NewPrivateFile->UnixThunk->MkDir (NewPrivateFile->FileName, 0777) != 0) {
|
if (NewPrivateFile->UnixThunk->MkDir (NewPrivateFile->FileName, 0777) != 0) {
|
||||||
INTN LastError;
|
INTN LastError;
|
||||||
|
|
||||||
LastError = PrivateFile->UnixThunk->GetErrno ();
|
LastError = PrivateFile->UnixThunk->GetErrno ();
|
||||||
if (LastError != EEXIST) {
|
if (LastError != EEXIST) {
|
||||||
//gBS->FreePool (TempFileName);
|
//gBS->FreePool (TempFileName);
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -870,11 +870,11 @@ OpenRoot:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NewPrivateFile->Dir = NewPrivateFile->UnixThunk->OpenDir
|
NewPrivateFile->Dir = NewPrivateFile->UnixThunk->OpenDir
|
||||||
(NewPrivateFile->FileName);
|
(NewPrivateFile->FileName);
|
||||||
|
|
||||||
if (NewPrivateFile->Dir == NULL) {
|
if (NewPrivateFile->Dir == NULL) {
|
||||||
if (PrivateFile->UnixThunk->GetErrno () == EACCES) {
|
if (PrivateFile->UnixThunk->GetErrno () == EACCES) {
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
|
@ -887,13 +887,13 @@ OpenRoot:
|
||||||
//
|
//
|
||||||
// deal with file
|
// deal with file
|
||||||
//
|
//
|
||||||
NewPrivateFile->fd = NewPrivateFile->UnixThunk->Open
|
NewPrivateFile->fd = NewPrivateFile->UnixThunk->Open
|
||||||
(NewPrivateFile->FileName,
|
(NewPrivateFile->FileName,
|
||||||
((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0)
|
((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0)
|
||||||
| (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR),
|
| (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR),
|
||||||
0666);
|
0666);
|
||||||
if (NewPrivateFile->fd < 0) {
|
if (NewPrivateFile->fd < 0) {
|
||||||
if (PrivateFile->UnixThunk->GetErrno () == ENOENT) {
|
if (PrivateFile->UnixThunk->GetErrno () == ENOENT) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
|
@ -987,15 +987,15 @@ Returns:
|
||||||
|
|
||||||
PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
if (PrivateFile->fd >= 0) {
|
if (PrivateFile->fd >= 0) {
|
||||||
PrivateFile->UnixThunk->Close (PrivateFile->fd);
|
PrivateFile->UnixThunk->Close (PrivateFile->fd);
|
||||||
}
|
}
|
||||||
if (PrivateFile->Dir != NULL) {
|
if (PrivateFile->Dir != NULL) {
|
||||||
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
|
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateFile->fd = -1;
|
PrivateFile->fd = -1;
|
||||||
PrivateFile->Dir = NULL;
|
PrivateFile->Dir = NULL;
|
||||||
|
|
||||||
if (PrivateFile->FileName) {
|
if (PrivateFile->FileName) {
|
||||||
gBS->FreePool (PrivateFile->FileName);
|
gBS->FreePool (PrivateFile->FileName);
|
||||||
|
@ -1043,7 +1043,7 @@ Returns:
|
||||||
if (PrivateFile->IsDirectoryPath) {
|
if (PrivateFile->IsDirectoryPath) {
|
||||||
if (PrivateFile->Dir != NULL) {
|
if (PrivateFile->Dir != NULL) {
|
||||||
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
|
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
|
||||||
PrivateFile->Dir = NULL;
|
PrivateFile->Dir = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->UnixThunk->RmDir (PrivateFile->FileName) == 0) {
|
if (PrivateFile->UnixThunk->RmDir (PrivateFile->FileName) == 0) {
|
||||||
|
@ -1051,7 +1051,7 @@ Returns:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrivateFile->UnixThunk->Close (PrivateFile->fd);
|
PrivateFile->UnixThunk->Close (PrivateFile->fd);
|
||||||
PrivateFile->fd = -1;
|
PrivateFile->fd = -1;
|
||||||
|
|
||||||
if (!PrivateFile->IsOpenedByRead) {
|
if (!PrivateFile->IsOpenedByRead) {
|
||||||
if (!PrivateFile->UnixThunk->UnLink (PrivateFile->FileName)) {
|
if (!PrivateFile->UnixThunk->UnLink (PrivateFile->FileName)) {
|
||||||
|
@ -1070,7 +1070,7 @@ STATIC
|
||||||
VOID
|
VOID
|
||||||
UnixSystemTimeToEfiTime (
|
UnixSystemTimeToEfiTime (
|
||||||
EFI_UNIX_THUNK_PROTOCOL *UnixThunk,
|
EFI_UNIX_THUNK_PROTOCOL *UnixThunk,
|
||||||
IN time_t SystemTime,
|
IN time_t SystemTime,
|
||||||
OUT EFI_TIME *Time
|
OUT EFI_TIME *Time
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
@ -1091,19 +1091,19 @@ Returns:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
tm = UnixThunk->GmTime (&SystemTime);
|
tm = UnixThunk->GmTime (&SystemTime);
|
||||||
Time->Year = tm->tm_year;
|
Time->Year = tm->tm_year;
|
||||||
Time->Month = tm->tm_mon;
|
Time->Month = tm->tm_mon;
|
||||||
Time->Day = tm->tm_mday;
|
Time->Day = tm->tm_mday;
|
||||||
Time->Hour = tm->tm_hour;
|
Time->Hour = tm->tm_hour;
|
||||||
Time->Minute = tm->tm_min;
|
Time->Minute = tm->tm_min;
|
||||||
Time->Second = tm->tm_sec;
|
Time->Second = tm->tm_sec;
|
||||||
Time->Nanosecond = 0;
|
Time->Nanosecond = 0;
|
||||||
|
|
||||||
Time->TimeZone = UnixThunk->GetTimeZone ();
|
|
||||||
|
|
||||||
if (UnixThunk->GetDayLight ()) {
|
Time->TimeZone = UnixThunk->GetTimeZone ();
|
||||||
|
|
||||||
|
if (UnixThunk->GetDayLight ()) {
|
||||||
Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
|
Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1112,7 @@ STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UnixSimpleFileSystemFileInfo (
|
UnixSimpleFileSystemFileInfo (
|
||||||
UNIX_EFI_FILE_PRIVATE *PrivateFile,
|
UNIX_EFI_FILE_PRIVATE *PrivateFile,
|
||||||
IN CHAR8 *FileName,
|
IN CHAR8 *FileName,
|
||||||
IN OUT UINTN *BufferSize,
|
IN OUT UINTN *BufferSize,
|
||||||
OUT VOID *Buffer
|
OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
|
@ -1141,18 +1141,18 @@ Returns:
|
||||||
EFI_FILE_INFO *Info;
|
EFI_FILE_INFO *Info;
|
||||||
CHAR8 *RealFileName;
|
CHAR8 *RealFileName;
|
||||||
CHAR8 *TempPointer;
|
CHAR8 *TempPointer;
|
||||||
CHAR16 *BufferFileName;
|
CHAR16 *BufferFileName;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
if (FileName != NULL) {
|
if (FileName != NULL) {
|
||||||
RealFileName = FileName;
|
RealFileName = FileName;
|
||||||
}
|
}
|
||||||
else if (PrivateFile->IsRootDirectory) {
|
else if (PrivateFile->IsRootDirectory) {
|
||||||
RealFileName = "";
|
RealFileName = "";
|
||||||
} else {
|
} else {
|
||||||
RealFileName = PrivateFile->FileName;
|
RealFileName = PrivateFile->FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempPointer = RealFileName;
|
TempPointer = RealFileName;
|
||||||
while (*TempPointer) {
|
while (*TempPointer) {
|
||||||
if (*TempPointer == '/') {
|
if (*TempPointer == '/') {
|
||||||
|
@ -1161,7 +1161,7 @@ Returns:
|
||||||
|
|
||||||
TempPointer++;
|
TempPointer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = SIZE_OF_EFI_FILE_INFO;
|
Size = SIZE_OF_EFI_FILE_INFO;
|
||||||
NameSize = AsciiStrSize (RealFileName) * 2;
|
NameSize = AsciiStrSize (RealFileName) * 2;
|
||||||
ResultSize = Size + NameSize;
|
ResultSize = Size + NameSize;
|
||||||
|
@ -1169,39 +1169,39 @@ Returns:
|
||||||
if (*BufferSize < ResultSize) {
|
if (*BufferSize < ResultSize) {
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
if (PrivateFile->UnixThunk->Stat (
|
if (PrivateFile->UnixThunk->Stat (
|
||||||
FileName == NULL ? PrivateFile->FileName : FileName,
|
FileName == NULL ? PrivateFile->FileName : FileName,
|
||||||
&buf) < 0)
|
&buf) < 0)
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
Info = Buffer;
|
Info = Buffer;
|
||||||
ZeroMem (Info, ResultSize);
|
ZeroMem (Info, ResultSize);
|
||||||
|
|
||||||
Info->Size = ResultSize;
|
Info->Size = ResultSize;
|
||||||
Info->FileSize = buf.st_size;
|
Info->FileSize = buf.st_size;
|
||||||
Info->PhysicalSize = MultU64x32 (buf.st_blocks, buf.st_blksize);
|
Info->PhysicalSize = MultU64x32 (buf.st_blocks, buf.st_blksize);
|
||||||
|
|
||||||
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_ctime, &Info->CreateTime);
|
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_ctime, &Info->CreateTime);
|
||||||
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_atime, &Info->LastAccessTime);
|
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_atime, &Info->LastAccessTime);
|
||||||
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_mtime, &Info->ModificationTime);
|
UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_mtime, &Info->ModificationTime);
|
||||||
|
|
||||||
if (!(buf.st_mode & S_IWUSR)) {
|
if (!(buf.st_mode & S_IWUSR)) {
|
||||||
Info->Attribute |= EFI_FILE_READ_ONLY;
|
Info->Attribute |= EFI_FILE_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISDIR(buf.st_mode)) {
|
if (S_ISDIR(buf.st_mode)) {
|
||||||
Info->Attribute |= EFI_FILE_DIRECTORY;
|
Info->Attribute |= EFI_FILE_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size);
|
BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size);
|
||||||
while (*RealFileName)
|
while (*RealFileName)
|
||||||
*BufferFileName++ = *RealFileName++;
|
*BufferFileName++ = *RealFileName++;
|
||||||
*BufferFileName = 0;
|
*BufferFileName = 0;
|
||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1245,11 +1245,11 @@ Returns:
|
||||||
{
|
{
|
||||||
UNIX_EFI_FILE_PRIVATE *PrivateFile;
|
UNIX_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
INTN Res;
|
INTN Res;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
UINTN NameSize;
|
UINTN NameSize;
|
||||||
UINTN ResultSize;
|
UINTN ResultSize;
|
||||||
CHAR8 *FullFileName;
|
CHAR8 *FullFileName;
|
||||||
|
|
||||||
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -1266,62 +1266,62 @@ Returns:
|
||||||
Res = PrivateFile->UnixThunk->Read (
|
Res = PrivateFile->UnixThunk->Read (
|
||||||
PrivateFile->fd,
|
PrivateFile->fd,
|
||||||
Buffer,
|
Buffer,
|
||||||
*BufferSize);
|
*BufferSize);
|
||||||
if (Res < 0)
|
if (Res < 0)
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
*BufferSize = Res;
|
*BufferSize = Res;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read on a directory.
|
// Read on a directory.
|
||||||
//
|
//
|
||||||
if (PrivateFile->Dir == NULL) {
|
if (PrivateFile->Dir == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->Dirent == NULL) {
|
if (PrivateFile->Dirent == NULL) {
|
||||||
PrivateFile->Dirent = PrivateFile->UnixThunk->ReadDir (PrivateFile->Dir);
|
PrivateFile->Dirent = PrivateFile->UnixThunk->ReadDir (PrivateFile->Dir);
|
||||||
if (PrivateFile->Dirent == NULL) {
|
if (PrivateFile->Dirent == NULL) {
|
||||||
*BufferSize = 0;
|
*BufferSize = 0;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = SIZE_OF_EFI_FILE_INFO;
|
Size = SIZE_OF_EFI_FILE_INFO;
|
||||||
NameSize = AsciiStrLen (PrivateFile->Dirent->d_name) + 1;
|
NameSize = AsciiStrLen (PrivateFile->Dirent->d_name) + 1;
|
||||||
ResultSize = Size + 2 * NameSize;
|
ResultSize = Size + 2 * NameSize;
|
||||||
|
|
||||||
if (*BufferSize < ResultSize) {
|
if (*BufferSize < ResultSize) {
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
|
|
||||||
Status = gBS->AllocatePool (
|
Status = gBS->AllocatePool (
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
AsciiStrLen(PrivateFile->FileName) + 1 + NameSize,
|
AsciiStrLen(PrivateFile->FileName) + 1 + NameSize,
|
||||||
(VOID **)&FullFileName
|
(VOID **)&FullFileName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy(FullFileName, PrivateFile->FileName);
|
AsciiStrCpy(FullFileName, PrivateFile->FileName);
|
||||||
AsciiStrCat(FullFileName, "/");
|
AsciiStrCat(FullFileName, "/");
|
||||||
AsciiStrCat(FullFileName, PrivateFile->Dirent->d_name);
|
AsciiStrCat(FullFileName, PrivateFile->Dirent->d_name);
|
||||||
Status = UnixSimpleFileSystemFileInfo (PrivateFile,
|
Status = UnixSimpleFileSystemFileInfo (PrivateFile,
|
||||||
FullFileName,
|
FullFileName,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
Buffer);
|
Buffer);
|
||||||
gBS->FreePool (FullFileName);
|
gBS->FreePool (FullFileName);
|
||||||
|
|
||||||
PrivateFile->Dirent = NULL;
|
PrivateFile->Dirent = NULL;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1368,7 +1368,7 @@ Returns:
|
||||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||||
{
|
{
|
||||||
UNIX_EFI_FILE_PRIVATE *PrivateFile;
|
UNIX_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
UINTN Res;
|
UINTN Res;
|
||||||
|
|
||||||
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -1391,11 +1391,11 @@ Returns:
|
||||||
Res = PrivateFile->UnixThunk->Write (
|
Res = PrivateFile->UnixThunk->Write (
|
||||||
PrivateFile->fd,
|
PrivateFile->fd,
|
||||||
Buffer,
|
Buffer,
|
||||||
*BufferSize);
|
*BufferSize);
|
||||||
if (Res == (UINTN)-1)
|
if (Res == (UINTN)-1)
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
*BufferSize = Res;
|
*BufferSize = Res;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
//
|
//
|
||||||
// bugbug: need to access unix error reporting
|
// bugbug: need to access unix error reporting
|
||||||
|
@ -1444,17 +1444,17 @@ Returns:
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->Dir == NULL) {
|
if (PrivateFile->Dir == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
PrivateFile->UnixThunk->RewindDir (PrivateFile->Dir);
|
PrivateFile->UnixThunk->RewindDir (PrivateFile->Dir);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
if (Position == (UINT64) -1) {
|
if (Position == (UINT64) -1) {
|
||||||
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_END);
|
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_END);
|
||||||
} else {
|
} else {
|
||||||
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, Position, SEEK_SET);
|
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, Position, SEEK_SET);
|
||||||
}
|
}
|
||||||
Status = (Pos == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
Status = (Pos == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1499,7 +1499,7 @@ Returns:
|
||||||
if (PrivateFile->IsDirectoryPath) {
|
if (PrivateFile->IsDirectoryPath) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
} else {
|
} else {
|
||||||
*Position = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_CUR);
|
*Position = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_CUR);
|
||||||
return (*Position == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
return (*Position == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1552,7 +1552,7 @@ Returns:
|
||||||
EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
|
EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
|
||||||
INTN UnixStatus;
|
INTN UnixStatus;
|
||||||
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
||||||
struct statfs buf;
|
struct statfs buf;
|
||||||
|
|
||||||
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
|
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -1572,10 +1572,10 @@ Returns:
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnixStatus = PrivateFile->UnixThunk->StatFs (PrivateFile->FileName, &buf);
|
UnixStatus = PrivateFile->UnixThunk->StatFs (PrivateFile->FileName, &buf);
|
||||||
if (UnixStatus < 0)
|
if (UnixStatus < 0)
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
|
|
||||||
FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
||||||
FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||||
FileSystemInfoBuffer->ReadOnly = FALSE;
|
FileSystemInfoBuffer->ReadOnly = FALSE;
|
||||||
|
@ -1583,9 +1583,9 @@ Returns:
|
||||||
//
|
//
|
||||||
// Succeeded
|
// Succeeded
|
||||||
//
|
//
|
||||||
FileSystemInfoBuffer->VolumeSize = MultU64x32 (buf.f_blocks, buf.f_bsize);
|
FileSystemInfoBuffer->VolumeSize = MultU64x32 (buf.f_blocks, buf.f_bsize);
|
||||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
||||||
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
||||||
|
|
||||||
|
|
||||||
StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
|
StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
|
||||||
|
@ -1593,7 +1593,7 @@ Returns:
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (CompareGuid (InformationType,
|
else if (CompareGuid (InformationType,
|
||||||
&gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
&gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
||||||
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
|
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
|
||||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||||
|
@ -1674,9 +1674,9 @@ Returns:
|
||||||
struct tm NewLastAccessSystemTime;
|
struct tm NewLastAccessSystemTime;
|
||||||
struct tm NewLastWriteSystemTime;
|
struct tm NewLastWriteSystemTime;
|
||||||
EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
|
EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
|
||||||
CHAR8 *AsciiFilePtr;
|
CHAR8 *AsciiFilePtr;
|
||||||
CHAR16 *UnicodeFilePtr;
|
CHAR16 *UnicodeFilePtr;
|
||||||
INTN UnixStatus;
|
INTN UnixStatus;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for invalid parameters.
|
// Check for invalid parameters.
|
||||||
|
@ -1779,7 +1779,7 @@ Returns:
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize,
|
Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize,
|
||||||
(VOID **)&OldFileInfo);
|
(VOID **)&OldFileInfo);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -1819,9 +1819,9 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
||||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||||
UnicodeFilePtr = NewFileInfo->FileName + 1;
|
UnicodeFilePtr = NewFileInfo->FileName + 1;
|
||||||
*AsciiFilePtr++ ='/';
|
*AsciiFilePtr++ ='/';
|
||||||
} else {
|
} else {
|
||||||
Status = gBS->AllocatePool (
|
Status = gBS->AllocatePool (
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
|
@ -1834,18 +1834,18 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
||||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||||
while (AsciiFilePtr > NewFileName && AsciiFilePtr[-1] != '/') {
|
while (AsciiFilePtr > NewFileName && AsciiFilePtr[-1] != '/') {
|
||||||
AsciiFilePtr--;
|
AsciiFilePtr--;
|
||||||
}
|
}
|
||||||
UnicodeFilePtr = NewFileInfo->FileName;
|
UnicodeFilePtr = NewFileInfo->FileName;
|
||||||
}
|
}
|
||||||
// Convert to ascii.
|
// Convert to ascii.
|
||||||
while (*UnicodeFilePtr) {
|
while (*UnicodeFilePtr) {
|
||||||
*AsciiFilePtr++ = *UnicodeFilePtr++;
|
*AsciiFilePtr++ = *UnicodeFilePtr++;
|
||||||
}
|
}
|
||||||
*AsciiFilePtr = 0;
|
*AsciiFilePtr = 0;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Is there an attribute change request?
|
// Is there an attribute change request?
|
||||||
|
@ -1902,10 +1902,10 @@ Returns:
|
||||||
//
|
//
|
||||||
// Set file or directory information.
|
// Set file or directory information.
|
||||||
//
|
//
|
||||||
if (PrivateFile->UnixThunk->Stat (OldFileName, &OldAttr) != 0) {
|
if (PrivateFile->UnixThunk->Stat (OldFileName, &OldAttr) != 0) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Name change.
|
// Name change.
|
||||||
|
@ -1977,7 +1977,7 @@ Returns:
|
||||||
// Time change
|
// Time change
|
||||||
//
|
//
|
||||||
if (TimeChangeFlag) {
|
if (TimeChangeFlag) {
|
||||||
struct utimbuf utime;
|
struct utimbuf utime;
|
||||||
|
|
||||||
NewLastAccessSystemTime.tm_year = NewFileInfo->LastAccessTime.Year;
|
NewLastAccessSystemTime.tm_year = NewFileInfo->LastAccessTime.Year;
|
||||||
NewLastAccessSystemTime.tm_mon = NewFileInfo->LastAccessTime.Month;
|
NewLastAccessSystemTime.tm_mon = NewFileInfo->LastAccessTime.Month;
|
||||||
|
@ -1985,25 +1985,25 @@ Returns:
|
||||||
NewLastAccessSystemTime.tm_hour = NewFileInfo->LastAccessTime.Hour;
|
NewLastAccessSystemTime.tm_hour = NewFileInfo->LastAccessTime.Hour;
|
||||||
NewLastAccessSystemTime.tm_min = NewFileInfo->LastAccessTime.Minute;
|
NewLastAccessSystemTime.tm_min = NewFileInfo->LastAccessTime.Minute;
|
||||||
NewLastAccessSystemTime.tm_sec = NewFileInfo->LastAccessTime.Second;
|
NewLastAccessSystemTime.tm_sec = NewFileInfo->LastAccessTime.Second;
|
||||||
NewLastAccessSystemTime.tm_isdst = 0;
|
NewLastAccessSystemTime.tm_isdst = 0;
|
||||||
|
|
||||||
|
utime.actime = PrivateFile->UnixThunk->MkTime (&NewLastAccessSystemTime);
|
||||||
|
|
||||||
utime.actime = PrivateFile->UnixThunk->MkTime (&NewLastAccessSystemTime);
|
|
||||||
|
|
||||||
NewLastWriteSystemTime.tm_year = NewFileInfo->ModificationTime.Year;
|
NewLastWriteSystemTime.tm_year = NewFileInfo->ModificationTime.Year;
|
||||||
NewLastWriteSystemTime.tm_mon = NewFileInfo->ModificationTime.Month;
|
NewLastWriteSystemTime.tm_mon = NewFileInfo->ModificationTime.Month;
|
||||||
NewLastWriteSystemTime.tm_mday = NewFileInfo->ModificationTime.Day;
|
NewLastWriteSystemTime.tm_mday = NewFileInfo->ModificationTime.Day;
|
||||||
NewLastWriteSystemTime.tm_hour = NewFileInfo->ModificationTime.Hour;
|
NewLastWriteSystemTime.tm_hour = NewFileInfo->ModificationTime.Hour;
|
||||||
NewLastWriteSystemTime.tm_min = NewFileInfo->ModificationTime.Minute;
|
NewLastWriteSystemTime.tm_min = NewFileInfo->ModificationTime.Minute;
|
||||||
NewLastWriteSystemTime.tm_sec = NewFileInfo->ModificationTime.Second;
|
NewLastWriteSystemTime.tm_sec = NewFileInfo->ModificationTime.Second;
|
||||||
NewLastWriteSystemTime.tm_isdst = 0;
|
NewLastWriteSystemTime.tm_isdst = 0;
|
||||||
|
|
||||||
utime.modtime = PrivateFile->UnixThunk->MkTime (&NewLastWriteSystemTime);
|
utime.modtime = PrivateFile->UnixThunk->MkTime (&NewLastWriteSystemTime);
|
||||||
|
|
||||||
if (utime.actime == (time_t)-1 || utime.modtime == (time_t)-1) {
|
if (utime.actime == (time_t)-1 || utime.modtime == (time_t)-1) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->UnixThunk->UTime (PrivateFile->FileName, &utime) == -1) {
|
if (PrivateFile->UnixThunk->UTime (PrivateFile->FileName, &utime) == -1) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2015,9 +2015,9 @@ Returns:
|
||||||
NewAttr = OldAttr.st_mode;
|
NewAttr = OldAttr.st_mode;
|
||||||
|
|
||||||
if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {
|
if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {
|
||||||
NewAttr &= ~(S_IRUSR | S_IRGRP | S_IROTH);
|
NewAttr &= ~(S_IRUSR | S_IRGRP | S_IROTH);
|
||||||
} else {
|
} else {
|
||||||
NewAttr |= S_IRUSR;
|
NewAttr |= S_IRUSR;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnixStatus = PrivateFile->UnixThunk->Chmod (NewFileName, NewAttr);
|
UnixStatus = PrivateFile->UnixThunk->Chmod (NewFileName, NewAttr);
|
||||||
|
@ -2093,10 +2093,10 @@ Returns:
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->fd < 0) {
|
if (PrivateFile->fd < 0) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PrivateFile->UnixThunk->FSync (PrivateFile->fd) == 0 ? EFI_SUCCESS : EFI_DEVICE_ERROR;
|
return PrivateFile->UnixThunk->FSync (PrivateFile->fd) == 0 ? EFI_SUCCESS : EFI_DEVICE_ERROR;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -161,6 +161,17 @@ UnixUgaComponentNameGetControllerName (
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure this driver is currently managing ControllerHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestManagedDevice (
|
||||||
|
ControllerHandle,
|
||||||
|
gUnixUgaDriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiUnixIoProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,7 +31,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixUgaDriverBinding = {
|
||||||
UnixUgaDriverBindingSupported,
|
UnixUgaDriverBindingSupported,
|
||||||
UnixUgaDriverBindingStart,
|
UnixUgaDriverBindingStart,
|
||||||
UnixUgaDriverBindingStop,
|
UnixUgaDriverBindingStop,
|
||||||
0x10,
|
0xa,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
|
@ -154,6 +154,18 @@ UnixBusDriverComponentNameGetControllerName (
|
||||||
EFI_UNIX_IO_PROTOCOL *UnixIo;
|
EFI_UNIX_IO_PROTOCOL *UnixIo;
|
||||||
UNIX_IO_DEVICE *Private;
|
UNIX_IO_DEVICE *Private;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure this driver is currently managing ControllHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestManagedDevice (
|
||||||
|
ControllerHandle,
|
||||||
|
gUnixBusDriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiUnixThunkProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is a bus driver, so ChildHandle can not be NULL.
|
// This is a bus driver, so ChildHandle can not be NULL.
|
||||||
//
|
//
|
||||||
|
@ -161,6 +173,15 @@ UnixBusDriverComponentNameGetControllerName (
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = EfiTestChildHandle (
|
||||||
|
ControllerHandle,
|
||||||
|
ChildHandle,
|
||||||
|
&gEfiUnixThunkProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
|
|
@ -107,7 +107,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding = {
|
||||||
UnixBusDriverBindingSupported,
|
UnixBusDriverBindingSupported,
|
||||||
UnixBusDriverBindingStart,
|
UnixBusDriverBindingStart,
|
||||||
UnixBusDriverBindingStop,
|
UnixBusDriverBindingStop,
|
||||||
0x10,
|
0xa,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -454,7 +454,7 @@ Returns:
|
||||||
|
|
||||||
UnixDevice->ControllerNameTable = NULL;
|
UnixDevice->ControllerNameTable = NULL;
|
||||||
|
|
||||||
// FIXME: check size
|
// FIXME: check size
|
||||||
StrCpy(ComponentName, UnixDevice->UnixIo.EnvString);
|
StrCpy(ComponentName, UnixDevice->UnixIo.EnvString);
|
||||||
|
|
||||||
UnixDevice->DevicePath = UnixBusCreateDevicePath (
|
UnixDevice->DevicePath = UnixBusCreateDevicePath (
|
||||||
|
|
Loading…
Reference in New Issue