@@ -22,16 +22,19 @@ pub struct DiskIo(DiskIoProtocol);
2222impl DiskIo {
2323 /// Reads bytes from the disk device.
2424 ///
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.
2929 ///
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.
3538 pub fn read_disk(&self, media_id: u32, offset: u64, buffer: &mut [u8]) -> Result {
3639 unsafe {
3740 (self.0.read_disk)(
@@ -47,17 +50,20 @@ impl DiskIo {
4750
4851 /// Writes bytes to the disk device.
4952 ///
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.
5457 ///
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.
6167 pub fn write_disk(&mut self, media_id: u32, offset: u64, buffer: &[u8]) -> Result {
6268 unsafe {
6369 (self.0.write_disk)(
@@ -94,32 +100,36 @@ pub struct DiskIo2(DiskIo2Protocol);
94100impl DiskIo2 {
95101 /// Terminates outstanding asynchronous requests to the device.
96102 ///
97- /// # Errors:
103+ /// # Errors
98104 /// * [`Status::DEVICE_ERROR`] The device reported an error while performing
99105 pub fn cancel(&mut self) -> Result {
100106 unsafe { (self.0.cancel)(&mut self.0) }.to_result()
101107 }
102108
103109 /// Reads bytes from the disk device.
104110 ///
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.
111117 ///
112118 /// # Safety
113119 ///
114120 /// Because of the asynchronous nature of the disk transaction, manual lifetime
115121 /// tracking is required.
116122 ///
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.
123133 pub unsafe fn read_disk_raw(
124134 &self,
125135 media_id: u32,
@@ -137,25 +147,29 @@ impl DiskIo2 {
137147
138148 /// Writes bytes to the disk device.
139149 ///
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.
146156 ///
147157 /// # Safety
148158 ///
149159 /// Because of the asynchronous nature of the disk transaction, manual lifetime
150160 /// tracking is required.
151161 ///
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.
159173 pub unsafe fn write_disk_raw(
160174 &mut self,
161175 media_id: u32,
@@ -180,15 +194,18 @@ impl DiskIo2 {
180194
181195 /// Flushes all modified data to the physical device.
182196 ///
183- /// # Arguments:
184- /// * `token` - Transaction token for the asynchronous flush.
197+ /// # Arguments
198+ /// * `token`: Transaction token for the asynchronous flush.
185199 ///
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.
192209 pub fn flush_disk(&mut self, token: Option<NonNull<DiskIo2Token>>) -> Result {
193210 let token = opt_nonnull_to_ptr(token);
194211 unsafe { (self.0.flush_disk_ex)(&mut self.0, token.cast()) }.to_result()
0 commit comments