@@ -10,8 +10,8 @@ use std::ptr::{null, null_mut};
10
10
use sys:: signal:: * ;
11
11
use sys:: time:: TimeSpec ;
12
12
13
- /// Mode for `aio_fsync `. Controls whether only data or both data and metadata
14
- /// are synced.
13
+ /// Mode for `AioCb::fsync `. Controls whether only data or both data and
14
+ /// metadata are synced.
15
15
#[ repr( i32 ) ]
16
16
#[ derive( Clone , Copy , Debug , PartialEq ) ]
17
17
pub enum AioFsyncMode {
@@ -46,14 +46,14 @@ pub enum LioMode {
46
46
LIO_NOWAIT = libc:: LIO_NOWAIT ,
47
47
}
48
48
49
- /// Return values for `aio_cancel `
49
+ /// Return values for `AioCb::cancel and aio_cancel_all `
50
50
#[ repr( i32 ) ]
51
51
#[ derive( Clone , Copy , Debug , PartialEq ) ]
52
52
pub enum AioCancelStat {
53
53
/// All outstanding requests were canceled
54
54
AioCanceled = libc:: AIO_CANCELED ,
55
55
/// Some requests were not canceled. Their status should be checked with
56
- /// `aio_error `
56
+ /// `AioCb::error `
57
57
AioNotCanceled = libc:: AIO_NOTCANCELED ,
58
58
/// All of the requests have already finished
59
59
AioAllDone = libc:: AIO_ALLDONE ,
@@ -73,7 +73,7 @@ pub struct AioCb<'a> {
73
73
impl < ' a > AioCb < ' a > {
74
74
/// Constructs a new `AioCb` with no associated buffer.
75
75
///
76
- /// The resulting `AioCb` structure is suitable for use with `aio_fsync `.
76
+ /// The resulting `AioCb` structure is suitable for use with `AioCb::fsync `.
77
77
/// * `fd` File descriptor. Required for all aio functions.
78
78
/// * `prio` If POSIX Prioritized IO is supported, then the operation will
79
79
/// be prioritized at the process's priority level minus `prio`
@@ -122,15 +122,15 @@ impl<'a> AioCb<'a> {
122
122
/// mutable slices.
123
123
///
124
124
/// An `AioCb` created this way cannot be used with `read`, and its
125
- /// `LioOpcode` cannot be set to `LIO_READ`. This method is useful when writing a
126
- /// const buffer with `aio_write `, since from_mut_slice can't work with const
127
- /// buffers.
125
+ /// `LioOpcode` cannot be set to `LIO_READ`. This method is useful when
126
+ /// writing a const buffer with `AioCb::write `, since from_mut_slice can't
127
+ /// work with const buffers.
128
128
// Note: another solution to the problem of writing const buffers would be
129
- // to genericize AioCb for both &mut [u8] and &[u8] buffers. aio_read could
130
- // take the former and aio_write could take the latter. However, then
131
- // lio_listio wouldn't work, because that function needs a slice of AioCb,
132
- // and they must all be the same type. We're basically stuck with using an
133
- // unsafe function, since aio (as designed in C) is an unsafe API.
129
+ // to genericize AioCb for both &mut [u8] and &[u8] buffers. AioCb::read
130
+ // could take the former and AioCb::write could take the latter. However,
131
+ // then lio_listio wouldn't work, because that function needs a slice of
132
+ // AioCb, and they must all be the same type. We're basically stuck with
133
+ // using an unsafe function, since aio (as designed in C) is an unsafe API.
134
134
pub fn from_slice ( fd : RawFd , offs : off_t , buf : & ' a [ u8 ] ,
135
135
prio : :: c_int , sigev_notify : SigevNotify ,
136
136
opcode : LioOpcode ) -> AioCb {
@@ -175,9 +175,9 @@ impl<'a> AioCb<'a> {
175
175
}
176
176
}
177
177
178
- /// Retrieve error status of an asynchronous operation. If the request has not
179
- /// yet completed, returns `EINPROGRESS`. Otherwise, returns `Ok` or any other
180
- /// error.
178
+ /// Retrieve error status of an asynchronous operation. If the request has
179
+ /// not yet completed, returns `EINPROGRESS`. Otherwise, returns `Ok` or
180
+ /// any other error.
181
181
pub fn error ( & mut self ) -> Result < ( ) > {
182
182
match unsafe { libc:: aio_error ( & mut self . aiocb as * mut libc:: aiocb ) } {
183
183
0 => Ok ( ( ) ) ,
@@ -202,9 +202,9 @@ impl<'a> AioCb<'a> {
202
202
Errno :: result ( unsafe { libc:: aio_read ( p) } ) . map ( drop)
203
203
}
204
204
205
- /// Retrieve return status of an asynchronous operation. Should only be called
206
- /// once for each `AioCb`, after `aio_error ` indicates that it has completed.
207
- /// The result the same as for `read`, `write`, of `fsync`.
205
+ /// Retrieve return status of an asynchronous operation. Should only be
206
+ /// called once for each `AioCb`, after `AioCb::error ` indicates that it has
207
+ /// completed. The result is the same as for `read`, `write`, of `fsync`.
208
208
// Note: this should be just `return`, but that's a reserved word
209
209
pub fn aio_return ( & mut self ) -> Result < isize > {
210
210
let p: * mut libc:: aiocb = & mut self . aiocb ;
0 commit comments