@@ -41,16 +41,27 @@ pub trait File: Sized {
41
41
/// * `attributes` Only valid when `FILE_MODE_CREATE` is used as a mode
42
42
///
43
43
/// # Errors
44
- /// * `uefi::Status::INVALID_PARAMETER` The filename exceeds the maximum length of 255 chars
45
- /// * `uefi::Status::NOT_FOUND` Could not find file
46
- /// * `uefi::Status::NO_MEDIA` The device has no media
47
- /// * `uefi::Status::MEDIA_CHANGED` The device has a different medium in it
48
- /// * `uefi::Status::DEVICE_ERROR` The device reported an error
49
- /// * `uefi::Status::VOLUME_CORRUPTED` The filesystem structures are corrupted
50
- /// * `uefi::Status::WRITE_PROTECTED` Write/Create attempted on readonly file
51
- /// * `uefi::Status::ACCESS_DENIED` The service denied access to the file
52
- /// * `uefi::Status::OUT_OF_RESOURCES` Not enough resources to open file
53
- /// * `uefi::Status::VOLUME_FULL` The volume is full
44
+ ///
45
+ /// See section `EFI_FILE_PROTOCOL.Open()` in the UEFI Specification for more details.
46
+ ///
47
+ /// ## Note
48
+ ///
49
+ /// Although [`INVALID_PARAMETER`] is not defined as an error in the UEFI Specification,
50
+ /// it can be returned if the opened filename exceeds the maximum length of 255 UCS-2
51
+ /// characters (not including the null terminator).
52
+ ///
53
+ /// [`INVALID_PARAMETER`]: uefi::Status::INVALID_PARAMETER
54
+ ///
55
+ /// * [`uefi::Status::INVALID_PARAMETER`]
56
+ /// * [`uefi::Status::NOT_FOUND`]
57
+ /// * [`uefi::Status::NO_MEDIA`]
58
+ /// * [`uefi::Status::MEDIA_CHANGED`]
59
+ /// * [`uefi::Status::DEVICE_ERROR`]
60
+ /// * [`uefi::Status::VOLUME_CORRUPTED`]
61
+ /// * [`uefi::Status::WRITE_PROTECTED`]
62
+ /// * [`uefi::Status::ACCESS_DENIED`]
63
+ /// * [`uefi::Status::OUT_OF_RESOURCES`]
64
+ /// * [`uefi::Status::VOLUME_FULL`]
54
65
fn open (
55
66
& mut self ,
56
67
filename : & CStr16 ,
@@ -77,7 +88,10 @@ pub trait File: Sized {
77
88
/// Closes and deletes this file
78
89
///
79
90
/// # Warnings
80
- /// * `uefi::Status::WARN_DELETE_FAILURE` The file was closed, but deletion failed
91
+ ///
92
+ /// See section `EFI_FILE_PROTOCOL.Delete()` in the UEFI Specification for more details.
93
+ ///
94
+ /// * [`uefi::Status::WARN_DELETE_FAILURE`]
81
95
fn delete ( mut self ) -> Result {
82
96
let result = ( self . imp ( ) . delete ) ( self . imp ( ) ) . into ( ) ;
83
97
mem:: forget ( self ) ;
@@ -95,11 +109,14 @@ pub trait File: Sized {
95
109
/// * `buffer` Buffer that the information should be written into
96
110
///
97
111
/// # Errors
98
- /// * `uefi::Status::UNSUPPORTED` The file does not possess this information type
99
- /// * `uefi::Status::NO_MEDIA` The device has no medium
100
- /// * `uefi::Status::DEVICE_ERROR` The device reported an error
101
- /// * `uefi::Status::VOLUME_CORRUPTED` The file system structures are corrupted
102
- /// * `uefi::Status::BUFFER_TOO_SMALL` The buffer is too small for the requested
112
+ ///
113
+ /// See section `EFI_FILE_PROTOCOL.GetInfo()` in the UEFI Specification for more details.
114
+ ///
115
+ /// * [`uefi::Status::UNSUPPORTED`]
116
+ /// * [`uefi::Status::NO_MEDIA`]
117
+ /// * [`uefi::Status::DEVICE_ERROR`]
118
+ /// * [`uefi::Status::VOLUME_CORRUPTED`]
119
+ /// * [`uefi::Status::BUFFER_TOO_SMALL`]
103
120
fn get_info < ' buf , Info : FileProtocolInfo + ?Sized > (
104
121
& mut self ,
105
122
buffer : & ' buf mut [ u8 ] ,
@@ -137,13 +154,17 @@ pub trait File: Sized {
137
154
/// * `info` Info that should be set for the file
138
155
///
139
156
/// # Errors
140
- /// * `uefi::Status::UNSUPPORTED` The file does not possess this information type
141
- /// * `uefi::Status::NO_MEDIA` The device has no medium
142
- /// * `uefi::Status::DEVICE_ERROR` The device reported an error
143
- /// * `uefi::Status::VOLUME_CORRUPTED` The file system structures are corrupted
144
- /// * `uefi::Status::WRITE_PROTECTED` Attempted to set information on a read-only media
145
- /// * `uefi::Status::ACCESS_DENIED` Requested change is invalid for this information type
146
- /// * `uefi::Status::VOLUME_FULL` Not enough space left on the volume to change the info
157
+ ///
158
+ /// See section `EFI_FILE_PROTOCOL.SetInfo()` in the UEFI Specification for more details.
159
+ ///
160
+ /// * [`uefi::Status::UNSUPPORTED`]
161
+ /// * [`uefi::Status::NO_MEDIA`]
162
+ /// * [`uefi::Status::DEVICE_ERROR`]
163
+ /// * [`uefi::Status::VOLUME_CORRUPTED`]
164
+ /// * [`uefi::Status::WRITE_PROTECTED`]
165
+ /// * [`uefi::Status::ACCESS_DENIED`]
166
+ /// * [`uefi::Status::VOLUME_FULL`]
167
+ /// * [`uefi::Status::BAD_BUFFER_SIZE`]
147
168
fn set_info < Info : FileProtocolInfo + ?Sized > ( & mut self , info : & Info ) -> Result {
148
169
let info_ptr = ( info as * const Info ) . cast :: < c_void > ( ) ;
149
170
let info_size = mem:: size_of_val ( & info) ;
@@ -153,12 +174,15 @@ pub trait File: Sized {
153
174
/// Flushes all modified data associated with the file handle to the device
154
175
///
155
176
/// # Errors
156
- /// * `uefi::Status::NO_MEDIA` The device has no media
157
- /// * `uefi::Status::DEVICE_ERROR` The device reported an error
158
- /// * `uefi::Status::VOLUME_CORRUPTED` The filesystem structures are corrupted
159
- /// * `uefi::Status::WRITE_PROTECTED` The file or medium is write protected
160
- /// * `uefi::Status::ACCESS_DENIED` The file was opened read only
161
- /// * `uefi::Status::VOLUME_FULL` The volume is full
177
+ ///
178
+ /// See section `EFI_FILE_PROTOCOL.Flush()` in the UEFI Specification for more details.
179
+ ///
180
+ /// * [`uefi::Status::NO_MEDIA`]
181
+ /// * [`uefi::Status::DEVICE_ERROR`]
182
+ /// * [`uefi::Status::VOLUME_CORRUPTED`]
183
+ /// * [`uefi::Status::WRITE_PROTECTED`]
184
+ /// * [`uefi::Status::ACCESS_DENIED`]
185
+ /// * [`uefi::Status::VOLUME_FULL`]
162
186
fn flush ( & mut self ) -> Result {
163
187
( self . imp ( ) . flush ) ( self . imp ( ) ) . into ( )
164
188
}
0 commit comments