]> git.proxmox.com Git - mirror_edk2.git/blame - FatPkg/EnhancedFatDxe/Info.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / Info.c
CommitLineData
cae7420b
DB
1/** @file\r
2 Routines dealing with setting/getting file/volume info\r
b9ec9330 3\r
55248f85 4Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
eb6cb4ce 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
b9ec9330
QH
6\r
7\r
b9ec9330 8\r
cae7420b 9**/\r
b9ec9330
QH
10\r
11#include "Fat.h"\r
12\r
205cc663
DB
13/**\r
14\r
15 Get the volume's info into Buffer.\r
16\r
17 @param Volume - FAT file system volume.\r
18 @param BufferSize - Size of Buffer.\r
19 @param Buffer - Buffer containing volume info.\r
20\r
21 @retval EFI_SUCCESS - Get the volume info successfully.\r
22 @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
23\r
24**/\r
b9ec9330
QH
25EFI_STATUS\r
26FatGetVolumeInfo (\r
bcdcc416
MK
27 IN FAT_VOLUME *Volume,\r
28 IN OUT UINTN *BufferSize,\r
29 OUT VOID *Buffer\r
b9ec9330
QH
30 );\r
31\r
205cc663
DB
32/**\r
33\r
34 Set the volume's info.\r
35\r
36 @param Volume - FAT file system volume.\r
37 @param BufferSize - Size of Buffer.\r
38 @param Buffer - Buffer containing the new volume info.\r
39\r
40 @retval EFI_SUCCESS - Set the volume info successfully.\r
41 @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
42 @retval EFI_WRITE_PROTECTED - The volume is read only.\r
43 @return other - An error occurred when operation the disk.\r
44\r
45**/\r
b9ec9330
QH
46EFI_STATUS\r
47FatSetVolumeInfo (\r
bcdcc416
MK
48 IN FAT_VOLUME *Volume,\r
49 IN UINTN BufferSize,\r
50 IN VOID *Buffer\r
b9ec9330
QH
51 );\r
52\r
205cc663
DB
53/**\r
54\r
55 Set or Get the some types info of the file into Buffer.\r
56\r
57 @param IsSet - TRUE:The access is set, else is get\r
58 @param FHand - The handle of file\r
59 @param Type - The type of the info\r
60 @param BufferSize - Size of Buffer\r
61 @param Buffer - Buffer containing volume info\r
62\r
63 @retval EFI_SUCCESS - Get the info successfully\r
64 @retval EFI_DEVICE_ERROR - Can not find the OFile for the file\r
65\r
66**/\r
b9ec9330
QH
67EFI_STATUS\r
68FatSetOrGetInfo (\r
bcdcc416
MK
69 IN BOOLEAN IsSet,\r
70 IN EFI_FILE_PROTOCOL *FHand,\r
71 IN EFI_GUID *Type,\r
72 IN OUT UINTN *BufferSize,\r
73 IN OUT VOID *Buffer\r
b9ec9330
QH
74 );\r
75\r
cae7420b
DB
76/**\r
77\r
78 Get the open file's info into Buffer.\r
79\r
80 @param OFile - The open file.\r
81 @param BufferSize - Size of Buffer.\r
82 @param Buffer - Buffer containing file info.\r
83\r
84 @retval EFI_SUCCESS - Get the file info successfully.\r
85 @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
86\r
87**/\r
b9ec9330
QH
88EFI_STATUS\r
89FatGetFileInfo (\r
bcdcc416
MK
90 IN FAT_OFILE *OFile,\r
91 IN OUT UINTN *BufferSize,\r
92 OUT VOID *Buffer\r
b9ec9330 93 )\r
cae7420b
DB
94{\r
95 return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);\r
96}\r
b9ec9330 97\r
cae7420b 98/**\r
b9ec9330 99\r
cae7420b 100 Get the volume's info into Buffer.\r
b9ec9330 101\r
cae7420b
DB
102 @param Volume - FAT file system volume.\r
103 @param BufferSize - Size of Buffer.\r
104 @param Buffer - Buffer containing volume info.\r
b9ec9330 105\r
cae7420b
DB
106 @retval EFI_SUCCESS - Get the volume info successfully.\r
107 @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
b9ec9330 108\r
cae7420b 109**/\r
b9ec9330
QH
110EFI_STATUS\r
111FatGetVolumeInfo (\r
bcdcc416
MK
112 IN FAT_VOLUME *Volume,\r
113 IN OUT UINTN *BufferSize,\r
114 OUT VOID *Buffer\r
b9ec9330 115 )\r
b9ec9330
QH
116{\r
117 UINTN Size;\r
118 UINTN NameSize;\r
119 UINTN ResultSize;\r
120 CHAR16 Name[FAT_NAME_LEN + 1];\r
121 EFI_STATUS Status;\r
122 EFI_FILE_SYSTEM_INFO *Info;\r
123 UINT8 ClusterAlignment;\r
124\r
bcdcc416
MK
125 Size = SIZE_OF_EFI_FILE_SYSTEM_INFO;\r
126 Status = FatGetVolumeEntry (Volume, Name);\r
127 NameSize = StrSize (Name);\r
128 ResultSize = Size + NameSize;\r
129 ClusterAlignment = Volume->ClusterAlignment;\r
b9ec9330
QH
130\r
131 //\r
132 // If we don't have valid info, compute it now\r
133 //\r
134 FatComputeFreeInfo (Volume);\r
135\r
136 Status = EFI_BUFFER_TOO_SMALL;\r
137 if (*BufferSize >= ResultSize) {\r
bcdcc416 138 Status = EFI_SUCCESS;\r
b9ec9330 139\r
bcdcc416 140 Info = Buffer;\r
b9ec9330
QH
141 ZeroMem (Info, SIZE_OF_EFI_FILE_SYSTEM_INFO);\r
142\r
bcdcc416
MK
143 Info->Size = ResultSize;\r
144 Info->ReadOnly = Volume->ReadOnly;\r
145 Info->BlockSize = (UINT32)Volume->ClusterSize;\r
146 Info->VolumeSize = LShiftU64 (Volume->MaxCluster, ClusterAlignment);\r
147 Info->FreeSpace = LShiftU64 (\r
148 Volume->FatInfoSector.FreeInfo.ClusterCount,\r
149 ClusterAlignment\r
150 );\r
151 CopyMem ((CHAR8 *)Buffer + Size, Name, NameSize);\r
b9ec9330
QH
152 }\r
153\r
154 *BufferSize = ResultSize;\r
155 return Status;\r
156}\r
157\r
cae7420b
DB
158/**\r
159\r
160 Get the volume's label info into Buffer.\r
161\r
162 @param Volume - FAT file system volume.\r
163 @param BufferSize - Size of Buffer.\r
164 @param Buffer - Buffer containing volume's label info.\r
165\r
166 @retval EFI_SUCCESS - Get the volume's label info successfully.\r
167 @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
168\r
169**/\r
b9ec9330
QH
170EFI_STATUS\r
171FatGetVolumeLabelInfo (\r
bcdcc416
MK
172 IN FAT_VOLUME *Volume,\r
173 IN OUT UINTN *BufferSize,\r
174 OUT VOID *Buffer\r
b9ec9330 175 )\r
b9ec9330 176{\r
bcdcc416
MK
177 UINTN Size;\r
178 UINTN NameSize;\r
179 UINTN ResultSize;\r
180 CHAR16 Name[FAT_NAME_LEN + 1];\r
181 EFI_STATUS Status;\r
182\r
183 Size = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL;\r
184 Status = FatGetVolumeEntry (Volume, Name);\r
185 NameSize = StrSize (Name);\r
186 ResultSize = Size + NameSize;\r
187\r
188 Status = EFI_BUFFER_TOO_SMALL;\r
b9ec9330 189 if (*BufferSize >= ResultSize) {\r
bcdcc416
MK
190 Status = EFI_SUCCESS;\r
191 CopyMem ((CHAR8 *)Buffer + Size, Name, NameSize);\r
b9ec9330
QH
192 }\r
193\r
194 *BufferSize = ResultSize;\r
195 return Status;\r
196}\r
197\r
cae7420b
DB
198/**\r
199\r
200 Set the volume's info.\r
201\r
202 @param Volume - FAT file system volume.\r
203 @param BufferSize - Size of Buffer.\r
204 @param Buffer - Buffer containing the new volume info.\r
205\r
206 @retval EFI_SUCCESS - Set the volume info successfully.\r
207 @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
208 @retval EFI_WRITE_PROTECTED - The volume is read only.\r
209 @return other - An error occurred when operation the disk.\r
210\r
211**/\r
b9ec9330
QH
212EFI_STATUS\r
213FatSetVolumeInfo (\r
bcdcc416
MK
214 IN FAT_VOLUME *Volume,\r
215 IN UINTN BufferSize,\r
216 IN VOID *Buffer\r
b9ec9330 217 )\r
b9ec9330
QH
218{\r
219 EFI_FILE_SYSTEM_INFO *Info;\r
220\r
bcdcc416 221 Info = (EFI_FILE_SYSTEM_INFO *)Buffer;\r
b9ec9330 222\r
bcdcc416 223 if ((BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + 2) || (Info->Size > BufferSize)) {\r
b9ec9330
QH
224 return EFI_BAD_BUFFER_SIZE;\r
225 }\r
226\r
227 return FatSetVolumeEntry (Volume, Info->VolumeLabel);\r
228}\r
229\r
cae7420b
DB
230/**\r
231\r
232 Set the volume's label info.\r
233\r
234 @param Volume - FAT file system volume.\r
235 @param BufferSize - Size of Buffer.\r
236 @param Buffer - Buffer containing the new volume label info.\r
237\r
238 @retval EFI_SUCCESS - Set the volume label info successfully.\r
239 @retval EFI_WRITE_PROTECTED - The disk is write protected.\r
240 @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
241 @return other - An error occurred when operation the disk.\r
242\r
243**/\r
b9ec9330
QH
244EFI_STATUS\r
245FatSetVolumeLabelInfo (\r
bcdcc416
MK
246 IN FAT_VOLUME *Volume,\r
247 IN UINTN BufferSize,\r
248 IN VOID *Buffer\r
b9ec9330 249 )\r
b9ec9330 250{\r
bcdcc416 251 EFI_FILE_SYSTEM_VOLUME_LABEL *Info;\r
b9ec9330 252\r
bcdcc416 253 Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *)Buffer;\r
b9ec9330 254\r
80d70ac3 255 if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL + 2) {\r
b9ec9330
QH
256 return EFI_BAD_BUFFER_SIZE;\r
257 }\r
258\r
259 return FatSetVolumeEntry (Volume, Info->VolumeLabel);\r
260}\r
261\r
cae7420b
DB
262/**\r
263\r
264 Set the file info.\r
265\r
266 @param Volume - FAT file system volume.\r
267 @param IFile - The instance of the open file.\r
268 @param OFile - The open file.\r
269 @param BufferSize - Size of Buffer.\r
270 @param Buffer - Buffer containing the new file info.\r
271\r
272 @retval EFI_SUCCESS - Set the file info successfully.\r
273 @retval EFI_ACCESS_DENIED - It is the root directory\r
274 or the directory attribute bit can not change\r
275 or try to change a directory size\r
276 or something else.\r
277 @retval EFI_UNSUPPORTED - The new file size is larger than 4GB.\r
278 @retval EFI_WRITE_PROTECTED - The disk is write protected.\r
279 @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
280 @retval EFI_INVALID_PARAMETER - The time info or attributes info is error.\r
281 @retval EFI_OUT_OF_RESOURCES - Can not allocate new memory.\r
282 @retval EFI_VOLUME_CORRUPTED - The volume is corrupted.\r
283 @return other - An error occurred when operation the disk.\r
284\r
285**/\r
b9ec9330
QH
286EFI_STATUS\r
287FatSetFileInfo (\r
bcdcc416
MK
288 IN FAT_VOLUME *Volume,\r
289 IN FAT_IFILE *IFile,\r
290 IN FAT_OFILE *OFile,\r
291 IN UINTN BufferSize,\r
292 IN VOID *Buffer\r
b9ec9330 293 )\r
b9ec9330 294{\r
bcdcc416
MK
295 EFI_STATUS Status;\r
296 EFI_FILE_INFO *NewInfo;\r
297 FAT_OFILE *DotOFile;\r
298 FAT_OFILE *Parent;\r
299 CHAR16 NewFileName[EFI_PATH_STRING_LENGTH];\r
300 EFI_TIME ZeroTime;\r
301 FAT_DIRENT *DirEnt;\r
302 FAT_DIRENT *TempDirEnt;\r
303 UINT8 NewAttribute;\r
304 BOOLEAN ReadOnly;\r
b9ec9330
QH
305\r
306 ZeroMem (&ZeroTime, sizeof (EFI_TIME));\r
bcdcc416
MK
307 Parent = OFile->Parent;\r
308 DirEnt = OFile->DirEnt;\r
b9ec9330
QH
309 //\r
310 // If this is the root directory, we can't make any updates\r
311 //\r
312 if (Parent == NULL) {\r
313 return EFI_ACCESS_DENIED;\r
314 }\r
bcdcc416 315\r
b9ec9330
QH
316 //\r
317 // Make sure there's a valid input buffer\r
318 //\r
319 NewInfo = Buffer;\r
bcdcc416 320 if ((BufferSize < SIZE_OF_EFI_FILE_INFO + 2) || (NewInfo->Size > BufferSize)) {\r
b9ec9330
QH
321 return EFI_BAD_BUFFER_SIZE;\r
322 }\r
323\r
324 ReadOnly = (BOOLEAN)(IFile->ReadOnly || (DirEnt->Entry.Attributes & EFI_FILE_READ_ONLY));\r
325 //\r
326 // if a zero time is specified, then the original time is preserved\r
327 //\r
328 if (CompareMem (&ZeroTime, &NewInfo->CreateTime, sizeof (EFI_TIME)) != 0) {\r
329 if (!FatIsValidTime (&NewInfo->CreateTime)) {\r
330 return EFI_INVALID_PARAMETER;\r
331 }\r
332\r
333 if (!ReadOnly) {\r
334 FatEfiTimeToFatTime (&NewInfo->CreateTime, &DirEnt->Entry.FileCreateTime);\r
335 }\r
336 }\r
337\r
338 if (CompareMem (&ZeroTime, &NewInfo->ModificationTime, sizeof (EFI_TIME)) != 0) {\r
339 if (!FatIsValidTime (&NewInfo->ModificationTime)) {\r
340 return EFI_INVALID_PARAMETER;\r
341 }\r
342\r
343 if (!ReadOnly) {\r
344 FatEfiTimeToFatTime (&NewInfo->ModificationTime, &DirEnt->Entry.FileModificationTime);\r
345 }\r
346\r
347 OFile->PreserveLastModification = TRUE;\r
348 }\r
349\r
350 if (NewInfo->Attribute & (~EFI_FILE_VALID_ATTR)) {\r
351 return EFI_INVALID_PARAMETER;\r
352 }\r
353\r
bcdcc416 354 NewAttribute = (UINT8)NewInfo->Attribute;\r
b9ec9330
QH
355 //\r
356 // Can not change the directory attribute bit\r
357 //\r
358 if ((NewAttribute ^ DirEnt->Entry.Attributes) & EFI_FILE_DIRECTORY) {\r
359 return EFI_ACCESS_DENIED;\r
360 }\r
bcdcc416 361\r
b9ec9330
QH
362 //\r
363 // Set the current attributes even if the IFile->ReadOnly is TRUE\r
364 //\r
bcdcc416 365 DirEnt->Entry.Attributes = (UINT8)((DirEnt->Entry.Attributes &~EFI_FILE_VALID_ATTR) | NewAttribute);\r
b9ec9330
QH
366 //\r
367 // Open the filename and see if it refers to an existing file\r
368 //\r
369 Status = FatLocateOFile (&Parent, NewInfo->FileName, DirEnt->Entry.Attributes, NewFileName);\r
370 if (EFI_ERROR (Status)) {\r
371 return Status;\r
372 }\r
373\r
374 if (*NewFileName != 0) {\r
375 //\r
376 // File was not found. We do not allow rename of the current directory if\r
377 // there are open files below the current directory\r
378 //\r
bcdcc416 379 if (!IsListEmpty (&OFile->ChildHead) || (Parent == OFile)) {\r
b9ec9330
QH
380 return EFI_ACCESS_DENIED;\r
381 }\r
382\r
383 if (ReadOnly) {\r
384 return EFI_ACCESS_DENIED;\r
385 }\r
386\r
387 Status = FatRemoveDirEnt (OFile->Parent, DirEnt);\r
388 if (EFI_ERROR (Status)) {\r
389 return Status;\r
390 }\r
bcdcc416 391\r
b9ec9330
QH
392 //\r
393 // Create new dirent\r
394 //\r
395 Status = FatCreateDirEnt (Parent, NewFileName, DirEnt->Entry.Attributes, &TempDirEnt);\r
396 if (EFI_ERROR (Status)) {\r
397 return Status;\r
398 }\r
399\r
400 FatCloneDirEnt (TempDirEnt, DirEnt);\r
401 FatFreeDirEnt (DirEnt);\r
402 DirEnt = TempDirEnt;\r
403 DirEnt->OFile = OFile;\r
404 OFile->DirEnt = DirEnt;\r
405 OFile->Parent = Parent;\r
406 RemoveEntryList (&OFile->ChildLink);\r
407 InsertHeadList (&Parent->ChildHead, &OFile->ChildLink);\r
408 //\r
409 // If this is a directory, synchronize its dot directory entry\r
410 //\r
411 if (OFile->ODir != NULL) {\r
412 //\r
44c9618a 413 // Synchronize its dot entry\r
b9ec9330
QH
414 //\r
415 FatResetODirCursor (OFile);\r
416 ASSERT (OFile->Parent != NULL);\r
417 for (DotOFile = OFile; DotOFile != OFile->Parent->Parent; DotOFile = DotOFile->Parent) {\r
418 Status = FatGetNextDirEnt (OFile, &DirEnt);\r
bcdcc416 419 if (EFI_ERROR (Status) || (DirEnt == NULL) || !FatIsDotDirEnt (DirEnt)) {\r
b9ec9330
QH
420 return EFI_VOLUME_CORRUPTED;\r
421 }\r
422\r
423 FatCloneDirEnt (DirEnt, DotOFile->DirEnt);\r
424 Status = FatStoreDirEnt (OFile, DirEnt);\r
425 if (EFI_ERROR (Status)) {\r
426 return Status;\r
427 }\r
428 }\r
429 }\r
bcdcc416 430\r
b9ec9330
QH
431 //\r
432 // If the file is renamed, we should append the ARCHIVE attribute\r
433 //\r
434 OFile->Archive = TRUE;\r
435 } else if (Parent != OFile) {\r
436 //\r
437 // filename is to a different filename that already exists\r
438 //\r
439 return EFI_ACCESS_DENIED;\r
440 }\r
bcdcc416 441\r
b9ec9330
QH
442 //\r
443 // If the file size has changed, apply it\r
444 //\r
445 if (NewInfo->FileSize != OFile->FileSize) {\r
bcdcc416 446 if ((OFile->ODir != NULL) || ReadOnly) {\r
b9ec9330
QH
447 //\r
448 // If this is a directory or the file is read only, we can't change the file size\r
449 //\r
450 return EFI_ACCESS_DENIED;\r
451 }\r
452\r
453 if (NewInfo->FileSize > OFile->FileSize) {\r
454 Status = FatExpandOFile (OFile, NewInfo->FileSize);\r
455 } else {\r
bcdcc416 456 Status = FatTruncateOFile (OFile, (UINTN)NewInfo->FileSize);\r
b9ec9330
QH
457 }\r
458\r
459 if (EFI_ERROR (Status)) {\r
460 return Status;\r
461 }\r
462\r
463 FatUpdateDirEntClusterSizeInfo (OFile);\r
464 }\r
465\r
466 OFile->Dirty = TRUE;\r
467 return FatOFileFlush (OFile);\r
468}\r
469\r
cae7420b
DB
470/**\r
471\r
472 Set or Get the some types info of the file into Buffer.\r
473\r
474 @param IsSet - TRUE:The access is set, else is get\r
475 @param FHand - The handle of file\r
476 @param Type - The type of the info\r
477 @param BufferSize - Size of Buffer\r
478 @param Buffer - Buffer containing volume info\r
479\r
480 @retval EFI_SUCCESS - Get the info successfully\r
481 @retval EFI_DEVICE_ERROR - Can not find the OFile for the file\r
482\r
483**/\r
b9ec9330
QH
484EFI_STATUS\r
485FatSetOrGetInfo (\r
dba03ba1
QH
486 IN BOOLEAN IsSet,\r
487 IN EFI_FILE_PROTOCOL *FHand,\r
488 IN EFI_GUID *Type,\r
489 IN OUT UINTN *BufferSize,\r
490 IN OUT VOID *Buffer\r
b9ec9330 491 )\r
b9ec9330
QH
492{\r
493 FAT_IFILE *IFile;\r
494 FAT_OFILE *OFile;\r
495 FAT_VOLUME *Volume;\r
496 EFI_STATUS Status;\r
497\r
bcdcc416
MK
498 IFile = IFILE_FROM_FHAND (FHand);\r
499 OFile = IFile->OFile;\r
500 Volume = OFile->Volume;\r
b9ec9330 501\r
bcdcc416 502 Status = OFile->Error;\r
b9ec9330
QH
503 if (Status == EFI_NOT_FOUND) {\r
504 return EFI_DEVICE_ERROR;\r
505 }\r
506\r
149d6335
RN
507 FatWaitNonblockingTask (IFile);\r
508\r
b9ec9330
QH
509 FatAcquireLock ();\r
510\r
511 //\r
512 // Verify the file handle isn't in an error state\r
513 //\r
514 if (!EFI_ERROR (Status)) {\r
515 //\r
516 // Get the proper information based on the request\r
517 //\r
518 Status = EFI_UNSUPPORTED;\r
519 if (IsSet) {\r
55248f85
RN
520 if (CompareGuid (Type, &gEfiFileInfoGuid)) {\r
521 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);\r
522 }\r
b9ec9330 523\r
55248f85
RN
524 if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {\r
525 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeInfo (Volume, *BufferSize, Buffer);\r
526 }\r
b9ec9330 527\r
55248f85
RN
528 if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {\r
529 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);\r
b9ec9330
QH
530 }\r
531 } else {\r
532 if (CompareGuid (Type, &gEfiFileInfoGuid)) {\r
533 Status = FatGetFileInfo (OFile, BufferSize, Buffer);\r
534 }\r
535\r
536 if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {\r
537 Status = FatGetVolumeInfo (Volume, BufferSize, Buffer);\r
538 }\r
539\r
540 if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {\r
541 Status = FatGetVolumeLabelInfo (Volume, BufferSize, Buffer);\r
542 }\r
543 }\r
544 }\r
545\r
149d6335 546 Status = FatCleanupVolume (Volume, NULL, Status, NULL);\r
b9ec9330
QH
547\r
548 FatReleaseLock ();\r
549 return Status;\r
550}\r
551\r
cae7420b
DB
552/**\r
553\r
554 Get the some types info of the file into Buffer.\r
555\r
556 @param FHand - The handle of file.\r
557 @param Type - The type of the info.\r
558 @param BufferSize - Size of Buffer.\r
559 @param Buffer - Buffer containing volume info.\r
560\r
561 @retval EFI_SUCCESS - Get the info successfully.\r
562 @retval EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
563\r
564**/\r
b9ec9330
QH
565EFI_STATUS\r
566EFIAPI\r
567FatGetInfo (\r
bcdcc416
MK
568 IN EFI_FILE_PROTOCOL *FHand,\r
569 IN EFI_GUID *Type,\r
570 IN OUT UINTN *BufferSize,\r
571 OUT VOID *Buffer\r
b9ec9330 572 )\r
cae7420b
DB
573{\r
574 return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);\r
575}\r
b9ec9330 576\r
cae7420b 577/**\r
b9ec9330 578\r
cae7420b 579 Set the some types info of the file into Buffer.\r
b9ec9330 580\r
cae7420b
DB
581 @param FHand - The handle of file.\r
582 @param Type - The type of the info.\r
583 @param BufferSize - Size of Buffer\r
584 @param Buffer - Buffer containing volume info.\r
b9ec9330 585\r
cae7420b
DB
586 @retval EFI_SUCCESS - Set the info successfully.\r
587 @retval EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
b9ec9330 588\r
cae7420b 589**/\r
b9ec9330
QH
590EFI_STATUS\r
591EFIAPI\r
592FatSetInfo (\r
dba03ba1
QH
593 IN EFI_FILE_PROTOCOL *FHand,\r
594 IN EFI_GUID *Type,\r
595 IN UINTN BufferSize,\r
596 IN VOID *Buffer\r
b9ec9330 597 )\r
b9ec9330
QH
598{\r
599 return FatSetOrGetInfo (TRUE, FHand, Type, &BufferSize, Buffer);\r
600}\r