qemu-fw-cfg

Crates.ioqemu-fw-cfg
lib.rsqemu-fw-cfg
version0.2.0
created_at2021-10-12 19:05:10.6035+00
updated_at2023-04-04 18:04:16.530207+00
descriptionA Rust library for reading fw_cfg from QEMU
homepagehttps://github.com/lion328/qemu-fw-cfg-rs
repositoryhttps://github.com/lion328/qemu-fw-cfg-rs
max_upload_size
id464094
size46,997
Waritnan Sookbuntherng (lion328)

documentation

README

qemu-fw-cfg-rs

Crates.io License-MIT License-Apache docs.rs

A Rust library for reading fw_cfg from QEMU.

Usage

Add the following to your Cargo.toml:

[dependencies]
qemu-fw-cfg = "0.1"

To use qemu-fw-cfg without alloc, you can use this instead:

[dependencies]
qemu-fw-cfg = { version = "0.1", default-features = false }

Examples

use qemu_fw_cfg::FwCfg;

// Verify that we are inside QEMU.
if running_in_qemu() {
    // Create a new `FwCfg` instance.
    let fw_cfg = unsafe { FwCfg::new().unwrap() };
    // Retrieve information of a file.
    let file = fw_cfg.find_file("etc/igd-opregion").unwrap();
    // Read data from the file.
    let data = fw_cfg.read_file(&file);
}

Rust support

The minimum supported Rust version for qemu-fw-cfg is 1.59.0.

However, testing for x86 currently requires Rust Nightly as it uses Cargo’s build-std.

License

This project is licensed under either of Apache License, Version 2.0 or MIT license at your option.

Commit count: 51

cargo fmt