use kernel::alloc::flags; use kernel::c_str; use kernel::configfs; use kernel::configfs_attrs; use kernel::new_mutex; use kernel::page::PAGE_SIZE; use kernel::prelude::*; use kernel::sync::Mutex;
module! { type: RustConfigfs,
name: "rust_configfs",
authors: ["Rust for Linux Contributors"],
description: "Rust configfs sample",
license: "GPL",
}
// Define a subsystem with the data type `Configuration`, two // attributes, `message` and `bar` and child group type `Child`. `mkdir` // in the directory representing this subsystem will create directories // backed by the `Child` type. let item_type = configfs_attrs! {
container: configfs::Subsystem<Configuration>,
data: Configuration,
child: Child,
attributes: [
message: 0,
bar: 1,
],
};
#[vtable] impl configfs::GroupOperations for Configuration { type Child = Child;
fn make_group(&self, name: &CStr) -> Result<impl PinInit<configfs::Group<Child>, Error>> { // Define a group with data type `Child`, one attribute `baz` and child // group type `GrandChild`. `mkdir` in the directory representing this // group will create directories backed by the `GrandChild` type. let tpe = configfs_attrs! {
container: configfs::Group<Child>,
data: Child,
child: GrandChild,
attributes: [
baz: 0,
],
};
#[vtable] impl configfs::GroupOperations for Child { type Child = GrandChild;
fn make_group(&self, name: &CStr) -> Result<impl PinInit<configfs::Group<GrandChild>, Error>> { // Define a group with data type `GrandChild`, one attribute `gc`. As no // child type is specified, it will not be possible to create subgroups // in this group, and `mkdir`in the directory representing this group // will return an error. let tpe = configfs_attrs! {
container: configfs::Group<GrandChild>,
data: GrandChild,
attributes: [
gc: 0,
],
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.