mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 09:53:24 +00:00
Refactor drivers
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d809eca81d
commit
edd808bd3d
@ -119,7 +119,7 @@ fn is_component(package: &JsonValue) -> bool {
|
||||
}
|
||||
|
||||
/// Get all the components name, this function will also check if the Components.toml contain all the components.
|
||||
fn get_components_name(workspace_root: &String, packages: &JsonValue) -> Vec<String> {
|
||||
fn get_components_name(workspace_root: &str, packages: &JsonValue) -> Vec<String> {
|
||||
let file_components_name = read_component_file(workspace_root);
|
||||
let mut comps_name = Vec::new();
|
||||
for package in packages.members() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
use jinux_frame::sync::SpinLock;
|
||||
use jinux_network::NetworkDevice;
|
||||
use jinux_network::AnyNetworkDevice;
|
||||
use jinux_virtio::device::network::DEVICE_NAME;
|
||||
use smoltcp::{
|
||||
iface::{Config, Routes, SocketHandle, SocketSet},
|
||||
@ -11,7 +11,7 @@ use smoltcp::{
|
||||
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
||||
|
||||
pub struct IfaceVirtio {
|
||||
driver: Arc<SpinLock<Box<dyn NetworkDevice>>>,
|
||||
driver: Arc<SpinLock<Box<dyn AnyNetworkDevice>>>,
|
||||
common: IfaceCommon,
|
||||
dhcp_handle: SocketHandle,
|
||||
weak_self: Weak<Self>,
|
||||
@ -19,7 +19,7 @@ pub struct IfaceVirtio {
|
||||
|
||||
impl IfaceVirtio {
|
||||
pub fn new() -> Arc<Self> {
|
||||
let virtio_net = jinux_network::get_device(&(DEVICE_NAME).to_string()).unwrap();
|
||||
let virtio_net = jinux_network::get_device(DEVICE_NAME).unwrap();
|
||||
let interface = {
|
||||
let mac_addr = virtio_net.lock().mac_addr();
|
||||
let ip_addr = IpCidr::new(wire::IpAddress::Ipv4(wire::Ipv4Address::UNSPECIFIED), 0);
|
||||
|
Reference in New Issue
Block a user