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.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
|
@ -39,6 +39,15 @@ dependencies = [
|
||||||
"yunqc",
|
"yunqc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "denali_client"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"mammoth",
|
||||||
|
"yunq",
|
||||||
|
"yunqc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked_list_allocator"
|
name = "linked_list_allocator"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
|
@ -174,7 +183,7 @@ dependencies = [
|
||||||
name = "yellowstone"
|
name = "yellowstone"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"denali",
|
"denali_client",
|
||||||
"mammoth",
|
"mammoth",
|
||||||
"victoriafalls",
|
"victoriafalls",
|
||||||
"voyageurs",
|
"voyageurs",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
|
"lib/client/denali_client",
|
||||||
"lib/mammoth",
|
"lib/mammoth",
|
||||||
"lib/voyageurs",
|
"lib/voyageurs",
|
||||||
"lib/yellowstone",
|
"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"));
|
|
@ -7,16 +7,10 @@ edition = "2021"
|
||||||
bitfield-struct = "0.8.0"
|
bitfield-struct = "0.8.0"
|
||||||
mammoth = { path = "../../lib/mammoth" }
|
mammoth = { path = "../../lib/mammoth" }
|
||||||
yunq = { path = "../../lib/yunq" }
|
yunq = { path = "../../lib/yunq" }
|
||||||
|
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||||
yellowstone-yunq = { path = "../../lib/yellowstone", optional = true }
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "denali"
|
name = "denali"
|
||||||
required-features = ["binary"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
yunqc = { path = "../../../yunq/rust" }
|
yunqc = { path = "../../../yunq/rust" }
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["binary"]
|
|
||||||
binary = ["dep:yellowstone-yunq"]
|
|
||||||
|
|
|
@ -7,5 +7,9 @@ define_entry!();
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn main() -> z_err_t {
|
extern "C" fn main() -> z_err_t {
|
||||||
|
let yellowstone = yellowstone_yunq::from_init_endpoint();
|
||||||
|
|
||||||
|
let denali = yellowstone.get_denali().unwrap();
|
||||||
|
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mammoth = { path = "../../lib/mammoth" }
|
mammoth = { path = "../../lib/mammoth" }
|
||||||
denali = { path = "../denali", default-features = false }
|
denali_client = { path = "../../lib/client/denali_client" }
|
||||||
victoriafalls = { path = "../victoriafalls" }
|
victoriafalls = { path = "../victoriafalls" }
|
||||||
voyageurs = { path = "../../lib/voyageurs" }
|
voyageurs = { path = "../../lib/voyageurs" }
|
||||||
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use denali::DenaliClient;
|
use denali_client::DenaliClient;
|
||||||
use mammoth::{cap::Capability, zion::ZError};
|
use mammoth::{cap::Capability, zion::ZError};
|
||||||
|
|
||||||
const MBR_SIG: u16 = 0xAA55;
|
const MBR_SIG: u16 = 0xAA55;
|
||||||
|
@ -47,9 +47,9 @@ struct PartitionEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_gpt(mut denali: DenaliClient) -> Result<u64, ZError> {
|
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,
|
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))?;
|
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
|
num_blocks
|
||||||
);
|
);
|
||||||
|
|
||||||
let resp = denali.read(&denali::ReadRequest {
|
let resp = denali.read(&denali_client::ReadRequest {
|
||||||
device_id: 0,
|
device_id: 0,
|
||||||
block: denali::DiskBlock {
|
block: denali_client::DiskBlock {
|
||||||
lba: lba_partition_entries,
|
lba: lba_partition_entries,
|
||||||
size: num_blocks,
|
size: num_blocks,
|
||||||
},
|
},
|
||||||
|
|
|
@ -122,7 +122,7 @@ impl YellowstoneServerHandler for YellowstoneServerImpl {
|
||||||
|
|
||||||
fn get_denali(&mut self) -> Result<DenaliInfo, ZError> {
|
fn get_denali(&mut self) -> Result<DenaliInfo, ZError> {
|
||||||
match self.context.service_map.lock().get("denali") {
|
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(),
|
ep_cap.duplicate(Capability::PERMS_ALL).unwrap(),
|
||||||
))
|
))
|
||||||
.map(|lba| DenaliInfo {
|
.map(|lba| DenaliInfo {
|
||||||
|
|
Loading…
Reference in New Issue