libtopo: examples and README polish#6
Open
smklein wants to merge 1 commit into
Open
Conversation
3724506 to
28b13c4
Compare
28b13c4 to
6f9d60a
Compare
31a5cae to
f5e9e7a
Compare
e02a2ae to
bd84627
Compare
3acea59 to
ee635cd
Compare
ee635cd to
d790388
Compare
bf2ebf1 to
6fa8597
Compare
d790388 to
1dd188a
Compare
Two runnable examples plus README updates to reflect the now-functional
API.
Examples (libtopo/examples/):
- list_topology.rs: opens a handle, takes a snapshot, walks a topology
scheme, and prints each node's name[instance], FMRI, and label.
Defaults to the `hc` scheme; accepts an optional scheme name as the
first positional argument to walk a different one. Pass `-v` /
`--verbose` (anywhere in argv) to also dump every property group and
property under each node, e.g.
pfexec cargo run --example list_topology -- cpu
pfexec cargo run --example list_topology -- pcie -v
Exercises TopoHdl::open + snapshot + Snapshot::walk + node.resource()
+ hdl.fmri_to_string + node.label() + node.property_groups() (in
verbose mode), with a per-PropValue printer.
- fmri_resolve.rs: takes an FMRI string on argv, parses it via
fmri_parse, then prints present / replaced / unusable. Exercises
TopoHdl::fmri_parse + fmri_to_string + fmri_present + fmri_replaced
+ fmri_unusable.
Both examples were verified end-to-end on a Helios 3 host with various
scheme arguments and the verbose flag.
READMEs:
- libtopo/README.md: replace cargo-new placeholder with an idiomatic
usage block (TopoHdl::open + snapshot + walk + resource +
fmri_to_string) and notes on pfexec, examples, and CI behavior.
Fixes typo "this create provids" -> "this crate provides".
- README.md (root): expand from a one-liner to mirror fmd-adm /
illumos-nvpair structure (intro, crates breakdown, usage example,
privileges, testing).
No code changes in the wrapper crate; only examples and docs.
Quality gate on Helios 3: cargo fmt --check, cargo build --all-targets,
cargo clippy --all-targets -- -D warnings, pfexec cargo test all green.
Example runs verified for default (hc), cpu, pcie, verbose mode, and
an unknown-scheme rejection path.
1dd188a to
62e371a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fourth and final PR in the libtopo wrapper stack. Adds two runnable examples and updates the READMEs to reflect the now-functional API. Stacked on
libtopo-walker-fmri-props.Examples
libtopo/examples/list_topology.rs— opens a handle, takes a snapshot, walks a topology scheme, prints each node's name[instance], FMRI, and label. Defaults tohc; accepts an optional scheme name as the first argv:Exercises
TopoHdl::open+snapshot+Snapshot::walk+node.resource()+hdl.fmri_to_string+node.label().libtopo/examples/fmri_resolve.rs— takes an FMRI string on argv, parses it, then printspresent/replaced/unusable. Exercisesfmri_parse+fmri_to_string+fmri_present+fmri_replaced+fmri_unusable.Verified end-to-end on a Helios 3 host across
hc,cpu,pcie, and an unknown-scheme rejection.READMEs
libtopo/README.md— replace cargo-new placeholder with idiomatic usage block, notes onpfexec, examples, and CI behavior. Fixes typo "this create provids" → "this crate provides".README.md(root) — expand from one-liner to mirrorfmd-adm/illumos-nvpairstructure: intro, crates breakdown, usage, privileges, testing.No code changes in the wrapper crate; only examples and docs.
Test plan
cargo fmt --check,cargo build --all-targets,cargo clippy --all-targets -- -D warnings,pfexec cargo testall green