mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Fix multiple issues pointed out by the new compiler
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5f2bd9d0ac
commit
9e4257b655
@ -159,15 +159,19 @@ impl<'a> CurrentUserSpace<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait providing the ability to read a C string from the user space
|
||||
/// of the current process specifically for [`VmReader<'_, UserSpace>`], which
|
||||
/// should reading the bytes iteratively in the reader until encountering
|
||||
/// the end of the reader or reading a `\0` (is also included into the final C String).
|
||||
/// A trait providing the ability to read a C string from the user space.
|
||||
///
|
||||
/// The user space should be of the current process. The implemented method
|
||||
/// should read the bytes iteratively in the reader ([`VmReader`]) until
|
||||
/// encountering the end of the reader or reading a `\0` (which is also
|
||||
/// included in the final C String).
|
||||
pub trait ReadCString {
|
||||
fn read_cstring(&mut self) -> Result<CString>;
|
||||
}
|
||||
|
||||
impl<'a> ReadCString for VmReader<'a, Fallible> {
|
||||
impl ReadCString for VmReader<'_, Fallible> {
|
||||
/// Reads a C string from the user space.
|
||||
///
|
||||
/// This implementation is inspired by
|
||||
/// the `do_strncpy_from_user` function in Linux kernel.
|
||||
/// The original Linux implementation can be found at:
|
||||
|
@ -240,7 +240,7 @@ impl LineDiscipline {
|
||||
b'\r' => echo_callback("\r\n"),
|
||||
ch if ch == *termios.get_special_char(CC_C_CHAR::VERASE) => {
|
||||
// write a space to overwrite current character
|
||||
let backspace: &str = core::str::from_utf8(&[b'\x08', b' ', b'\x08']).unwrap();
|
||||
let backspace: &str = core::str::from_utf8(b"\x08 \x08").unwrap();
|
||||
echo_callback(backspace);
|
||||
}
|
||||
ch if is_printable_char(ch) => print!("{}", char::from(ch)),
|
||||
|
@ -403,8 +403,8 @@ impl ExfatDentrySet {
|
||||
}
|
||||
Ok(name)
|
||||
}
|
||||
/// Name dentries are not permitted to modify. We should create a new dentry set for renaming.
|
||||
|
||||
/// Name dentries are not permitted to modify. We should create a new dentry set for renaming.
|
||||
fn calculate_checksum(&self) -> u16 {
|
||||
const CHECKSUM_BYTES_RANGE: Range<usize> = 2..4;
|
||||
const EMPTY_RANGE: Range<usize> = 0..0;
|
||||
@ -502,7 +502,6 @@ impl Iterator for ExfatDentryIterator {
|
||||
}
|
||||
|
||||
/// On-disk dentry formats
|
||||
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Debug, Default, Copy, Pod)]
|
||||
// For files & directories
|
||||
|
@ -891,7 +891,7 @@ impl ExfatInode {
|
||||
// TODO: remove trailing periods of pathname.
|
||||
// Do not allow creation of files with names ending with period(s).
|
||||
|
||||
let name_dentries = (name.len() + EXFAT_FILE_NAME_LEN - 1) / EXFAT_FILE_NAME_LEN;
|
||||
let name_dentries = name.len().div_ceil(EXFAT_FILE_NAME_LEN);
|
||||
let num_dentries = name_dentries + 2; // FILE Entry + Stream Entry + Name Entry
|
||||
|
||||
// We update the size of inode before writing page_cache, but it is fine since we've cleaned the page_cache.
|
||||
@ -1139,7 +1139,7 @@ impl Inode for ExfatInode {
|
||||
ino: inner.ino,
|
||||
size: inner.size,
|
||||
blk_size,
|
||||
blocks: (inner.size + blk_size - 1) / blk_size,
|
||||
blocks: inner.size.div_ceil(blk_size),
|
||||
atime: inner.atime.as_duration().unwrap_or_default(),
|
||||
mtime: inner.mtime.as_duration().unwrap_or_default(),
|
||||
ctime: inner.ctime.as_duration().unwrap_or_default(),
|
||||
|
@ -698,7 +698,7 @@ mod test {
|
||||
}
|
||||
|
||||
let steps = 7;
|
||||
let write_len = (BUF_SIZE + steps - 1) / steps;
|
||||
let write_len = BUF_SIZE.div_ceil(steps);
|
||||
for i in 0..steps {
|
||||
let start = i * write_len;
|
||||
let end = BUF_SIZE.min(start + write_len);
|
||||
|
@ -14,7 +14,7 @@ pub fn make_hash_index(cluster: ClusterID, offset: u32) -> usize {
|
||||
pub fn calc_checksum_32(data: &[u8]) -> u32 {
|
||||
let mut checksum: u32 = 0;
|
||||
for &value in data {
|
||||
checksum = ((checksum << 31) | (checksum >> 1)).wrapping_add(value as u32);
|
||||
checksum = checksum.rotate_right(1).wrapping_add(value as u32);
|
||||
}
|
||||
checksum
|
||||
}
|
||||
@ -27,7 +27,7 @@ pub fn calc_checksum_16(data: &[u8], ignore: core::ops::Range<usize>, prev_check
|
||||
if ignore.contains(&pos) {
|
||||
continue;
|
||||
}
|
||||
result = ((result << 15) | (result >> 1)).wrapping_add(value as u16);
|
||||
result = result.rotate_right(1).wrapping_add(value as u16);
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ impl<'a> DirEntryReader<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for DirEntryReader<'a> {
|
||||
impl Iterator for DirEntryReader<'_> {
|
||||
type Item = (usize, DirEntry);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
@ -1761,7 +1761,7 @@ impl<'a> DeviceRangeReader<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for DeviceRangeReader<'a> {
|
||||
impl Iterator for DeviceRangeReader<'_> {
|
||||
type Item = Range<Ext2Bid>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
@ -491,7 +491,7 @@ impl<'a> FsPath<'a> {
|
||||
impl<'a> TryFrom<&'a str> for FsPath<'a> {
|
||||
type Error = crate::error::Error;
|
||||
|
||||
fn try_from(path: &'a str) -> Result<FsPath> {
|
||||
fn try_from(path: &'a str) -> Result<FsPath<'a>> {
|
||||
if path.is_empty() {
|
||||
return_errno_with_message!(Errno::ENOENT, "path is an empty string");
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ use crate::{
|
||||
mod cap_last_cap;
|
||||
|
||||
/// Represents the inode at `/proc/sys/kernel`.
|
||||
|
||||
pub struct KernelDirOps;
|
||||
|
||||
impl KernelDirOps {
|
||||
|
@ -502,7 +502,7 @@ pub struct InodeWriter<'a> {
|
||||
offset: usize,
|
||||
}
|
||||
|
||||
impl<'a> Write for InodeWriter<'a> {
|
||||
impl Write for InodeWriter<'_> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<usize> {
|
||||
let mut reader = VmReader::from(buf).to_fallible();
|
||||
|
@ -6,6 +6,7 @@ use super::*;
|
||||
pub const OFFSET_MAX: usize = i64::MAX as usize;
|
||||
|
||||
/// A range in a file.
|
||||
///
|
||||
/// The range is [start, end).
|
||||
/// The range is valid if start < end.
|
||||
/// The range is empty if start == end.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#![feature(fn_traits)]
|
||||
#![feature(format_args_nl)]
|
||||
#![feature(int_roundings)]
|
||||
#![feature(iter_repeat_n)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(linkage)]
|
||||
#![feature(linked_list_remove)]
|
||||
|
@ -74,9 +74,8 @@ impl BoundDatagram {
|
||||
// But current smoltcp API seems not to support this behavior.
|
||||
reader
|
||||
.read(&mut VmWriter::from(socket_buffer))
|
||||
.map_err(|e| {
|
||||
warn!("unexpected UDP packet will be sent");
|
||||
e
|
||||
.inspect_err(|e| {
|
||||
warn!("unexpected UDP packet {e:#?} will be sent");
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -34,8 +34,8 @@ pub(super) struct Credentials_ {
|
||||
supplementary_gids: RwLock<BTreeSet<Gid>>,
|
||||
|
||||
/// The Linux capabilities.
|
||||
///
|
||||
/// This is not the capability (in static_cap.rs) enforced on rust objects.
|
||||
|
||||
/// Capability that child processes can inherit
|
||||
inheritable_capset: AtomicCapSet,
|
||||
|
||||
|
@ -84,7 +84,7 @@ impl<'a> FutexIter<'a> {
|
||||
|
||||
const ROBUST_LIST_LIMIT: isize = 2048;
|
||||
|
||||
impl<'a> Iterator for FutexIter<'a> {
|
||||
impl Iterator for FutexIter<'_> {
|
||||
type Item = Vaddr;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
@ -108,7 +108,7 @@ pub struct ProcessGroupGuard<'a> {
|
||||
inner: MutexGuard<'a, Inner>,
|
||||
}
|
||||
|
||||
impl<'a> ProcessGroupGuard<'a> {
|
||||
impl ProcessGroupGuard<'_> {
|
||||
/// Returns an iterator over the processes in the group.
|
||||
pub fn iter(&self) -> ProcessGroupIter {
|
||||
ProcessGroupIter {
|
||||
|
@ -44,7 +44,7 @@ pub struct ProcessTable<'a> {
|
||||
inner: MutexGuard<'a, BTreeMap<Pid, Arc<Process>>>,
|
||||
}
|
||||
|
||||
impl<'a> ProcessTable<'a> {
|
||||
impl ProcessTable<'_> {
|
||||
/// Returns an iterator over the processes in the table.
|
||||
pub fn iter(&self) -> ProcessTableIter {
|
||||
ProcessTableIter {
|
||||
|
@ -14,7 +14,6 @@ use crate::prelude::*;
|
||||
/// > about the environment in which it is operating. The form of this information
|
||||
/// > is a table of key-value pairs, where the keys are from the set of ‘AT_’
|
||||
/// > values in elf.h.
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
#[repr(u8)]
|
||||
|
@ -338,11 +338,7 @@ fn map_segment_vmo(
|
||||
vm_map_options = vm_map_options.offset(offset).handle_page_faults_around();
|
||||
let map_addr = vm_map_options.build()?;
|
||||
|
||||
let anonymous_map_size: usize = if total_map_size > segment_size {
|
||||
total_map_size - segment_size
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let anonymous_map_size: usize = total_map_size.saturating_sub(segment_size);
|
||||
|
||||
if anonymous_map_size > 0 {
|
||||
let mut anonymous_map_options = root_vmar
|
||||
|
@ -104,7 +104,7 @@ impl<'a, T: DirentSerializer> DirentBufferReader<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: DirentSerializer> DirentVisitor for DirentBufferReader<'a, T> {
|
||||
impl<T: DirentSerializer> DirentVisitor for DirentBufferReader<'_, T> {
|
||||
fn visit(&mut self, name: &str, ino: u64, type_: InodeType, offset: usize) -> Result<()> {
|
||||
let dirent_serializer = T::new(ino, offset as u64, type_, CString::new(name)?);
|
||||
if self.read_len >= self.buffer.len() {
|
||||
|
@ -218,6 +218,7 @@ impl MMapOptions {
|
||||
self.typ
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn flags(&self) -> MMapFlags {
|
||||
self.flags
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ impl From<c_pollfd> for PollFd {
|
||||
|
||||
impl From<PollFd> for c_pollfd {
|
||||
fn from(raw: PollFd) -> Self {
|
||||
let fd = if let Some(fd) = raw.fd() { fd } else { -1 };
|
||||
let fd = raw.fd().unwrap_or(-1);
|
||||
let events = raw.events().bits() as i16;
|
||||
let revents = raw.revents().get().bits() as i16;
|
||||
Self {
|
||||
|
@ -61,6 +61,7 @@ pub struct Taskless {
|
||||
/// The function that will be called when executing this taskless job.
|
||||
callback: Box<RefCell<dyn FnMut() + Send + Sync + 'static>>,
|
||||
/// Whether this `Taskless` is disabled.
|
||||
#[allow(unused)]
|
||||
is_disabled: AtomicBool,
|
||||
link: LinkedListAtomicLink,
|
||||
}
|
||||
@ -74,6 +75,7 @@ cpu_local! {
|
||||
|
||||
impl Taskless {
|
||||
/// Creates a new `Taskless` instance with its callback function.
|
||||
#[allow(unused)]
|
||||
pub fn new<F>(callback: F) -> Arc<Self>
|
||||
where
|
||||
F: FnMut() + Send + Sync + 'static,
|
||||
@ -94,6 +96,7 @@ impl Taskless {
|
||||
/// Schedules this taskless job and it will be executed in later time.
|
||||
///
|
||||
/// If the taskless job has been scheduled, this function will do nothing.
|
||||
#[allow(unused)]
|
||||
pub fn schedule(self: &Arc<Self>) {
|
||||
do_schedule(self, &TASKLESS_LIST);
|
||||
SoftIrqLine::get(TASKLESS_SOFTIRQ_ID).raise();
|
||||
@ -103,6 +106,7 @@ impl Taskless {
|
||||
/// in softirq context.
|
||||
///
|
||||
/// If the taskless job has been scheduled, this function will do nothing.
|
||||
#[allow(unused)]
|
||||
pub fn schedule_urgent(self: &Arc<Self>) {
|
||||
do_schedule(self, &TASKLESS_URGENT_LIST);
|
||||
SoftIrqLine::get(TASKLESS_URGENT_SOFTIRQ_ID).raise();
|
||||
@ -111,17 +115,20 @@ impl Taskless {
|
||||
/// Enables this `Taskless` so that it can be executed once it has been scheduled.
|
||||
///
|
||||
/// A new `Taskless` is enabled by default.
|
||||
#[allow(unused)]
|
||||
pub fn enable(&self) {
|
||||
self.is_disabled.store(false, Ordering::Release);
|
||||
}
|
||||
|
||||
/// Disables this `Taskless` so that it can not be scheduled. Note that if the `Taskless`
|
||||
/// has been scheduled, it can still continue to complete this job.
|
||||
#[allow(unused)]
|
||||
pub fn disable(&self) {
|
||||
self.is_disabled.store(true, Ordering::Release);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn do_schedule(
|
||||
taskless: &Arc<Taskless>,
|
||||
taskless_list: &'static CpuLocal<RefCell<LinkedList<TasklessAdapter>>>,
|
||||
|
@ -2,6 +2,68 @@
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
//! Work queue mechanism.
|
||||
//!
|
||||
//! # Overview
|
||||
//!
|
||||
//! A `workqueue` is a kernel-level mechanism used to schedule and execute deferred work.
|
||||
//! Deferred work refers to tasks that need to be executed at some point in the future,
|
||||
//! but not necessarily immediately.
|
||||
//!
|
||||
//! The workqueue mechanism is implemented using a combination of kernel threads and data
|
||||
//! structures such as `WorkItem`, `WorkQueue`, `Worker` and `WorkerPool`. The `WorkItem`
|
||||
//! represents a task to be processed, while the `WorkQueue` maintains the queue of submitted
|
||||
//! `WorkItems`. The `Worker` is responsible for processing these submitted tasks,
|
||||
//! and the `WorkerPool` manages and schedules these workers.
|
||||
//!
|
||||
//! # Examples
|
||||
//!
|
||||
//! The system has a default work queue and worker pool,
|
||||
//! and it also provides high-level APIs for users to use.
|
||||
//! Here is a basic example to how to use those APIs.
|
||||
//!
|
||||
//! ```rust
|
||||
//! use crate::thread::work_queue::{submit_work_func, submit_work_item, WorkItem};
|
||||
//!
|
||||
//! // Submit to high priority queue.
|
||||
//! submit_work_func(||{ }, true);
|
||||
//!
|
||||
//! // Submit to low priority queue.
|
||||
//! submit_work_func(||{ }, false);
|
||||
//!
|
||||
//! fn deferred_task(){
|
||||
//! // ...
|
||||
//! }
|
||||
//!
|
||||
//! // Create a work item.
|
||||
//! let work_item = Arc::new(WorkItem::new(Box::new(deferred_task)));
|
||||
//!
|
||||
//! // Submit to high priority queue.
|
||||
//! submit_work_item(work_item, true);
|
||||
//!
|
||||
//! // Submit to low priority queue.
|
||||
//! submit_work_item(work_item, false);
|
||||
//! ```
|
||||
//!
|
||||
//! Certainly, users can also create a dedicated WorkQueue and WorkerPool.
|
||||
//!
|
||||
//! ```rust
|
||||
//! use ostd::cpu::CpuSet;
|
||||
//! use crate::thread::work_queue::{WorkQueue, WorkerPool, WorkItem};
|
||||
//!
|
||||
//! fn deferred_task(){
|
||||
//! // ...
|
||||
//! }
|
||||
//!
|
||||
//! let cpu_set = CpuSet::new_full();
|
||||
//! let high_pri_pool = WorkerPool::new(true, cpu_set);
|
||||
//! let my_queue = WorkQueue::new(Arc::downgrade(high_pri_pool.get().unwrap()));
|
||||
//!
|
||||
//! let work_item = Arc::new(WorkItem::new(Box::new(deferred_task)));
|
||||
//! my_queue.enqueue(work_item);
|
||||
//!
|
||||
//! ```
|
||||
|
||||
use ostd::cpu::CpuSet;
|
||||
use spin::Once;
|
||||
use work_item::WorkItem;
|
||||
@ -19,68 +81,6 @@ static WORKERPOOL_HIGH_PRI: Once<Arc<WorkerPool>> = Once::new();
|
||||
static WORKQUEUE_GLOBAL_NORMAL: Once<Arc<WorkQueue>> = Once::new();
|
||||
static WORKQUEUE_GLOBAL_HIGH_PRI: Once<Arc<WorkQueue>> = Once::new();
|
||||
|
||||
/// Work queue mechanism.
|
||||
///
|
||||
/// # Overview
|
||||
///
|
||||
/// A `workqueue` is a kernel-level mechanism used to schedule and execute deferred work.
|
||||
/// Deferred work refers to tasks that need to be executed at some point in the future,
|
||||
/// but not necessarily immediately.
|
||||
///
|
||||
/// The workqueue mechanism is implemented using a combination of kernel threads and data
|
||||
/// structures such as `WorkItem`, `WorkQueue`, `Worker` and `WorkerPool`. The `WorkItem`
|
||||
/// represents a task to be processed, while the `WorkQueue` maintains the queue of submitted
|
||||
/// `WorkItems`. The `Worker` is responsible for processing these submitted tasks,
|
||||
/// and the `WorkerPool` manages and schedules these workers.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// The system has a default work queue and worker pool,
|
||||
/// and it also provides high-level APIs for users to use.
|
||||
/// Here is a basic example to how to use those APIs.
|
||||
///
|
||||
/// ```rust
|
||||
/// use crate::thread::work_queue::{submit_work_func, submit_work_item, WorkItem};
|
||||
///
|
||||
/// // Submit to high priority queue.
|
||||
/// submit_work_func(||{ }, true);
|
||||
///
|
||||
/// // Submit to low priority queue.
|
||||
/// submit_work_func(||{ }, false);
|
||||
///
|
||||
/// fn deferred_task(){
|
||||
/// // ...
|
||||
/// }
|
||||
///
|
||||
/// // Create a work item.
|
||||
/// let work_item = Arc::new(WorkItem::new(Box::new(deferred_task)));
|
||||
///
|
||||
/// // Submit to high priority queue.
|
||||
/// submit_work_item(work_item, true);
|
||||
///
|
||||
/// // Submit to low priority queue.
|
||||
/// submit_work_item(work_item, false);
|
||||
/// ```
|
||||
///
|
||||
/// Certainly, users can also create a dedicated WorkQueue and WorkerPool.
|
||||
///
|
||||
/// ```rust
|
||||
/// use ostd::cpu::CpuSet;
|
||||
/// use crate::thread::work_queue::{WorkQueue, WorkerPool, WorkItem};
|
||||
///
|
||||
/// fn deferred_task(){
|
||||
/// // ...
|
||||
/// }
|
||||
///
|
||||
/// let cpu_set = CpuSet::new_full();
|
||||
/// let high_pri_pool = WorkerPool::new(true, cpu_set);
|
||||
/// let my_queue = WorkQueue::new(Arc::downgrade(high_pri_pool.get().unwrap()));
|
||||
///
|
||||
/// let work_item = Arc::new(WorkItem::new(Box::new(deferred_task)));
|
||||
/// my_queue.enqueue(work_item);
|
||||
///
|
||||
/// ```
|
||||
|
||||
/// Submit a function to a global work queue.
|
||||
pub fn submit_work_func<F>(work_func: F, work_priority: WorkPriority)
|
||||
where
|
||||
|
@ -57,6 +57,7 @@ pub trait WorkerScheduler: Sync + Send {
|
||||
}
|
||||
|
||||
/// The `Monitor` is responsible for monitoring the `WorkerPool` for scheduling needs.
|
||||
///
|
||||
/// Currently, it only performs a liveness check, and attempts to schedule when no workers
|
||||
/// are found processing in the pool.
|
||||
pub struct Monitor {
|
||||
|
@ -13,6 +13,7 @@ pub struct CpuClock {
|
||||
}
|
||||
|
||||
/// A profiling clock that contains a user CPU clock and a kernel CPU clock.
|
||||
///
|
||||
/// These two clocks record the CPU time in user mode and kernel mode respectively.
|
||||
/// Reading this clock directly returns the sum of both times.
|
||||
pub struct ProfClock {
|
||||
|
@ -173,7 +173,7 @@ pub trait MultiWrite {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MultiRead for VmReaderArray<'a> {
|
||||
impl MultiRead for VmReaderArray<'_> {
|
||||
fn read(&mut self, writer: &mut VmWriter<'_, Infallible>) -> Result<usize> {
|
||||
let mut total_len = 0;
|
||||
|
||||
@ -192,7 +192,7 @@ impl<'a> MultiRead for VmReaderArray<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MultiRead for VmReader<'a> {
|
||||
impl MultiRead for VmReader<'_> {
|
||||
fn read(&mut self, writer: &mut VmWriter<'_, Infallible>) -> Result<usize> {
|
||||
Ok(self.read_fallible(writer)?)
|
||||
}
|
||||
@ -202,7 +202,7 @@ impl<'a> MultiRead for VmReader<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MultiWrite for VmWriterArray<'a> {
|
||||
impl MultiWrite for VmWriterArray<'_> {
|
||||
fn write(&mut self, reader: &mut VmReader<'_, Infallible>) -> Result<usize> {
|
||||
let mut total_len = 0;
|
||||
|
||||
@ -221,7 +221,7 @@ impl<'a> MultiWrite for VmWriterArray<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MultiWrite for VmWriter<'a> {
|
||||
impl MultiWrite for VmWriter<'_> {
|
||||
fn write(&mut self, reader: &mut VmReader<'_, Infallible>) -> Result<usize> {
|
||||
Ok(self.write_fallible(reader)?)
|
||||
}
|
||||
|
@ -47,7 +47,9 @@ where
|
||||
|
||||
bytes[..2].copy_from_slice(&(CSocketAddrFamily::AF_UNIX as u16).to_ne_bytes());
|
||||
#[allow(clippy::assertions_on_constants)]
|
||||
const { assert!(CSocketAddrUnix::PATH_OFFSET == 2) };
|
||||
const {
|
||||
assert!(CSocketAddrUnix::PATH_OFFSET == 2)
|
||||
};
|
||||
|
||||
let sun_path = &mut bytes[CSocketAddrUnix::PATH_OFFSET..];
|
||||
|
||||
|
@ -224,6 +224,7 @@ impl RingBuffer<u8> {
|
||||
/// Writes data from the `reader` to the `RingBuffer`.
|
||||
///
|
||||
/// Returns the number of bytes written.
|
||||
#[allow(unused)]
|
||||
pub fn write_fallible(&mut self, reader: &mut dyn MultiRead) -> Result<usize> {
|
||||
let mut producer = Producer {
|
||||
rb: self,
|
||||
|
Reference in New Issue
Block a user