/*++\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
http://opensource.org/licenses/bsd-license.php \r
BOOLEAN WriteProtected;\r
UINTN NumberOfBlocks;\r
UINTN BlockSize;\r
- INTN i;\r
+ INTN i;\r
\r
//\r
// Grab the protocols we need\r
//\r
// Open the device\r
//\r
- Private->fd = Private->UnixThunk->Open\r
- (Private->Filename, Private->Mode, 0644);\r
-\r
+ Private->fd = Private->UnixThunk->Open (Private->Filename, Private->Mode, 0644);\r
if (Private->fd < 0) {\r
- DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %s\n",\r
- Private->Filename));\r
+ DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %a\n", Private->Filename));\r
BlockIo->Media->MediaPresent = FALSE;\r
Status = EFI_NO_MEDIA;\r
goto Done;\r
// get the size of the file\r
//\r
Status = SetFilePointer64 (Private, 0, &FileSize, SEEK_END);\r
-\r
if (EFI_ERROR (Status)) {\r
FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);\r
- DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n", Private->Filename));\r
+ DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %a\n", Private->Filename));\r
Status = EFI_UNSUPPORTED;\r
goto Done;\r
}\r
\r
if (Private->NumberOfBlocks == 0) {\r
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);\r
+ Private->LastBlock = Private->NumberOfBlocks - 1;\r
+ Private->Media.LastBlock = Private->LastBlock;\r
}\r
\r
EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);\r
Private->UnixThunk->FTruncate (Private->fd, EndOfFile);\r
}\r
\r
- DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %s%N\n", Private->Filename));\r
+ DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %a%N\n", Private->Filename));\r
Status = EFI_SUCCESS;\r
\r
Done:\r
return EFI_MEDIA_CHANGED;\r
}\r
\r
- if ((UINT32) Buffer % Private->Media.IoAlign != 0) {\r
+ if ((UINTN) Buffer % Private->Media.IoAlign != 0) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
IN UNIX_BLOCK_IO_PRIVATE *Private,\r
IN INT64 DistanceToMove,\r
OUT UINT64 *NewFilePointer,\r
- IN INTN MoveMethod\r
+ IN INT32 MoveMethod\r
)\r
/*++\r
\r
EFI_STATUS Status;\r
off_t res;\r
\r
+ Status = EFI_SUCCESS;\r
res = Private->UnixThunk->Lseek(Private->fd, DistanceToMove, MoveMethod);\r
if (res == -1) {\r
Status = EFI_INVALID_PARAMETER;\r