1#![allow(dead_code)]
2
3#[macro_use]
4extern crate scan_fmt;
5extern crate sysctl;
6
7use sysctl::Sysctl;
8
9#[cfg(target_os = "freebsd")]
10fn get_confxml() -> Result<String, Error> {
11 const CTLNAME: &str = "kern.geom.confxml";
12
13 let ctl = sysctl::Ctl::new(CTLNAME)?;
14 return Ok(ctl.value_string()?);
15}
16
17#[cfg(target_os = "freebsd")]
30pub fn get_graph() -> Result<Graph, Error> {
31 let raw_mesh = raw::get_mesh()?;
32 return graph::decode_graph(&raw_mesh);
33}
34
35#[cfg(all(test, target_os = "freebsd"))]
36mod tests_freebsd {
37 use crate::*;
38
39 #[test]
40 #[ignore = "not reproducible"]
41 fn getsysctlstr() {
42 let s = get_confxml().unwrap();
43 assert_ne!(s, "", "sysctl output is non-empty");
44 }
45}
46
47pub mod error;
49mod graph;
50pub mod structs;
51
52pub use error::Error;
53pub use graph::{
54 Edge, EdgeId, EdgeMetadata, Geom, GeomClass, Graph, Mode, NodeId, PartMetadata, PartScheme,
55 PartState,
56};
57pub use structs as raw;