mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Remove ostd/src/mm/offset.rs
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
1a1d9bfb60
commit
a1f81df263
@ -18,7 +18,6 @@ use log::{debug, info};
|
||||
use ostd::{
|
||||
io::IoMem,
|
||||
mm::{DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmIo, PAGE_SIZE},
|
||||
offset_of,
|
||||
sync::{LocalIrqDisabled, RwLock, SpinLock},
|
||||
trap::TrapFrame,
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ use core::{fmt::Debug, hint::spin_loop, mem::size_of};
|
||||
use aster_network::{RxBuffer, TxBuffer};
|
||||
use aster_util::{field_ptr, slot_vec::SlotVec};
|
||||
use log::debug;
|
||||
use ostd::{mm::VmWriter, offset_of, sync::SpinLock, trap::TrapFrame, Pod};
|
||||
use ostd::{mm::VmWriter, sync::SpinLock, trap::TrapFrame, Pod};
|
||||
|
||||
use super::{
|
||||
config::{VirtioVsockConfig, VsockFeatures},
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use core::{
|
||||
mem::size_of,
|
||||
mem::{offset_of, size_of},
|
||||
sync::atomic::{fence, Ordering},
|
||||
};
|
||||
|
||||
@ -14,7 +14,7 @@ use bitflags::bitflags;
|
||||
use log::debug;
|
||||
use ostd::{
|
||||
mm::{DmaCoherent, FrameAllocOptions, PodOnce},
|
||||
offset_of, Pod,
|
||||
Pod,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -309,7 +309,7 @@ impl VirtQueue {
|
||||
let last_used_slot = self.last_used_idx & (self.queue_size - 1);
|
||||
let element_ptr = {
|
||||
let mut ptr = self.used.borrow_vm();
|
||||
ptr.byte_add(offset_of!(UsedRing, ring) as usize + last_used_slot as usize * 8);
|
||||
ptr.byte_add(offset_of!(UsedRing, ring) + last_used_slot as usize * 8);
|
||||
ptr.cast::<UsedElem>()
|
||||
};
|
||||
let index = field_ptr!(&element_ptr, UsedElem, id).read_once().unwrap();
|
||||
@ -333,7 +333,7 @@ impl VirtQueue {
|
||||
let last_used_slot = self.last_used_idx & (self.queue_size - 1);
|
||||
let element_ptr = {
|
||||
let mut ptr = self.used.borrow_vm();
|
||||
ptr.byte_add(offset_of!(UsedRing, ring) as usize + last_used_slot as usize * 8);
|
||||
ptr.byte_add(offset_of!(UsedRing, ring) + last_used_slot as usize * 8);
|
||||
ptr.cast::<UsedElem>()
|
||||
};
|
||||
let index = field_ptr!(&element_ptr, UsedElem, id).read_once().unwrap();
|
||||
|
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
use core::mem::size_of;
|
||||
use core::mem::{offset_of, size_of};
|
||||
|
||||
use aster_rights::{ReadOp, WriteOp};
|
||||
use aster_util::{field_ptr, safe_ptr::SafePtr};
|
||||
@ -16,7 +16,6 @@ use ostd::{
|
||||
},
|
||||
io::IoMem,
|
||||
mm::{DmaCoherent, PAGE_SIZE},
|
||||
offset_of,
|
||||
sync::RwLock,
|
||||
trap::IrqCallbackFunction,
|
||||
};
|
||||
@ -66,9 +65,9 @@ impl VirtioMmioTransport {
|
||||
let interrupt_ack_offset = offset_of!(VirtioMmioLayout, interrupt_ack);
|
||||
let interrupt_status_offset = offset_of!(VirtioMmioLayout, interrupt_status);
|
||||
let mut interrupt_ack = layout.clone();
|
||||
interrupt_ack.byte_add(interrupt_ack_offset as usize);
|
||||
interrupt_ack.byte_add(interrupt_ack_offset);
|
||||
let mut interrupt_status = layout.clone();
|
||||
interrupt_status.byte_add(interrupt_status_offset as usize);
|
||||
interrupt_status.byte_add(interrupt_status_offset);
|
||||
(
|
||||
interrupt_ack.cast::<u32>().restrict::<WriteOp>(),
|
||||
interrupt_status.cast::<u32>().restrict::<ReadOp>(),
|
||||
@ -174,7 +173,7 @@ impl VirtioTransport for VirtioMmioTransport {
|
||||
}
|
||||
|
||||
fn notify_config(&self, _idx: usize) -> ConfigManager<u32> {
|
||||
let offset = offset_of!(VirtioMmioLayout, queue_notify) as usize;
|
||||
let offset = offset_of!(VirtioMmioLayout, queue_notify);
|
||||
let safe_ptr = Some(SafePtr::new(self.common_device.io_mem().clone(), offset));
|
||||
|
||||
ConfigManager::new(safe_ptr, None)
|
||||
|
@ -15,7 +15,6 @@ use ostd::{
|
||||
},
|
||||
io::IoMem,
|
||||
mm::DmaCoherent,
|
||||
offset_of,
|
||||
trap::IrqCallbackFunction,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user