Skip to main content

linux_aio_tokio/
flags.rs

1use bitflags::bitflags;
2
3use crate::aio;
4
5bitflags! {
6    #[derive(Debug)]
7    /// AIO write flags. See [`io_submit`](http://man7.org/linux/man-pages/man2/io_submit.2.html)
8    pub struct WriteFlags: isize {
9        /// Append data to the end of the file.  See the description
10        /// of the flag of the same name in [`pwritev2(2)`] as well as
11        /// the description of O_APPEND in [`open(2)`].  The aio_offset
12        /// field is ignored.  The file offset is not changed.
13        ///
14        /// [`pwritev2(2)`]: http://man7.org/linux/man-pages/man2/pwritev2.2.html
15        /// [`open(2)`]: http://man7.org/linux/man-pages/man2/open.2.html
16        const APPEND = aio::RWF_APPEND as isize;
17
18        /// Write operation complete according to requirement of
19        /// synchronized I/O data integrity.  See the description
20        /// of the flag of the same name in [`pwritev2(2)`] as well the
21        /// description of `O_DSYNC` in [`open(2)`].
22        ///
23        /// [`pwritev2(2)`]: http://man7.org/linux/man-pages/man2/pwritev2.2.html
24        /// [`open(2)`]: http://man7.org/linux/man-pages/man2/open.2.html
25        const DSYNC = aio::RWF_DSYNC as isize;
26
27        /// High priority request, poll if possible
28        const HIPRI = aio::RWF_HIPRI as isize;
29
30        /// Don't wait if the I/O will block for operations such as
31        /// file block allocations, dirty page flush, mutex locks,
32        /// or a congested block device inside the kernel.  If any
33        /// of these conditions are met, the control block is
34        /// returned immediately with a return value of `-EAGAIN` in
35        /// the res field of the io_event structure.
36        const NOWAIT = aio::RWF_NOWAIT as isize;
37
38        /// Write operation complete according to requirement of
39        /// synchronized I/O file integrity.  See the description
40        /// of the flag of the same name in [`pwritev2(2)`] as well the
41        /// description of `O_SYNC` in [`open(2)`].
42        ///
43        /// [`pwritev2(2)`]: http://man7.org/linux/man-pages/man2/pwritev2.2.html
44        /// [`open(2)`]: http://man7.org/linux/man-pages/man2/open.2.html
45        const SYNC = aio::RWF_SYNC as isize;
46    }
47}
48
49bitflags! {
50    #[derive(Debug)]
51    /// AIO read flags. See [`io_submit`](http://man7.org/linux/man-pages/man2/io_submit.2.html)
52    pub struct ReadFlags: isize {
53        /// High priority request, poll if possible
54        const HIPRI = aio::RWF_HIPRI as isize;
55
56        /// Don't wait if the I/O will block for operations such as
57        /// file block allocations, dirty page flush, mutex locks,
58        /// or a congested block device inside the kernel.  If any
59        /// of these conditions are met, the control block is
60        /// returned immediately with a return value of `-EAGAIN` in
61        /// the res field of the io_event structure.
62        const NOWAIT = aio::RWF_NOWAIT as isize;
63    }
64}