diff options
Diffstat (limited to 'EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c')
-rw-r--r-- | EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c | 400 |
1 files changed, 200 insertions, 200 deletions
diff --git a/EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c b/EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c index 42a361b53d..db272bdc89 100644 --- a/EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c +++ b/EdkUnixPkg/Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.c @@ -30,7 +30,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixSimpleFileSystemDriverBinding = { UnixSimpleFileSystemDriverBindingSupported,
UnixSimpleFileSystemDriverBindingStart,
UnixSimpleFileSystemDriverBindingStop,
- 0x10,
+ 0xa,
NULL,
NULL
};
@@ -257,7 +257,7 @@ Returns: EFI_STATUS Status;
EFI_UNIX_IO_PROTOCOL *UnixIo;
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- INTN i; + INTN i;
Private = NULL;
@@ -295,8 +295,8 @@ Returns: Private->Signature = UNIX_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
Private->UnixThunk = UnixIo->UnixThunk;
- Private->FilePath = NULL; - Private->VolumeLabel = NULL; + Private->FilePath = NULL;
+ Private->VolumeLabel = NULL;
Status = gBS->AllocatePool (
EfiBootServicesData,
@@ -307,10 +307,10 @@ Returns: if (EFI_ERROR (Status)) {
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] = 0; + Private->FilePath[i] = 0;
Private->VolumeLabel = NULL;
Status = gBS->AllocatePool (
@@ -349,10 +349,10 @@ Done: if (Private != NULL) {
- if (Private->VolumeLabel != NULL) - gBS->FreePool (Private->VolumeLabel); - if (Private->FilePath != NULL) - gBS->FreePool (Private->FilePath); + if (Private->VolumeLabel != NULL)
+ gBS->FreePool (Private->VolumeLabel);
+ if (Private->FilePath != NULL)
+ gBS->FreePool (Private->FilePath);
FreeUnicodeStringTable (Private->ControllerNameTable);
gBS->FreePool (Private);
@@ -540,20 +540,20 @@ Returns: PrivateFile->EfiFile.GetInfo = UnixSimpleFileSystemGetInfo;
PrivateFile->EfiFile.SetInfo = UnixSimpleFileSystemSetInfo;
PrivateFile->EfiFile.Flush = UnixSimpleFileSystemFlush;
- PrivateFile->fd = -1; - PrivateFile->Dir = NULL; - PrivateFile->Dirent = NULL; + PrivateFile->fd = -1;
+ PrivateFile->Dir = NULL;
+ PrivateFile->Dirent = NULL;
*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;
- } - else { + }
+ else {
Status = EFI_SUCCESS;
- } + }
Done:
if (EFI_ERROR (Status)) {
@@ -629,8 +629,8 @@ Returns: UNIX_EFI_FILE_PRIVATE *NewPrivateFile;
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
EFI_STATUS Status;
- CHAR16 *Src; - char *Dst; + CHAR16 *Src;
+ char *Dst;
CHAR8 *RealFileName;
//CHAR16 *TempFileName;
char *ParseFileName;
@@ -683,7 +683,7 @@ Returns: // BUGBUG: assume an open of root
// if current location, return current data
//
- if (StrCmp (FileName, L"\\") == 0 + if (StrCmp (FileName, L"\\") == 0
|| (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
//
// BUGBUG: assume an open root
@@ -727,25 +727,25 @@ OpenRoot: if (*FileName == L'\\') {
AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
- // Skip first '\'. - Src = FileName + 1; + // Skip first '\'.
+ Src = FileName + 1;
} else {
AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName);
- Src = FileName; - }
- Dst = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName); - GuardPointer = NewPrivateFile->FileName + AsciiStrLen(PrivateRoot->FilePath); - *Dst++ = '/'; - // Convert unicode to ascii and '\' to '/' - while (*Src) { - if (*Src == '\\') - *Dst++ = '/'; - else - *Dst++ = *Src; - Src++; - } - *Dst = 0; - + Src = FileName;
+ }
+ Dst = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName);
+ GuardPointer = NewPrivateFile->FileName + AsciiStrLen(PrivateRoot->FilePath);
+ *Dst++ = '/';
+ // Convert unicode to ascii and '\' to '/'
+ while (*Src) {
+ if (*Src == '\\')
+ *Dst++ = '/';
+ else
+ *Dst++ = *Src;
+ Src++;
+ }
+ *Dst = 0;
+
//
// Get rid of . and .., except leading . or ..
@@ -810,22 +810,22 @@ OpenRoot: }
RealFileName = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName) - 1;
- while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/') - RealFileName--; + while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/')
+ RealFileName--;
TempChar = *(RealFileName - 1);
*(RealFileName - 1) = 0;
*(RealFileName - 1) = TempChar;
- - +
+
//
// Test whether file or directory
//
NewPrivateFile->IsRootDirectory = FALSE;
- NewPrivateFile->fd = -1; - NewPrivateFile->Dir = NULL; + NewPrivateFile->fd = -1;
+ NewPrivateFile->Dir = NULL;
if (OpenMode & EFI_FILE_MODE_CREATE) {
if (Attributes & EFI_FILE_DIRECTORY) {
NewPrivateFile->IsDirectoryPath = TRUE;
@@ -833,11 +833,11 @@ OpenRoot: NewPrivateFile->IsDirectoryPath = FALSE;
}
} else {
- struct stat finfo; - int res = NewPrivateFile->UnixThunk->Stat (NewPrivateFile->FileName, &finfo); - if (res == 0 && S_ISDIR(finfo.st_mode)) + struct stat finfo;
+ int res = NewPrivateFile->UnixThunk->Stat (NewPrivateFile->FileName, &finfo);
+ if (res == 0 && S_ISDIR(finfo.st_mode))
NewPrivateFile->IsDirectoryPath = TRUE;
- else + else
NewPrivateFile->IsDirectoryPath = FALSE;
}
@@ -859,10 +859,10 @@ OpenRoot: // Create a directory
//
if (NewPrivateFile->UnixThunk->MkDir (NewPrivateFile->FileName, 0777) != 0) {
- INTN LastError; + INTN LastError;
LastError = PrivateFile->UnixThunk->GetErrno ();
- if (LastError != EEXIST) { + if (LastError != EEXIST) {
//gBS->FreePool (TempFileName);
Status = EFI_ACCESS_DENIED;
goto Done;
@@ -870,11 +870,11 @@ OpenRoot: }
}
- NewPrivateFile->Dir = NewPrivateFile->UnixThunk->OpenDir - (NewPrivateFile->FileName); + NewPrivateFile->Dir = NewPrivateFile->UnixThunk->OpenDir
+ (NewPrivateFile->FileName);
- if (NewPrivateFile->Dir == NULL) { - if (PrivateFile->UnixThunk->GetErrno () == EACCES) { + if (NewPrivateFile->Dir == NULL) {
+ if (PrivateFile->UnixThunk->GetErrno () == EACCES) {
Status = EFI_ACCESS_DENIED;
} else {
Status = EFI_NOT_FOUND;
@@ -887,13 +887,13 @@ OpenRoot: //
// deal with file
//
- NewPrivateFile->fd = NewPrivateFile->UnixThunk->Open + NewPrivateFile->fd = NewPrivateFile->UnixThunk->Open
(NewPrivateFile->FileName,
- ((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0) - | (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR), - 0666); - if (NewPrivateFile->fd < 0) { - if (PrivateFile->UnixThunk->GetErrno () == ENOENT) { + ((OpenMode & EFI_FILE_MODE_CREATE) ? O_CREAT : 0)
+ | (NewPrivateFile->IsOpenedByRead ? O_RDONLY : O_RDWR),
+ 0666);
+ if (NewPrivateFile->fd < 0) {
+ if (PrivateFile->UnixThunk->GetErrno () == ENOENT) {
Status = EFI_NOT_FOUND;
} else {
Status = EFI_ACCESS_DENIED;
@@ -987,15 +987,15 @@ Returns: PrivateFile = UNIX_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- if (PrivateFile->fd >= 0) { + if (PrivateFile->fd >= 0) {
PrivateFile->UnixThunk->Close (PrivateFile->fd);
- } - if (PrivateFile->Dir != NULL) { + }
+ if (PrivateFile->Dir != NULL) {
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
- } + }
- PrivateFile->fd = -1; - PrivateFile->Dir = NULL; + PrivateFile->fd = -1;
+ PrivateFile->Dir = NULL;
if (PrivateFile->FileName) {
gBS->FreePool (PrivateFile->FileName);
@@ -1043,7 +1043,7 @@ Returns: if (PrivateFile->IsDirectoryPath) {
if (PrivateFile->Dir != NULL) {
PrivateFile->UnixThunk->CloseDir (PrivateFile->Dir);
- PrivateFile->Dir = NULL; + PrivateFile->Dir = NULL;
}
if (PrivateFile->UnixThunk->RmDir (PrivateFile->FileName) == 0) {
@@ -1051,7 +1051,7 @@ Returns: }
} else {
PrivateFile->UnixThunk->Close (PrivateFile->fd);
- PrivateFile->fd = -1; + PrivateFile->fd = -1;
if (!PrivateFile->IsOpenedByRead) {
if (!PrivateFile->UnixThunk->UnLink (PrivateFile->FileName)) {
@@ -1070,7 +1070,7 @@ STATIC VOID
UnixSystemTimeToEfiTime (
EFI_UNIX_THUNK_PROTOCOL *UnixThunk,
- IN time_t SystemTime, + IN time_t SystemTime,
OUT EFI_TIME *Time
)
/*++
@@ -1091,19 +1091,19 @@ Returns: --*/
{
- struct tm *tm; - tm = UnixThunk->GmTime (&SystemTime); - Time->Year = tm->tm_year; - Time->Month = tm->tm_mon; - Time->Day = tm->tm_mday; - Time->Hour = tm->tm_hour; - Time->Minute = tm->tm_min; - Time->Second = tm->tm_sec; - Time->Nanosecond = 0; - - Time->TimeZone = UnixThunk->GetTimeZone (); -
- if (UnixThunk->GetDayLight ()) { + struct tm *tm;
+ tm = UnixThunk->GmTime (&SystemTime);
+ Time->Year = tm->tm_year;
+ Time->Month = tm->tm_mon;
+ Time->Day = tm->tm_mday;
+ Time->Hour = tm->tm_hour;
+ Time->Minute = tm->tm_min;
+ Time->Second = tm->tm_sec;
+ Time->Nanosecond = 0;
+
+ Time->TimeZone = UnixThunk->GetTimeZone ();
+
+ if (UnixThunk->GetDayLight ()) {
Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
}
}
@@ -1112,7 +1112,7 @@ STATIC EFI_STATUS
UnixSimpleFileSystemFileInfo (
UNIX_EFI_FILE_PRIVATE *PrivateFile,
- IN CHAR8 *FileName, + IN CHAR8 *FileName,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
@@ -1141,18 +1141,18 @@ Returns: EFI_FILE_INFO *Info;
CHAR8 *RealFileName;
CHAR8 *TempPointer;
- CHAR16 *BufferFileName; - struct stat buf; + CHAR16 *BufferFileName;
+ struct stat buf;
- if (FileName != NULL) { - RealFileName = FileName; - } + if (FileName != NULL) {
+ RealFileName = FileName;
+ }
else if (PrivateFile->IsRootDirectory) {
- RealFileName = ""; + RealFileName = "";
} else {
RealFileName = PrivateFile->FileName;
- } - + }
+
TempPointer = RealFileName;
while (*TempPointer) {
if (*TempPointer == '/') {
@@ -1161,7 +1161,7 @@ Returns: TempPointer++;
}
- +
Size = SIZE_OF_EFI_FILE_INFO;
NameSize = AsciiStrSize (RealFileName) * 2;
ResultSize = Size + NameSize;
@@ -1169,39 +1169,39 @@ Returns: if (*BufferSize < ResultSize) {
*BufferSize = ResultSize;
return EFI_BUFFER_TOO_SMALL;
- } - if (PrivateFile->UnixThunk->Stat ( - FileName == NULL ? PrivateFile->FileName : FileName, - &buf) < 0) - return EFI_DEVICE_ERROR; - + }
+ if (PrivateFile->UnixThunk->Stat (
+ FileName == NULL ? PrivateFile->FileName : FileName,
+ &buf) < 0)
+ return EFI_DEVICE_ERROR;
+
Status = EFI_SUCCESS;
Info = Buffer;
ZeroMem (Info, ResultSize);
Info->Size = ResultSize;
- Info->FileSize = buf.st_size; - Info->PhysicalSize = MultU64x32 (buf.st_blocks, buf.st_blksize); -
- UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_ctime, &Info->CreateTime); - UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_atime, &Info->LastAccessTime); - UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_mtime, &Info->ModificationTime); - - if (!(buf.st_mode & S_IWUSR)) { + Info->FileSize = buf.st_size;
+ Info->PhysicalSize = MultU64x32 (buf.st_blocks, buf.st_blksize);
+
+ UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_ctime, &Info->CreateTime);
+ UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_atime, &Info->LastAccessTime);
+ UnixSystemTimeToEfiTime (PrivateFile->UnixThunk, buf.st_mtime, &Info->ModificationTime);
+
+ if (!(buf.st_mode & S_IWUSR)) {
Info->Attribute |= EFI_FILE_READ_ONLY;
}
- if (S_ISDIR(buf.st_mode)) { + if (S_ISDIR(buf.st_mode)) {
Info->Attribute |= EFI_FILE_DIRECTORY;
}
- BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size); - while (*RealFileName) - *BufferFileName++ = *RealFileName++; - *BufferFileName = 0; - + BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size);
+ while (*RealFileName)
+ *BufferFileName++ = *RealFileName++;
+ *BufferFileName = 0;
+
*BufferSize = ResultSize;
return Status;
}
@@ -1245,11 +1245,11 @@ Returns: {
UNIX_EFI_FILE_PRIVATE *PrivateFile;
EFI_STATUS Status;
- INTN Res; + INTN Res;
UINTN Size;
UINTN NameSize;
UINTN ResultSize;
- CHAR8 *FullFileName; + CHAR8 *FullFileName;
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1266,62 +1266,62 @@ Returns: Res = PrivateFile->UnixThunk->Read (
PrivateFile->fd,
Buffer,
- *BufferSize); - if (Res < 0) - return EFI_DEVICE_ERROR; - *BufferSize = Res; - return EFI_SUCCESS; + *BufferSize);
+ if (Res < 0)
+ return EFI_DEVICE_ERROR;
+ *BufferSize = Res;
+ return EFI_SUCCESS;
}
//
- // Read on a directory. + // Read on a directory.
//
if (PrivateFile->Dir == NULL) {
return EFI_DEVICE_ERROR;
}
- - if (PrivateFile->Dirent == NULL) { - PrivateFile->Dirent = PrivateFile->UnixThunk->ReadDir (PrivateFile->Dir); - if (PrivateFile->Dirent == NULL) { +
+ if (PrivateFile->Dirent == NULL) {
+ PrivateFile->Dirent = PrivateFile->UnixThunk->ReadDir (PrivateFile->Dir);
+ if (PrivateFile->Dirent == NULL) {
*BufferSize = 0;
return EFI_SUCCESS;
- } - } - + }
+ }
+
Size = SIZE_OF_EFI_FILE_INFO;
- NameSize = AsciiStrLen (PrivateFile->Dirent->d_name) + 1; + NameSize = AsciiStrLen (PrivateFile->Dirent->d_name) + 1;
ResultSize = Size + 2 * NameSize;
if (*BufferSize < ResultSize) {
*BufferSize = ResultSize;
return EFI_BUFFER_TOO_SMALL;
- } + }
Status = EFI_SUCCESS;
*BufferSize = ResultSize;
- +
Status = gBS->AllocatePool (
EfiBootServicesData,
- AsciiStrLen(PrivateFile->FileName) + 1 + NameSize, - (VOID **)&FullFileName + AsciiStrLen(PrivateFile->FileName) + 1 + NameSize,
+ (VOID **)&FullFileName
);
if (EFI_ERROR (Status)) {
- return Status; + return Status;
}
- - AsciiStrCpy(FullFileName, PrivateFile->FileName); - AsciiStrCat(FullFileName, "/"); - AsciiStrCat(FullFileName, PrivateFile->Dirent->d_name); - Status = UnixSimpleFileSystemFileInfo (PrivateFile, - FullFileName, - BufferSize, - Buffer); - gBS->FreePool (FullFileName); +
+ AsciiStrCpy(FullFileName, PrivateFile->FileName);
+ AsciiStrCat(FullFileName, "/");
+ AsciiStrCat(FullFileName, PrivateFile->Dirent->d_name);
+ Status = UnixSimpleFileSystemFileInfo (PrivateFile,
+ FullFileName,
+ BufferSize,
+ Buffer);
+ gBS->FreePool (FullFileName);
- PrivateFile->Dirent = NULL; + PrivateFile->Dirent = NULL;
- return Status; + return Status;
}
EFI_STATUS
@@ -1368,7 +1368,7 @@ Returns: // TODO: EFI_INVALID_PARAMETER - add return value to function comment
{
UNIX_EFI_FILE_PRIVATE *PrivateFile;
- UINTN Res; + UINTN Res;
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1391,11 +1391,11 @@ Returns: Res = PrivateFile->UnixThunk->Write (
PrivateFile->fd,
Buffer,
- *BufferSize); - if (Res == (UINTN)-1) - return EFI_DEVICE_ERROR; - *BufferSize = Res; - return EFI_SUCCESS; + *BufferSize);
+ if (Res == (UINTN)-1)
+ return EFI_DEVICE_ERROR;
+ *BufferSize = Res;
+ return EFI_SUCCESS;
//
// bugbug: need to access unix error reporting
@@ -1444,17 +1444,17 @@ Returns: return EFI_UNSUPPORTED;
}
- if (PrivateFile->Dir == NULL) { - return EFI_DEVICE_ERROR; - } - PrivateFile->UnixThunk->RewindDir (PrivateFile->Dir); + if (PrivateFile->Dir == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+ PrivateFile->UnixThunk->RewindDir (PrivateFile->Dir);
return EFI_SUCCESS;
} else {
if (Position == (UINT64) -1) {
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, 0, SEEK_END);
} else {
Pos = PrivateFile->UnixThunk->Lseek (PrivateFile->fd, Position, SEEK_SET);
- } + }
Status = (Pos == (UINT64) -1) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
return Status;
@@ -1499,7 +1499,7 @@ Returns: if (PrivateFile->IsDirectoryPath) {
return EFI_UNSUPPORTED;
} 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;
}
}
@@ -1552,7 +1552,7 @@ Returns: EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
INTN UnixStatus;
UNIX_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- struct statfs buf; + struct statfs buf;
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1572,10 +1572,10 @@ Returns: return EFI_BUFFER_TOO_SMALL;
}
- UnixStatus = PrivateFile->UnixThunk->StatFs (PrivateFile->FileName, &buf); - if (UnixStatus < 0) + UnixStatus = PrivateFile->UnixThunk->StatFs (PrivateFile->FileName, &buf);
+ if (UnixStatus < 0)
return EFI_DEVICE_ERROR;
- +
FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
FileSystemInfoBuffer->ReadOnly = FALSE;
@@ -1583,9 +1583,9 @@ Returns: //
// Succeeded
//
- FileSystemInfoBuffer->VolumeSize = MultU64x32 (buf.f_blocks, buf.f_bsize); - FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize); - FileSystemInfoBuffer->BlockSize = buf.f_bsize; + FileSystemInfoBuffer->VolumeSize = MultU64x32 (buf.f_blocks, buf.f_bsize);
+ FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
+ FileSystemInfoBuffer->BlockSize = buf.f_bsize;
StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
@@ -1593,7 +1593,7 @@ Returns: Status = EFI_SUCCESS;
}
- else if (CompareGuid (InformationType, + else if (CompareGuid (InformationType,
&gEfiFileSystemVolumeLabelInfoIdGuid)) {
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
@@ -1674,9 +1674,9 @@ Returns: struct tm NewLastAccessSystemTime;
struct tm NewLastWriteSystemTime;
EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
- CHAR8 *AsciiFilePtr; - CHAR16 *UnicodeFilePtr; - INTN UnixStatus; + CHAR8 *AsciiFilePtr;
+ CHAR16 *UnicodeFilePtr;
+ INTN UnixStatus;
//
// Check for invalid parameters.
@@ -1779,7 +1779,7 @@ Returns: goto Done;
}
- Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize, + Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize,
(VOID **)&OldFileInfo);
if (EFI_ERROR (Status)) {
@@ -1819,9 +1819,9 @@ Returns: }
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
- AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName); - UnicodeFilePtr = NewFileInfo->FileName + 1; - *AsciiFilePtr++ ='/'; + AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
+ UnicodeFilePtr = NewFileInfo->FileName + 1;
+ *AsciiFilePtr++ ='/';
} else {
Status = gBS->AllocatePool (
EfiBootServicesData,
@@ -1834,18 +1834,18 @@ Returns: }
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
- AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName); - while (AsciiFilePtr > NewFileName && AsciiFilePtr[-1] != '/') { - AsciiFilePtr--; - } - UnicodeFilePtr = NewFileInfo->FileName; + AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
+ while (AsciiFilePtr > NewFileName && AsciiFilePtr[-1] != '/') {
+ AsciiFilePtr--;
+ }
+ UnicodeFilePtr = NewFileInfo->FileName;
+ }
+ // Convert to ascii.
+ while (*UnicodeFilePtr) {
+ *AsciiFilePtr++ = *UnicodeFilePtr++;
}
- // Convert to ascii. - while (*UnicodeFilePtr) { - *AsciiFilePtr++ = *UnicodeFilePtr++; - } - *AsciiFilePtr = 0; - + *AsciiFilePtr = 0;
+
//
// Is there an attribute change request?
@@ -1902,10 +1902,10 @@ Returns: //
// Set file or directory information.
//
- if (PrivateFile->UnixThunk->Stat (OldFileName, &OldAttr) != 0) { - Status = EFI_DEVICE_ERROR; - goto Done; - } + if (PrivateFile->UnixThunk->Stat (OldFileName, &OldAttr) != 0) {
+ Status = EFI_DEVICE_ERROR;
+ goto Done;
+ }
//
// Name change.
@@ -1977,7 +1977,7 @@ Returns: // Time change
//
if (TimeChangeFlag) {
- struct utimbuf utime; + struct utimbuf utime;
NewLastAccessSystemTime.tm_year = NewFileInfo->LastAccessTime.Year;
NewLastAccessSystemTime.tm_mon = NewFileInfo->LastAccessTime.Month;
@@ -1985,25 +1985,25 @@ Returns: NewLastAccessSystemTime.tm_hour = NewFileInfo->LastAccessTime.Hour;
NewLastAccessSystemTime.tm_min = NewFileInfo->LastAccessTime.Minute;
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_mon = NewFileInfo->ModificationTime.Month;
NewLastWriteSystemTime.tm_mday = NewFileInfo->ModificationTime.Day;
NewLastWriteSystemTime.tm_hour = NewFileInfo->ModificationTime.Hour;
NewLastWriteSystemTime.tm_min = NewFileInfo->ModificationTime.Minute;
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;
}
- if (PrivateFile->UnixThunk->UTime (PrivateFile->FileName, &utime) == -1) { + if (PrivateFile->UnixThunk->UTime (PrivateFile->FileName, &utime) == -1) {
goto Done;
}
}
@@ -2015,9 +2015,9 @@ Returns: NewAttr = OldAttr.st_mode;
if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {
- NewAttr &= ~(S_IRUSR | S_IRGRP | S_IROTH); + NewAttr &= ~(S_IRUSR | S_IRGRP | S_IROTH);
} else {
- NewAttr |= S_IRUSR; + NewAttr |= S_IRUSR;
}
UnixStatus = PrivateFile->UnixThunk->Chmod (NewFileName, NewAttr);
@@ -2093,10 +2093,10 @@ Returns: return EFI_ACCESS_DENIED;
}
- if (PrivateFile->fd < 0) { + if (PrivateFile->fd < 0) {
return EFI_DEVICE_ERROR;
}
- +
return PrivateFile->UnixThunk->FSync (PrivateFile->fd) == 0 ? EFI_SUCCESS : EFI_DEVICE_ERROR;
//
|