Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies update. #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ 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"
socket2 = { version = "0.4.4", features = ["all"] }
io-uring = "0.6.0"
socket2 = { version = "0.5.3", 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 src/io/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Completable for Accept {
let fd = SharedFd::new(fd as i32);
let socket = Socket { fd };
let (_, addr) = unsafe {
socket2::SockAddr::init(move |addr_storage, len| {
socket2::SockAddr::try_init(move |addr_storage, len| {
*addr_storage = self.socketaddr.0.to_owned();
*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)
.mode(flags)
.build()
},
Expand Down
2 changes: 1 addition & 1 deletion src/io/recv_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<T: BoundedBufMut> Op<RecvFrom<T>> {
std::slice::from_raw_parts_mut(buf.stable_mut_ptr(), buf.bytes_total())
})];

let socket_addr = Box::new(unsafe { SockAddr::init(|_, _| Ok(()))?.1 });
let socket_addr = Box::new(unsafe { SockAddr::try_init(|_, _| Ok(()))?.1 });

let mut msghdr: Box<libc::msghdr> = Box::new(unsafe { std::mem::zeroed() });
msghdr.msg_iov = io_slices.as_mut_ptr().cast();
Expand Down
2 changes: 1 addition & 1 deletion src/io/recvmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<T: BoundedBufMut> Op<RecvMsg<T>> {
}));
}

let socket_addr = Box::new(unsafe { SockAddr::init(|_, _| Ok(()))?.1 });
let socket_addr = Box::new(unsafe { SockAddr::try_init(|_, _| Ok(()))?.1 });

let mut msghdr: Box<libc::msghdr> = Box::new(unsafe { std::mem::zeroed() });
msghdr.msg_iov = io_slices.as_mut_ptr().cast();
Expand Down
7 changes: 7 additions & 0 deletions src/io/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
io::SharedFd,
UnsubmittedOneshot,
};
use std::os::fd::{AsFd, BorrowedFd};
use std::{
io,
net::SocketAddr,
Expand Down Expand Up @@ -280,6 +281,12 @@ impl Socket {
}
}

impl AsFd for Socket {
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(self.fd.raw_fd()) }
}
}

impl AsRawFd for Socket {
fn as_raw_fd(&self) -> RawFd {
self.fd.raw_fd()
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)
.build()
},
)
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