From 9aaf24837477ee5aaf3ab448ff2977a09b61bd22 Mon Sep 17 00:00:00 2001 From: pjht Date: Thu, 6 Jun 2024 22:01:16 -0500 Subject: [PATCH] Change to use std --- Cargo.lock | 231 +++-------------------------------------------------- Cargo.toml | 2 +- src/lib.rs | 9 +-- 3 files changed, 15 insertions(+), 227 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e56c185..4ec9784 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,85 +2,18 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bit_field" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - [[package]] name = "cobs" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" -[[package]] -name = "core2" -version = "0.4.0" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "crossbeam-queue" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "derive-try-from-primitive" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302ccf094df1151173bb6f5a2282fcd2f45accd5eae1bdf82dcbfefbc501ad5c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "dev_driver_rpc" version = "0.1.0" @@ -88,53 +21,6 @@ dependencies = [ "postcard", "serde", "spin", - "std", -] - -[[package]] -name = "elfloader" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a249d6a9d50f3bf5a3cb7bfd75e84989cad89c6c77b5996c8b084e844146ff04" -dependencies = [ - "bitflags", - "log", - "xmas-elf", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] - -[[package]] -name = "libc" -version = "0.2.132" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" - -[[package]] -name = "linked_list_allocator" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "636c3bc929db632724303109c88d5d559a2a60f62243bb041387f03fa081d94a" -dependencies = [ - "spinning_top", ] [[package]] @@ -147,27 +33,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "once_cell" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" - [[package]] name = "postcard" version = "1.0.2" @@ -180,28 +45,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] -[[package]] -name = "rustversion" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" - [[package]] name = "scopeguard" version = "1.1.0" @@ -210,18 +69,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -237,36 +96,11 @@ dependencies = [ "lock_api", ] -[[package]] -name = "spinning_top" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75adad84ee84b521fb2cca2d4fd0f1dab1d8d026bda3c5bea4ca63b5f9f9293c" -dependencies = [ - "lock_api", -] - -[[package]] -name = "std" -version = "0.1.0" -dependencies = [ - "core2", - "crossbeam-queue", - "derive-try-from-primitive", - "elfloader", - "hashbrown", - "linked_list_allocator", - "postcard", - "serde", - "spin", - "x86_64", -] - [[package]] name = "syn" -version = "1.0.99" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -278,48 +112,3 @@ name = "unicode-ident" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "volatile" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ca98349dda8a60ae74e04fd90c7fb4d6a4fbe01e6d3be095478aa0b76f6c0c" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "x86_64" -version = "0.14.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100555a863c0092238c2e0e814c1096c1e5cf066a309c696a87e907b5f8c5d69" -dependencies = [ - "bit_field", - "bitflags", - "rustversion", - "volatile", -] - -[[package]] -name = "xmas-elf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d29b4d8e7beaceb4e77447ba941a7600d23d0319ab52da0461abea214832d5a" -dependencies = [ - "zero", -] - -[[package]] -name = "zero" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1bc8a6b2005884962297587045002d8cfb8dcec9db332f4ca216ddc5de82c5" diff --git a/Cargo.toml b/Cargo.toml index 7e08e7b..3809545 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" postcard = { version = "1.0.2", default-features = false, features = ["alloc"] } serde = { version = "1.0.144", default-features = false, features = ["alloc", "derive"] } spin = "0.9.4" -std = { version = "0.1.0", path = "../std" } +# std = { version = "0.1.0", path = "../std" } [profile.dev] panic="abort" diff --git a/src/lib.rs b/src/lib.rs index b0346d2..a91dd8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,9 @@ -#![no_std] +// #![no_std] #![allow(clippy::result_unit_err)] use std::{ - boxed::Box, io, - ipc::rpc::{self, IncomingCall}, + os::mikros::ipc::rpc::{self, IncomingCall}, }; use spin::RwLock; @@ -25,7 +24,7 @@ impl Client { Self(pid) } - pub fn open(self, path: &str) -> Result { + pub fn open(self, path: &str) -> Result { postcard::from_bytes( &rpc::send_call(self.0, PROTO, 0, &postcard::to_allocvec(path).unwrap()).get_return(), ) @@ -48,7 +47,7 @@ fn callback(call: IncomingCall) { let server = server_lock.as_ref().unwrap(); if call.func == 0 { let path = postcard::from_bytes(&call.args).unwrap(); - let ret = postcard::to_allocvec(&server.open(path)).unwrap(); + let ret = postcard::to_allocvec(&server.open(path).map_err(|e| ())).unwrap(); call.send_return(&ret); } }