Skip to content

Commit 8d95204

Browse files
committed
Added EFI_FILE_PROTOCOL Flush() dummy implementation
The ext4 driver implements EFI_FILE_PROTOCOL_REVISION but was missing the required Flush() function. According to UEFI Specification v2.10, Section 13.5 (File Protocol), all protocol functions must be implemented. Changes: - Adds minimal Flush() function implementation Signed-off-by: Pavel Naberezhnev <[email protected]>
1 parent de66778 commit 8d95204

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

Ext4Pkg/Ext4Dxe/Ext4Dxe.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,27 @@ Ext4WriteFile (
715715
IN VOID *Buffer
716716
);
717717

718+
/**
719+
Flushes all modified data associated with a file to a device
720+
721+
@param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
722+
handle to flush data.
723+
724+
@retval EFI_SUCCESS The data was flushed.
725+
@retval EFI_NO_MEDIA The device has no medium.
726+
@retval EFI_DEVICE_ERROR The device reported an error.
727+
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
728+
@retval EFI_WRITE_PROTECTED The file or medium is write-protected.
729+
@retval EFI_ACCESS_DENIED The file was opened read only.
730+
@retval EFI_VOLUME_FULL The volume is full.
731+
732+
**/
733+
EFI_STATUS
734+
EFIAPI
735+
Ext4Flush (
736+
IN EFI_FILE_PROTOCOL *This
737+
);
738+
718739
/**
719740
Returns a file's current position.
720741

Ext4Pkg/Ext4Dxe/File.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,37 @@ Ext4WriteFile (
555555
return EFI_WRITE_PROTECTED;
556556
}
557557

558+
/**
559+
Flushes all modified data associated with a file to a device
560+
561+
@param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
562+
handle to flush data.
563+
564+
@retval EFI_SUCCESS The data was flushed.
565+
@retval EFI_NO_MEDIA The device has no medium.
566+
@retval EFI_DEVICE_ERROR The device reported an error.
567+
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
568+
@retval EFI_WRITE_PROTECTED The file or medium is write-protected.
569+
@retval EFI_ACCESS_DENIED The file was opened read only.
570+
@retval EFI_VOLUME_FULL The volume is full.
571+
572+
**/
573+
EFI_STATUS
574+
EFIAPI
575+
Ext4Flush (
576+
IN EFI_FILE_PROTOCOL *This
577+
)
578+
{
579+
EXT4_FILE *File;
580+
581+
File = EXT4_FILE_FROM_THIS (This);
582+
if (!(File->OpenMode & EFI_FILE_MODE_WRITE)) {
583+
return EFI_ACCESS_DENIED;
584+
}
585+
586+
return EFI_WRITE_PROTECTED;
587+
}
588+
558589
/**
559590
Returns a file's current position.
560591

Ext4Pkg/Ext4Dxe/Partition.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Ext4SetupFile (
8989
File->Protocol.GetPosition = Ext4GetPosition;
9090
File->Protocol.GetInfo = Ext4GetInfo;
9191
File->Protocol.SetInfo = Ext4SetInfo;
92+
File->Protocol.Flush = Ext4Flush;
9293

9394
File->Partition = Partition;
9495
}

0 commit comments

Comments
 (0)