mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
regex search/replace instances of xous_ipc::String to String
core xous services cluster
This commit is contained in:
parent
916c98fd5c
commit
1d9316f9cd
7 changed files with 27 additions and 29 deletions
|
|
@ -20,8 +20,9 @@ num-traits = { version = "0.2.14", default-features = false }
|
||||||
utralib = { version = "0.1.24", optional = true, default-features = false }
|
utralib = { version = "0.1.24", optional = true, default-features = false }
|
||||||
|
|
||||||
# for USB serial logging
|
# for USB serial logging
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
|
||||||
cramium-hal = { path = "../../libs/cramium-hal", optional = true, default-features = false, features = [
|
cramium-hal = { path = "../../libs/cramium-hal", optional = true, default-features = false, features = [
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,15 @@ impl Default for ConnectRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "usb")]
|
#[cfg(feature = "usb")]
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone)]
|
||||||
pub struct UsbString {
|
pub struct UsbString {
|
||||||
pub s: xous_ipc::String<4000>,
|
pub s: String,
|
||||||
pub sent: Option<u32>,
|
pub sent: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "usb")]
|
#[cfg(feature = "usb")]
|
||||||
fn usb_send_str(conn: xous::CID, s: &str) {
|
fn usb_send_str(conn: xous::CID, s: &str) {
|
||||||
let serializer = UsbString { s: xous_ipc::String::<4000>::from_str(s), sent: None };
|
let serializer = UsbString { s: String::from(s), sent: None };
|
||||||
let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error");
|
let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error");
|
||||||
// failures to send are silent & ignored; also, this API doesn't block.
|
// failures to send are silent & ignored; also, this API doesn't block.
|
||||||
buf.send(conn, 8192 /* LogString */).expect("usb error");
|
buf.send(conn, 8192 /* LogString */).expect("usb error");
|
||||||
|
|
@ -48,7 +48,7 @@ fn reader_thread(arg: usize) {
|
||||||
let mut usb_serial: Option<xous::CID> = None;
|
let mut usb_serial: Option<xous::CID> = None;
|
||||||
// use a stack-allocated string to ensure no heap thrashing results from String manipulations
|
// use a stack-allocated string to ensure no heap thrashing results from String manipulations
|
||||||
#[cfg(feature = "usb")]
|
#[cfg(feature = "usb")]
|
||||||
let mut usb_str = xous_ipc::String::<4000>::new();
|
let mut usb_str = String::new();
|
||||||
|
|
||||||
println!("LOG: my PID is {}", xous::process::id());
|
println!("LOG: my PID is {}", xous::process::id());
|
||||||
let mut counter: usize = 0;
|
let mut counter: usize = 0;
|
||||||
|
|
@ -124,21 +124,21 @@ fn reader_thread(arg: usize) {
|
||||||
// inefficient
|
// inefficient
|
||||||
write!(usb_str, "{}:", level).ok();
|
write!(usb_str, "{}:", level).ok();
|
||||||
for c in module_slice {
|
for c in module_slice {
|
||||||
usb_str.push_byte(*c).ok();
|
usb_str.push(*c as char);
|
||||||
}
|
}
|
||||||
write!(usb_str, ": ").ok();
|
write!(usb_str, ": ").ok();
|
||||||
for c in args_slice {
|
for c in args_slice {
|
||||||
usb_str.push_byte(*c).ok();
|
usb_str.push(*c as char);
|
||||||
}
|
}
|
||||||
write!(usb_str, " (").ok();
|
write!(usb_str, " (").ok();
|
||||||
for c in file_slice {
|
for c in file_slice {
|
||||||
usb_str.push_byte(*c).ok();
|
usb_str.push(*c as char);
|
||||||
}
|
}
|
||||||
if let Some(line) = lr.line {
|
if let Some(line) = lr.line {
|
||||||
write!(usb_str, ":{}", line.get()).ok();
|
write!(usb_str, ":{}", line.get()).ok();
|
||||||
}
|
}
|
||||||
writeln!(usb_str, ")").ok();
|
writeln!(usb_str, ")").ok();
|
||||||
usb_send_str(conn, usb_str.to_str());
|
usb_send_str(conn, &usb_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
api::Opcode::StandardOutput | api::Opcode::StandardError => {
|
api::Opcode::StandardOutput | api::Opcode::StandardError => {
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ xous-ipc = "0.9.63"
|
||||||
num-derive = { version = "0.3.3", default-features = false }
|
num-derive = { version = "0.3.3", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
utralib = { version = "0.1.24", optional = true, default-features = false }
|
utralib = { version = "0.1.24", optional = true, default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use num_traits::FromPrimitive;
|
||||||
use xous::{msg_blocking_scalar_unpack, MessageEnvelope};
|
use xous::{msg_blocking_scalar_unpack, MessageEnvelope};
|
||||||
use xous_api_names::api::*;
|
use xous_api_names::api::*;
|
||||||
use xous_api_names::*;
|
use xous_api_names::*;
|
||||||
use xous_ipc::{Buffer, String};
|
use xous_ipc::Buffer;
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -371,9 +371,7 @@ fn main() -> ! {
|
||||||
let mem = msg.body.memory_message_mut().unwrap();
|
let mem = msg.body.memory_message_mut().unwrap();
|
||||||
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
||||||
let registration = buffer.to_original::<Registration, _>().unwrap();
|
let registration = buffer.to_original::<Registration, _>().unwrap();
|
||||||
let name = XousServerName::from_str(
|
let name = XousServerName::from_str(registration.name.as_str());
|
||||||
registration.name.as_str().expect("couldn't convert server name to string"),
|
|
||||||
);
|
|
||||||
|
|
||||||
let response: api::Return;
|
let response: api::Return;
|
||||||
let mut should_connect = false;
|
let mut should_connect = false;
|
||||||
|
|
@ -462,10 +460,8 @@ fn main() -> ! {
|
||||||
Some(api::Opcode::Lookup) => {
|
Some(api::Opcode::Lookup) => {
|
||||||
let mem = msg.body.memory_message_mut().unwrap();
|
let mem = msg.body.memory_message_mut().unwrap();
|
||||||
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
||||||
let name_string = buffer.to_original::<String<64>, _>().unwrap();
|
let name_string = buffer.to_original::<String, _>().unwrap();
|
||||||
let name = XousServerName::from_str(
|
let name = XousServerName::from_str(name_string.as_str());
|
||||||
name_string.as_str().expect("couldn't convert server name to string"),
|
|
||||||
);
|
|
||||||
log::trace!("Lookup request for '{}'", name);
|
log::trace!("Lookup request for '{}'", name);
|
||||||
let response: api::Return;
|
let response: api::Return;
|
||||||
if let (Some(server_sid), token) = name_table.connect(&name) {
|
if let (Some(server_sid), token) = name_table.connect(&name) {
|
||||||
|
|
@ -494,9 +490,7 @@ fn main() -> ! {
|
||||||
// here eventually.
|
// here eventually.
|
||||||
let (c1, c2, c3, c4) = xous::create_server_id().unwrap().to_u32();
|
let (c1, c2, c3, c4) = xous::create_server_id().unwrap().to_u32();
|
||||||
let auth_request = AuthenticateRequest {
|
let auth_request = AuthenticateRequest {
|
||||||
name: String::<64>::from_str(
|
name: String::from(name_string.as_str()),
|
||||||
name_string.as_str().expect("couldn't convert server name to string"),
|
|
||||||
),
|
|
||||||
pubkey_id: [0; 20], // placeholder
|
pubkey_id: [0; 20], // placeholder
|
||||||
challenge: [c1, c2, c3, c4],
|
challenge: [c1, c2, c3, c4],
|
||||||
};
|
};
|
||||||
|
|
@ -524,7 +518,7 @@ fn main() -> ! {
|
||||||
let mem = msg.body.memory_message_mut().unwrap();
|
let mem = msg.body.memory_message_mut().unwrap();
|
||||||
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
let mut buffer = unsafe { Buffer::from_memory_message_mut(mem) };
|
||||||
let disconnect = buffer.to_original::<Disconnect, _>().unwrap();
|
let disconnect = buffer.to_original::<Disconnect, _>().unwrap();
|
||||||
let name = XousServerName::from_str(disconnect.name.as_str().unwrap());
|
let name = XousServerName::from_str(disconnect.name.as_str());
|
||||||
let response = if name_table.disconnect_with_token(&name, disconnect.token) {
|
let response = if name_table.disconnect_with_token(&name, disconnect.token) {
|
||||||
api::Return::Success
|
api::Return::Success
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,9 @@ log = "0.4.14"
|
||||||
|
|
||||||
num-derive = { version = "0.3.3", default-features = false }
|
num-derive = { version = "0.3.3", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ xous-names = { package = "xous-api-names", version = "0.9.61" }
|
||||||
log-server = { package = "xous-api-log", version = "0.1.59" }
|
log-server = { package = "xous-api-log", version = "0.1.59" }
|
||||||
susres = { package = "xous-api-susres", version = "0.9.59" }
|
susres = { package = "xous-api-susres", version = "0.9.59" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
] }
|
] }
|
||||||
num-derive = { version = "0.3.3", default-features = false }
|
num-derive = { version = "0.3.3", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ fn main() -> ! {
|
||||||
#[cfg(not(feature = "timestamp"))]
|
#[cfg(not(feature = "timestamp"))]
|
||||||
{
|
{
|
||||||
let v = crate::api::VersionString {
|
let v = crate::api::VersionString {
|
||||||
version: xous_ipc::String::from_str("--no-timestamp requested for build"),
|
version: String::from("--no-timestamp requested for build"),
|
||||||
};
|
};
|
||||||
buf.replace(v).unwrap();
|
buf.replace(v).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue