Skip to content

Commit 76ff029

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 b88b3a6 commit 76ff029

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
@@ -557,6 +557,37 @@ Ext4WriteFile (
557557
return EFI_WRITE_PROTECTED;
558558
}
559559

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

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)