mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
runtime-rs: remove all remaining unsafe impl
Fixes: #6307 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
0301194851
commit
da8a6417aa
6
src/runtime-rs/Cargo.lock
generated
6
src/runtime-rs/Cargo.lock
generated
@ -534,9 +534,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.5.4"
|
version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
|
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
@ -780,6 +780,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"bytes 1.1.0",
|
"bytes 1.1.0",
|
||||||
|
"crossbeam-channel",
|
||||||
"dbs-address-space",
|
"dbs-address-space",
|
||||||
"dbs-allocator",
|
"dbs-allocator",
|
||||||
"dbs-arch",
|
"dbs-arch",
|
||||||
@ -1256,6 +1257,7 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"ch-config",
|
"ch-config",
|
||||||
|
"crossbeam-channel",
|
||||||
"dbs-utils",
|
"dbs-utils",
|
||||||
"dragonball",
|
"dragonball",
|
||||||
"futures 0.3.26",
|
"futures 0.3.26",
|
||||||
|
@ -15,9 +15,6 @@ use tokio::{
|
|||||||
|
|
||||||
use super::{ConnectConfig, Sock, Stream};
|
use super::{ConnectConfig, Sock, Stream};
|
||||||
|
|
||||||
unsafe impl Send for HybridVsock {}
|
|
||||||
unsafe impl Sync for HybridVsock {}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct HybridVsock {
|
pub struct HybridVsock {
|
||||||
uds: String,
|
uds: String,
|
||||||
|
@ -16,9 +16,6 @@ use tokio::net::UnixStream;
|
|||||||
|
|
||||||
use super::{ConnectConfig, Sock, Stream};
|
use super::{ConnectConfig, Sock, Stream};
|
||||||
|
|
||||||
unsafe impl Send for Vsock {}
|
|
||||||
unsafe impl Sync for Vsock {}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Vsock {
|
pub struct Vsock {
|
||||||
vsock_cid: u32,
|
vsock_cid: u32,
|
||||||
|
@ -36,6 +36,7 @@ ch-config = { path = "ch-config", optional = true }
|
|||||||
|
|
||||||
futures = "0.3.25"
|
futures = "0.3.25"
|
||||||
safe-path = "0.1.0"
|
safe-path = "0.1.0"
|
||||||
|
crossbeam-channel = "0.5.6"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -53,9 +53,6 @@ pub struct CloudHypervisorInner {
|
|||||||
pub(crate) tasks: Option<Vec<JoinHandle<Result<()>>>>,
|
pub(crate) tasks: Option<Vec<JoinHandle<Result<()>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for CloudHypervisorInner {}
|
|
||||||
unsafe impl Sync for CloudHypervisorInner {}
|
|
||||||
|
|
||||||
const CH_DEFAULT_TIMEOUT_SECS: u32 = 10;
|
const CH_DEFAULT_TIMEOUT_SECS: u32 = 10;
|
||||||
|
|
||||||
impl CloudHypervisorInner {
|
impl CloudHypervisorInner {
|
||||||
|
@ -33,9 +33,6 @@ pub struct CloudHypervisor {
|
|||||||
inner: Arc<RwLock<CloudHypervisorInner>>,
|
inner: Arc<RwLock<CloudHypervisorInner>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for CloudHypervisor {}
|
|
||||||
unsafe impl Sync for CloudHypervisor {}
|
|
||||||
|
|
||||||
impl CloudHypervisor {
|
impl CloudHypervisor {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -27,7 +27,6 @@ use std::{collections::HashSet, fs::create_dir_all, path::PathBuf};
|
|||||||
const DRAGONBALL_KERNEL: &str = "vmlinux";
|
const DRAGONBALL_KERNEL: &str = "vmlinux";
|
||||||
const DRAGONBALL_ROOT_FS: &str = "rootfs";
|
const DRAGONBALL_ROOT_FS: &str = "rootfs";
|
||||||
|
|
||||||
unsafe impl Sync for DragonballInner {}
|
|
||||||
pub struct DragonballInner {
|
pub struct DragonballInner {
|
||||||
/// sandbox id
|
/// sandbox id
|
||||||
pub(crate) id: String,
|
pub(crate) id: String,
|
||||||
|
@ -7,14 +7,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
os::unix::{io::IntoRawFd, prelude::AsRawFd},
|
os::unix::{io::IntoRawFd, prelude::AsRawFd},
|
||||||
sync::{
|
sync::{Arc, Mutex, RwLock},
|
||||||
mpsc::{channel, Receiver, Sender},
|
|
||||||
Arc, Mutex, RwLock,
|
|
||||||
},
|
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
use dragonball::{
|
use dragonball::{
|
||||||
api::v1::{
|
api::v1::{
|
||||||
BlockDeviceConfigInfo, BootSourceConfig, FsDeviceConfigInfo, FsMountConfigInfo,
|
BlockDeviceConfigInfo, BootSourceConfig, FsDeviceConfigInfo, FsMountConfigInfo,
|
||||||
@ -86,8 +84,8 @@ impl VmmInstance {
|
|||||||
pub fn run_vmm_server(&mut self, id: &str, netns: Option<String>) -> Result<()> {
|
pub fn run_vmm_server(&mut self, id: &str, netns: Option<String>) -> Result<()> {
|
||||||
let kvm = OpenOptions::new().read(true).write(true).open(KVM_DEVICE)?;
|
let kvm = OpenOptions::new().read(true).write(true).open(KVM_DEVICE)?;
|
||||||
|
|
||||||
let (to_vmm, from_runtime) = channel();
|
let (to_vmm, from_runtime) = unbounded();
|
||||||
let (to_runtime, from_vmm) = channel();
|
let (to_runtime, from_vmm) = unbounded();
|
||||||
|
|
||||||
self.set_instance_id(id);
|
self.set_instance_id(id);
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ const VSOCK_SCHEME: &str = "vsock";
|
|||||||
const VSOCK_AGENT_CID: u32 = 3;
|
const VSOCK_AGENT_CID: u32 = 3;
|
||||||
const VSOCK_AGENT_PORT: u32 = 1024;
|
const VSOCK_AGENT_PORT: u32 = 1024;
|
||||||
|
|
||||||
unsafe impl Send for QemuInner {}
|
|
||||||
unsafe impl Sync for QemuInner {}
|
|
||||||
|
|
||||||
pub struct QemuInner {
|
pub struct QemuInner {
|
||||||
config: HypervisorConfig,
|
config: HypervisorConfig,
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,9 @@ pub enum Action {
|
|||||||
Start,
|
Start,
|
||||||
Stop,
|
Stop,
|
||||||
Shutdown,
|
Shutdown,
|
||||||
Event(Arc<dyn Event>),
|
Event(Arc<dyn Event + Send + Sync>),
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for Message {}
|
|
||||||
unsafe impl Sync for Message {}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Message {
|
pub struct Message {
|
||||||
pub action: Action,
|
pub action: Action,
|
||||||
|
Loading…
Reference in New Issue
Block a user