@@ -22,16 +22,19 @@ pub struct DiskIo(DiskIoProtocol);
22
22
impl DiskIo {
23
23
/// Reads bytes from the disk device.
24
24
///
25
- /// # Arguments:
26
- /// * `media_id` - ID of the medium to be read.
27
- /// * `offset` - Starting byte offset on the logical block I/O device to read from.
28
- /// * `buffer` - Pointer to a buffer to read into.
25
+ /// # Arguments
26
+ /// * `media_id`: ID of the medium to be read.
27
+ /// * `offset`: Starting byte offset on the logical block I/O device to read from.
28
+ /// * `buffer`: Pointer to a buffer to read into.
29
29
///
30
- /// # Errors:
31
- /// * [`Status::INVALID_PARAMETER`] The read request contains device addresses that are not valid for the device.
32
- /// * [`Status::DEVICE_ERROR`] The device reported an error while performing the read operation.
33
- /// * [`Status::NO_MEDIA`] There is no medium in the device.
34
- /// * [`Status::MEDIA_CHANGED`] `media_id` is not for the current medium.
30
+ /// # Errors
31
+ /// * [`Status::INVALID_PARAMETER`] when the read request contains device
32
+ /// addresses that are not valid for the device.
33
+ /// * [`Status::DEVICE_ERROR`] when the device reported an error while
34
+ /// performing the read operation.
35
+ /// * [`Status::NO_MEDIA`] when there is no medium in the device.
36
+ /// * [`Status::MEDIA_CHANGED`] when `media_id` is not for the current
37
+ /// medium.
35
38
pub fn read_disk ( & self , media_id : u32 , offset : u64 , buffer : & mut [ u8 ] ) -> Result {
36
39
unsafe {
37
40
( self . 0 . read_disk ) (
@@ -47,17 +50,20 @@ impl DiskIo {
47
50
48
51
/// Writes bytes to the disk device.
49
52
///
50
- /// # Arguments:
51
- /// * `media_id` - ID of the medium to be written.
52
- /// * `offset` - Starting byte offset on the logical block I/O device to write to.
53
- /// * `buffer` - Pointer to a buffer to write from.
53
+ /// # Arguments
54
+ /// * `media_id`: ID of the medium to be written.
55
+ /// * `offset`: Starting byte offset on the logical block I/O device to write to.
56
+ /// * `buffer`: Pointer to a buffer to write from.
54
57
///
55
- /// # Errors:
56
- /// * [`Status::INVALID_PARAMETER`] The write request contains device addresses that are not valid for the device.
57
- /// * [`Status::DEVICE_ERROR`] The device reported an error while performing the write operation.
58
- /// * [`Status::NO_MEDIA`] There is no medium in the device.
59
- /// * [`Status::MEDIA_CHANGED`] `media_id` is not for the current medium.
60
- /// * [`Status::WRITE_PROTECTED`] The device cannot be written to.
58
+ /// # Errors
59
+ /// * [`Status::INVALID_PARAMETER`] when the write request contains device
60
+ /// addresses that are not valid for the device.
61
+ /// * [`Status::DEVICE_ERROR`] when the device reported an error while
62
+ /// performing the write operation.
63
+ /// * [`Status::NO_MEDIA`] when there is no medium in the device.
64
+ /// * [`Status::MEDIA_CHANGED`] then `media_id` is not for the current
65
+ /// medium.
66
+ /// * [`Status::WRITE_PROTECTED`] when the device cannot be written to.
61
67
pub fn write_disk ( & mut self , media_id : u32 , offset : u64 , buffer : & [ u8 ] ) -> Result {
62
68
unsafe {
63
69
( self . 0 . write_disk ) (
@@ -94,32 +100,36 @@ pub struct DiskIo2(DiskIo2Protocol);
94
100
impl DiskIo2 {
95
101
/// Terminates outstanding asynchronous requests to the device.
96
102
///
97
- /// # Errors:
103
+ /// # Errors
98
104
/// * [`Status::DEVICE_ERROR`] The device reported an error while performing
99
105
pub fn cancel ( & mut self ) -> Result {
100
106
unsafe { ( self . 0 . cancel ) ( & mut self . 0 ) } . to_result ( )
101
107
}
102
108
103
109
/// Reads bytes from the disk device.
104
110
///
105
- /// # Arguments:
106
- /// * `media_id` - ID of the medium to be read from.
107
- /// * `offset` - Starting byte offset on the logical block I/O device to read from.
108
- /// * `token` - Transaction token for asynchronous read.
109
- /// * `len` - Buffer size.
110
- /// * `buffer` - Buffer to read into.
111
+ /// # Arguments
112
+ /// * `media_id`: ID of the medium to be read from.
113
+ /// * `offset`: Starting byte offset on the logical block I/O device to read from.
114
+ /// * `token`: Transaction token for asynchronous read.
115
+ /// * `len`: Buffer size.
116
+ /// * `buffer`: Buffer to read into.
111
117
///
112
118
/// # Safety
113
119
///
114
120
/// Because of the asynchronous nature of the disk transaction, manual lifetime
115
121
/// tracking is required.
116
122
///
117
- /// # Errors:
118
- /// * [`Status::INVALID_PARAMETER`] The read request contains device addresses that are not valid for the device.
119
- /// * [`Status::OUT_OF_RESOURCES`] The request could not be completed due to a lack of resources.
120
- /// * [`Status::MEDIA_CHANGED`] `media_id` is not for the current medium.
121
- /// * [`Status::NO_MEDIA`] There is no medium in the device.
122
- /// * [`Status::DEVICE_ERROR`] The device reported an error while performing the read operation.
123
+ /// # Errors
124
+ /// * [`Status::INVALID_PARAMETER`] when the read request contains device
125
+ /// addresses that are not valid for the device.
126
+ /// * [`Status::OUT_OF_RESOURCES`] when the request could not be completed
127
+ /// due to a lack of resources.
128
+ /// * [`Status::MEDIA_CHANGED`] when `media_id` is not for the current
129
+ /// medium.
130
+ /// * [`Status::NO_MEDIA`] when there is no medium in the device.
131
+ /// * [`Status::DEVICE_ERROR`] when the device reported an error while
132
+ /// performing the read operation.
123
133
pub unsafe fn read_disk_raw (
124
134
& self ,
125
135
media_id : u32 ,
@@ -137,25 +147,29 @@ impl DiskIo2 {
137
147
138
148
/// Writes bytes to the disk device.
139
149
///
140
- /// # Arguments:
141
- /// * `media_id` - ID of the medium to write to.
142
- /// * `offset` - Starting byte offset on the logical block I/O device to write to.
143
- /// * `token` - Transaction token for asynchronous write.
144
- /// * `len` - Buffer size.
145
- /// * `buffer` - Buffer to write from.
150
+ /// # Arguments
151
+ /// * `media_id`: ID of the medium to write to.
152
+ /// * `offset`: Starting byte offset on the logical block I/O device to write to.
153
+ /// * `token`: Transaction token for asynchronous write.
154
+ /// * `len`: Buffer size.
155
+ /// * `buffer`: Buffer to write from.
146
156
///
147
157
/// # Safety
148
158
///
149
159
/// Because of the asynchronous nature of the disk transaction, manual lifetime
150
160
/// tracking is required.
151
161
///
152
- /// # Errors:
153
- /// * [`Status::INVALID_PARAMETER`] The write request contains device addresses that are not valid for the device.
154
- /// * [`Status::OUT_OF_RESOURCES`] The request could not be completed due to a lack of resources.
155
- /// * [`Status::MEDIA_CHANGED` `media_id` is not for the current medium.
156
- /// * [`Status::NO_MEDIA`] There is no medium in the device.
157
- /// * [`Status::DEVICE_ERROR`] The device reported an error while performing the write operation.
158
- /// * [`Status::WRITE_PROTECTED`] The device cannot be written to.
162
+ /// # Errors
163
+ /// * [`Status::INVALID_PARAMETER`] when the write request contains device
164
+ /// addresses that are not valid for the device.
165
+ /// * [`Status::OUT_OF_RESOURCES`] when the request could not be completed
166
+ /// due to a lack of resources.
167
+ /// * [`Status::MEDIA_CHANGED`] when `media_id` is not for the current
168
+ /// medium.
169
+ /// * [`Status::NO_MEDIA`] when there is no medium in the device.
170
+ /// * [`Status::DEVICE_ERROR`] when the device reported an error while
171
+ /// performing the write operation.
172
+ /// * [`Status::WRITE_PROTECTED`] when the device cannot be written to.
159
173
pub unsafe fn write_disk_raw (
160
174
& mut self ,
161
175
media_id : u32 ,
@@ -180,15 +194,18 @@ impl DiskIo2 {
180
194
181
195
/// Flushes all modified data to the physical device.
182
196
///
183
- /// # Arguments:
184
- /// * `token` - Transaction token for the asynchronous flush.
197
+ /// # Arguments
198
+ /// * `token`: Transaction token for the asynchronous flush.
185
199
///
186
- /// # Errors:
187
- /// * [`Status::OUT_OF_RESOURCES`] The request could not be completed due to a lack of resources.
188
- /// * [`Status::MEDIA_CHANGED`] The medium in the device has changed since the last access.
189
- /// * [`Status::NO_MEDIA`] There is no medium in the device.
190
- /// * [`Status::DEVICE_ERROR`] The device reported an error while performing the flush operation.
191
- /// * [`Status::WRITE_PROTECTED`] The device cannot be written to.
200
+ /// # Errors
201
+ /// * [`Status::OUT_OF_RESOURCES`] when the request could not be completed
202
+ /// due to a lack of resources.
203
+ /// * [`Status::MEDIA_CHANGED`] when the medium in the device has changed
204
+ /// since the last access.
205
+ /// * [`Status::NO_MEDIA`] when there is no medium in the device.
206
+ /// * [`Status::DEVICE_ERROR`] when the device reported an error while
207
+ /// performing the flush operation.
208
+ /// * [`Status::WRITE_PROTECTED`] when the device cannot be written to.
192
209
pub fn flush_disk ( & mut self , token : Option < NonNull < DiskIo2Token > > ) -> Result {
193
210
let token = opt_nonnull_to_ptr ( token) ;
194
211
unsafe { ( self . 0 . flush_disk_ex ) ( & mut self . 0 , token. cast ( ) ) } . to_result ( )
0 commit comments