Skip to content

Commit 902191e

Browse files
committed
Doc fix and fix double subtraction of offset
1 parent 7f3ac33 commit 902191e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tokio/src/fs/read.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ use std::{io, path::Path};
3030
///
3131
/// [`ErrorKind::Interrupted`]: std::io::ErrorKind::Interrupted
3232
///
33+
/// # io_uring support
34+
///
35+
/// On Linux, you can also use io_uring for executing system calls. To enable
36+
/// io_uring, you need to specify the --cfg tokio_unstable flag at compile time,
37+
/// enable the io-uring cargo feature, and set the Builder::enable_io_uring
38+
/// runtime option.
39+
///
40+
/// Support for io_uring is currently experimental, so its behavior may change
41+
/// or it may be removed in future versions.
42+
///
3343
/// # Examples
3444
///
3545
/// ```no_run

tokio/src/fs/read_uring.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub(crate) async fn read_uring(path: &Path) -> io::Result<Vec<u8>> {
2727
.expect("unexpected in-flight operation detected")
2828
.into();
2929

30-
// extra single capacity for the whole size to fit without any reallocation
3130
let mut buf = Vec::new();
3231

3332
if let Some(size_hint) = size_hint {
@@ -71,7 +70,6 @@ async fn read_to_end_uring(
7170

7271
buf = r_buf;
7372
fd = r_fd;
74-
offset += size_read as u64;
7573
}
7674

7775
// buf is full, need more capacity
@@ -83,7 +81,7 @@ async fn read_to_end_uring(
8381
let buf_len = usize::min(buf.spare_capacity_mut().len(), MAX_READ_SIZE);
8482

8583
// buf_len cannot be greater than u32::MAX because MAX_READ_SIZE
86-
// is u32::MAX
84+
// is less than u32::MAX
8785
let read_len = buf_len as u32;
8886

8987
// read into spare capacity

0 commit comments

Comments
 (0)