mirror of https://github.com/acidanthera/audk.git
ArmPkg/SemihostFs: Various fixes for the file system
- Fix file deletion from the shell. - Fix file creation using the shell editor. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15390 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
228fdff4be
commit
d276ac10f1
|
@ -2,7 +2,7 @@
|
||||||
Support a Semi Host file system over a debuggers JTAG
|
Support a Semi Host file system over a debuggers JTAG
|
||||||
|
|
||||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -544,7 +544,9 @@ FileSetInfo (
|
||||||
if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid) != 0) {
|
if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid) != 0) {
|
||||||
//Status = SetFilesystemInfo (Fcb, BufferSize, Buffer);
|
//Status = SetFilesystemInfo (Fcb, BufferSize, Buffer);
|
||||||
} else if (CompareGuid (InformationType, &gEfiFileInfoGuid) != 0) {
|
} else if (CompareGuid (InformationType, &gEfiFileInfoGuid) != 0) {
|
||||||
//Status = SetFileInfo (Fcb, BufferSize, Buffer);
|
// Semihosting does not give us access to setting file info, but
|
||||||
|
// if we fail here we cannot create new files.
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid) != 0) {
|
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid) != 0) {
|
||||||
if (StrSize (Buffer) > 0) {
|
if (StrSize (Buffer) > 0) {
|
||||||
FreePool (mSemihostFsLabel);
|
FreePool (mSemihostFsLabel);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -73,10 +74,12 @@ SemihostFileSeek (
|
||||||
|
|
||||||
Result = Semihost_SYS_SEEK(&SeekBlock);
|
Result = Semihost_SYS_SEEK(&SeekBlock);
|
||||||
|
|
||||||
if (Result == 0) {
|
// Semihosting does not behave as documented. It returns the offset on
|
||||||
return RETURN_SUCCESS;
|
// success.
|
||||||
} else {
|
if (Result < 0) {
|
||||||
return RETURN_ABORTED;
|
return RETURN_ABORTED;
|
||||||
|
} else {
|
||||||
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +103,7 @@ SemihostFileRead (
|
||||||
|
|
||||||
Result = Semihost_SYS_READ(&ReadBlock);
|
Result = Semihost_SYS_READ(&ReadBlock);
|
||||||
|
|
||||||
if (Result == *Length) {
|
if ((*Length != 0) && (Result == *Length)) {
|
||||||
return RETURN_ABORTED;
|
return RETURN_ABORTED;
|
||||||
} else {
|
} else {
|
||||||
*Length -= Result;
|
*Length -= Result;
|
||||||
|
@ -127,7 +130,10 @@ SemihostFileWrite (
|
||||||
|
|
||||||
*Length = Semihost_SYS_WRITE(&WriteBlock);
|
*Length = Semihost_SYS_WRITE(&WriteBlock);
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
if (*Length != 0)
|
||||||
|
return RETURN_ABORTED;
|
||||||
|
else
|
||||||
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
|
@ -174,6 +180,11 @@ SemihostFileRemove (
|
||||||
SEMIHOST_FILE_REMOVE_BLOCK RemoveBlock;
|
SEMIHOST_FILE_REMOVE_BLOCK RemoveBlock;
|
||||||
UINT32 Result;
|
UINT32 Result;
|
||||||
|
|
||||||
|
// Remove any leading separator (e.g.: '\'). EFI Shell adds one.
|
||||||
|
if (*FileName == '\\') {
|
||||||
|
FileName++;
|
||||||
|
}
|
||||||
|
|
||||||
RemoveBlock.FileName = FileName;
|
RemoveBlock.FileName = FileName;
|
||||||
RemoveBlock.NameLength = AsciiStrLen(FileName);
|
RemoveBlock.NameLength = AsciiStrLen(FileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue