Skip to content

Commit

Permalink
Merge upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
kaimast committed Jul 22, 2024
2 parents 2a3bed7 + bf9906d commit 35be54f
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 26 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,55 +30,55 @@ jobs:
bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo bench --no-run

check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo clippy

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo test

test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo test --doc

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo fmt -- --check

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: cargo doc --no-deps --all-features
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "tokio-uring"
version = "0.4.0"
version = "0.5.0"
authors = ["Tokio Contributors <[email protected]>"]
edition = "2018"
readme = "README.md"
license = "MIT"
documentation = "https://docs.rs/tokio-uring/0.4.0/tokio-uring"
documentation = "https://docs.rs/tokio-uring/0.5.0/tokio-uring"
repository = "https://github.com/tokio-rs/tokio-uring"
homepage = "https://tokio.rs"
description = """
Expand All @@ -20,7 +20,7 @@ keywords = ["async", "fs", "io-uring"]
tokio = { version = "1.2", features = ["net", "rt", "sync"] }
slab = "0.4.2"
libc = "0.2.80"
io-uring = "0.5.13"
io-uring = "0.6.0"
socket2 = { version = "0.4.4", features = ["all"] }
bytes = { version = "1.0", optional = true }
futures-util = { version = "0.3.26", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runtime internally manages the main Tokio runtime and a `io-uring` driver.
In your Cargo.toml:
```toml
[dependencies]
tokio-uring = { version = "0.4.0" }
tokio-uring = { version = "0.5.0" }
```
In your main.rs:
```rust
Expand Down
2 changes: 1 addition & 1 deletion examples/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ fn main() {
}

// Include a new line
println!("");
println!();
});
}
2 changes: 1 addition & 1 deletion examples/tcp_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() {
}

let (res, slice) = stream.write_all(buf.slice(..read)).await;
let _ = res.unwrap();
res.unwrap();
buf = slice.into_inner();
println!("{} all {} bytes ping-ponged", socket_addr, read);
n += read;
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp_listener_fixed_buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn echo_handler<T: IoBufMut>(

let (res, nslice) = stream.write_fixed_all(fbuf1.slice(..read)).await;

let _ = res.unwrap();
res.unwrap();
println!("peer {} all {} bytes ping-ponged", peer, read);
n += read;

Expand Down
4 changes: 2 additions & 2 deletions examples/wrk-bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use std::io;
use std::rc::Rc;
use tokio::task::JoinHandle;

pub const RESPONSE: &'static [u8] =
pub const RESPONSE: &[u8] =
b"HTTP/1.1 200 OK\nContent-Type: text/plain\nContent-Length: 12\n\nHello world!";

pub const ADDRESS: &'static str = "127.0.0.1:8080";
pub const ADDRESS: &str = "127.0.0.1:8080";

fn main() -> io::Result<()> {
tokio_uring::start(async {
Expand Down
2 changes: 1 addition & 1 deletion src/io/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Completable for Accept {
let socket = Socket { fd };
let (_, addr) = unsafe {
socket2::SockAddr::init(move |addr_storage, len| {
*addr_storage = self.socketaddr.0.to_owned();
self.socketaddr.0.clone_into(&mut *addr_storage);
*len = self.socketaddr.1;
Ok(())
})?
Expand Down
4 changes: 2 additions & 2 deletions src/io/fallocate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl Op<Fallocate> {
x.handle().expect("not in a runtime context").submit_op(
Fallocate { fd: fd.clone() },
|fallocate| {
opcode::Fallocate64::new(types::Fd(fallocate.fd.raw_fd()), len as _)
.offset64(offset as _)
opcode::Fallocate::new(types::Fd(fallocate.fd.raw_fd()), len as _)
.offset(offset as _)
.mode(flags)
.build()
},
Expand Down
2 changes: 1 addition & 1 deletion src/io/shared_fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl SharedFd {
}
State::WaitingForUniqueness(waker) => {
if !waker.will_wake(cx.waker()) {
*waker = cx.waker().clone();
waker.clone_from(cx.waker());
}

Poll::Pending
Expand Down
2 changes: 1 addition & 1 deletion src/io/writev_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<T: BoundedBuf> Op<WritevAll<T>> {
// So this wouldn't need to be a function. Just pass in the entry.
|write| {
opcode::Writev::new(types::Fd(write.fd.raw_fd()), iovs_ptr, iovs_len)
.offset64(offset as _)
.offset(offset as _)
.build()
},
)
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
//! call `close()`.
#![warn(missing_docs)]
#![allow(clippy::thread_local_initializer_can_be_made_const)]

macro_rules! syscall {
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
Expand Down
8 changes: 5 additions & 3 deletions src/runtime/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ impl Driver {
&mut self,
buffers: Rc<RefCell<dyn FixedBuffers>>,
) -> io::Result<()> {
self.uring
.submitter()
.register_buffers(buffers.borrow().iovecs())?;
unsafe {
self.uring
.submitter()
.register_buffers(buffers.borrow().iovecs())
}?;

self.fixed_buffers = Some(buffers);
Ok(())
Expand Down
1 change: 1 addition & 0 deletions src/runtime/driver/op/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub(crate) trait Updateable: Completable {
fn update(&mut self, cqe: CqeResult);
}

#[allow(dead_code)]
pub(crate) enum Lifecycle {
/// The operation has been submitted to uring and is currently in-flight
Submitted,
Expand Down
2 changes: 0 additions & 2 deletions tests/fs_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::{
os::unix::io::{AsRawFd, FromRawFd, RawFd},
};

use libc;

use tempfile::NamedTempFile;

use tokio_uring::buf::fixed::FixedBufRegistry;
Expand Down

0 comments on commit 35be54f

Please sign in to comment.