refactor: os::io was split

This commit is contained in:
Mark Poliakov 2024-01-05 00:22:42 +02:00
parent 1337bf10db
commit d346ef4b24
13 changed files with 30 additions and 15 deletions

View File

@ -1,6 +1,9 @@
use std::{
fs::OpenOptions,
os::yggdrasil::io::{DeviceRequest, FdDeviceRequest, FileMapping},
os::yggdrasil::io::{
device::{DeviceRequest, FdDeviceRequest},
mapping::FileMapping,
},
};
use crate::error::Error;

View File

@ -6,7 +6,7 @@ use std::{
collections::BTreeMap,
os::{
fd::{AsRawFd, RawFd},
yggdrasil::io::{FileMapping, PollChannel, SharedMemory},
yggdrasil::io::{mapping::FileMapping, poll::PollChannel, shared_memory::SharedMemory},
},
process::{Command, ExitCode},
};

View File

@ -4,7 +4,7 @@ use std::{
fmt,
fs::File,
io::{self, BufRead, BufReader},
os::yggdrasil::io::{MessageChannel, MessageReceiver},
os::yggdrasil::io::message_channel::{MessageChannel, MessageReceiver},
path::Path,
process::{Command, ExitCode, Stdio},
str::FromStr,

View File

@ -2,7 +2,7 @@ use std::{
collections::VecDeque,
os::{
fd::{AsRawFd, FromRawFd, OwnedFd, RawFd},
yggdrasil::io::PollChannel,
yggdrasil::io::poll::PollChannel,
},
time::Duration,
};

View File

@ -1,5 +1,5 @@
use std::{
os::yggdrasil::io::FileMapping,
os::yggdrasil::io::mapping::FileMapping,
sync::{Arc, Mutex},
};

View File

@ -5,7 +5,7 @@ use std::{
marker::PhantomData,
os::{
fd::{AsRawFd, RawFd},
yggdrasil::io::{
yggdrasil::io::message_channel::{
MessageChannel, MessageChannelReceiver, MessageChannelSender, MessageDestination,
MessageReceiver, MessageSender, ReceivedMessageMetadata,
},

View File

@ -1,7 +1,10 @@
use std::{
io::{self, Stdin, Stdout},
mem::MaybeUninit,
os::yggdrasil::io::{update_terminal_options, DeviceRequest, FdDeviceRequest, TerminalOptions},
os::yggdrasil::io::{
device::{DeviceRequest, FdDeviceRequest},
terminal::{update_terminal_options, TerminalOptions},
},
};
pub struct RawMode(TerminalOptions);

View File

@ -50,7 +50,7 @@ pub mod unix {
pub struct Syslog {
#[cfg(target_os = "yggdrasil")]
channel: std::os::yggdrasil::io::MessageChannel,
channel: std::os::yggdrasil::io::message_channel::MessageChannel,
}
// TODO replace this
@ -61,7 +61,7 @@ pub trait ToExitCode {
#[cfg(target_os = "yggdrasil")]
impl Syslog {
pub fn open() -> io::Result<Self> {
use std::os::yggdrasil::io::MessageChannel;
use std::os::yggdrasil::io::message_channel::MessageChannel;
let channel = MessageChannel::open("log", false)?;
@ -69,7 +69,7 @@ impl Syslog {
}
pub fn send_str(&mut self, msg: &str) -> io::Result<()> {
use std::os::yggdrasil::io::{MessageDestination, MessageSender};
use std::os::yggdrasil::io::message_channel::{MessageDestination, MessageSender};
self.channel
.send_message(msg.as_bytes(), MessageDestination::Specific(0))

View File

@ -1,6 +1,6 @@
#![feature(yggdrasil_os)]
use std::os::yggdrasil::io::{MessageChannel, MessageReceiver};
use std::os::yggdrasil::io::message_channel::{MessageChannel, MessageReceiver};
fn main() {
let channel = MessageChannel::open("log", true).unwrap();

View File

@ -5,7 +5,10 @@ use std::{
io::{self, stdin, stdout, BufRead, Write},
os::{
fd::AsRawFd,
yggdrasil::io::{start_terminal_session, DeviceRequest, FdDeviceRequest},
yggdrasil::io::{
device::{DeviceRequest, FdDeviceRequest},
terminal::start_terminal_session,
},
},
process::{self, Command, ExitCode},
};

View File

@ -1,5 +1,8 @@
#![feature(rustc_private, yggdrasil_os)]
use std::{process::ExitCode, os::yggdrasil::io::{MountOptions, mount_raw}};
use std::{
os::yggdrasil::io::device::{mount_raw, MountOptions},
process::ExitCode,
};
use clap::Parser;

View File

@ -2,7 +2,7 @@
use std::{
io,
os::yggdrasil::io::{MessageChannel, MessageDestination, MessageSender},
os::yggdrasil::io::message_channel::{MessageChannel, MessageDestination, MessageSender},
process::ExitCode,
};

View File

@ -5,7 +5,10 @@ use std::{
io::{Read, Write},
os::{
fd::{AsRawFd, FromRawFd, RawFd},
yggdrasil::io::{create_pty, PollChannel, TerminalOptions, TerminalSize},
yggdrasil::io::{
poll::PollChannel,
terminal::{create_pty, TerminalOptions, TerminalSize},
},
},
process::{Child, Command, ExitCode, Stdio},
sync::{