Move denali client to separate lib.
This commit is contained in:
parent
c8f84ec352
commit
59efb1659a
|
@ -1,6 +1,6 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
|
@ -39,6 +39,15 @@ dependencies = [
|
|||
"yunqc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "denali_client"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"mammoth",
|
||||
"yunq",
|
||||
"yunqc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.10.5"
|
||||
|
@ -174,7 +183,7 @@ dependencies = [
|
|||
name = "yellowstone"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"denali",
|
||||
"denali_client",
|
||||
"mammoth",
|
||||
"victoriafalls",
|
||||
"voyageurs",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[workspace]
|
||||
|
||||
members = [
|
||||
"lib/client/denali_client",
|
||||
"lib/mammoth",
|
||||
"lib/voyageurs",
|
||||
"lib/yellowstone",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "denali_client"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
mammoth = { path = "../../mammoth" }
|
||||
yunq = { path = "../../yunq" }
|
||||
|
||||
[build-dependencies]
|
||||
yunqc = { path = "../../../../yunq/rust" }
|
|
@ -0,0 +1,14 @@
|
|||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
let input_file = "../../../../sys/denali/lib/denali/denali.yunq";
|
||||
|
||||
println!("cargo::rerun-if-changed={input_file}");
|
||||
|
||||
let input = fs::read_to_string(input_file).expect("Failed to read input file");
|
||||
|
||||
let code = yunqc::codegen(&input).expect("Failed to generate yunq code.");
|
||||
|
||||
let out = std::env::var("OUT_DIR").unwrap() + "/yunq.rs";
|
||||
fs::write(out, code).expect("Failed to write generated code.");
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#![no_std]
|
||||
|
||||
use core::include;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/yunq.rs"));
|
|
@ -6,17 +6,11 @@ edition = "2021"
|
|||
[dependencies]
|
||||
bitfield-struct = "0.8.0"
|
||||
mammoth = { path = "../../lib/mammoth" }
|
||||
yunq = {path = "../../lib/yunq"}
|
||||
|
||||
yellowstone-yunq = { path = "../../lib/yellowstone", optional = true }
|
||||
yunq = { path = "../../lib/yunq" }
|
||||
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||
|
||||
[[bin]]
|
||||
name = "denali"
|
||||
required-features = ["binary"]
|
||||
|
||||
[build-dependencies]
|
||||
yunqc = {path = "../../../yunq/rust"}
|
||||
|
||||
[features]
|
||||
default = ["binary"]
|
||||
binary = ["dep:yellowstone-yunq"]
|
||||
yunqc = { path = "../../../yunq/rust" }
|
||||
|
|
|
@ -7,5 +7,9 @@ define_entry!();
|
|||
|
||||
#[no_mangle]
|
||||
extern "C" fn main() -> z_err_t {
|
||||
let yellowstone = yellowstone_yunq::from_init_endpoint();
|
||||
|
||||
let denali = yellowstone.get_denali().unwrap();
|
||||
|
||||
0
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
mammoth = { path = "../../lib/mammoth" }
|
||||
denali = { path = "../denali", default-features = false }
|
||||
denali_client = { path = "../../lib/client/denali_client" }
|
||||
victoriafalls = { path = "../victoriafalls" }
|
||||
voyageurs = { path = "../../lib/voyageurs" }
|
||||
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use denali::DenaliClient;
|
||||
use denali_client::DenaliClient;
|
||||
use mammoth::{cap::Capability, zion::ZError};
|
||||
|
||||
const MBR_SIG: u16 = 0xAA55;
|
||||
|
@ -47,9 +47,9 @@ struct PartitionEntry {
|
|||
}
|
||||
|
||||
pub fn read_gpt(mut denali: DenaliClient) -> Result<u64, ZError> {
|
||||
let resp = denali.read(&denali::ReadRequest {
|
||||
let resp = denali.read(&denali_client::ReadRequest {
|
||||
device_id: 0,
|
||||
block: denali::DiskBlock { lba: 0, size: 2 },
|
||||
block: denali_client::DiskBlock { lba: 0, size: 2 },
|
||||
})?;
|
||||
|
||||
let first_lbas = mammoth::mem::MemoryRegion::from_cap(Capability::take(resp.memory))?;
|
||||
|
@ -99,9 +99,9 @@ pub fn read_gpt(mut denali: DenaliClient) -> Result<u64, ZError> {
|
|||
num_blocks
|
||||
);
|
||||
|
||||
let resp = denali.read(&denali::ReadRequest {
|
||||
let resp = denali.read(&denali_client::ReadRequest {
|
||||
device_id: 0,
|
||||
block: denali::DiskBlock {
|
||||
block: denali_client::DiskBlock {
|
||||
lba: lba_partition_entries,
|
||||
size: num_blocks,
|
||||
},
|
||||
|
|
|
@ -122,7 +122,7 @@ impl YellowstoneServerHandler for YellowstoneServerImpl {
|
|||
|
||||
fn get_denali(&mut self) -> Result<DenaliInfo, ZError> {
|
||||
match self.context.service_map.lock().get("denali") {
|
||||
Some(ep_cap) => crate::gpt::read_gpt(denali::DenaliClient::new(
|
||||
Some(ep_cap) => crate::gpt::read_gpt(denali_client::DenaliClient::new(
|
||||
ep_cap.duplicate(Capability::PERMS_ALL).unwrap(),
|
||||
))
|
||||
.map(|lba| DenaliInfo {
|
||||
|
|
Loading…
Reference in New Issue