-
Notifications
You must be signed in to change notification settings - Fork 120
Add the json-sysctl demo from the LSSNA talk #122
base: master
Are you sure you want to change the base?
Conversation
Another possible idea: write a custom derive https://serde.rs/deserialize-map.html to create sysctls based on a JSON map that's passed in. Probably won't get to implementing that. |
@alex please see the most recent commit, which should actually fix small reads. I'll rebase later today |
Motivation is json-sysctl (#122) where we need this to return things like ENOMEM.
tests/json-sysctl/Cargo.toml
Outdated
|
||
[dependencies] | ||
linux-kernel-module = { path = "../.." } | ||
serde = { version = "*", default-features = false , features = ["derive"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serde = { version = "*", default-features = false , features = ["derive"] } | |
serde = { version = "1.0", default-features = false , features = ["derive"] } |
tests/json-sysctl/Cargo.toml
Outdated
linux-kernel-module = { path = "../.." } | ||
serde = { version = "*", default-features = false , features = ["derive"] } | ||
serde-json-core = { git = "https://github.com/japaric/serde-json-core" } | ||
typenum = "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a real version here please
tests/json-sysctl/Cargo.toml
Outdated
# all features, so even though our runtime dependency serde-json-core | ||
# indirectly depends on byteorder without default features, Cargo | ||
# confuses the two. See https://github.com/rust-lang/cargo/issues/5730 | ||
#byteorder = { path = "/root/byteorder" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof, this is painful, does this even build in CI as a result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not, but it's skipped in CI since no tests directory exists.
I considered adding something to .travis.yml to make it build, happy to do that and make an empty test directory (or even write some tests) if you'd like.
tests/json-sysctl/src/lib.rs
Outdated
|
||
linux_kernel_module::kernel_module!( | ||
JsonSysctlModule, | ||
author: "Alex Gaynor and Geoffrey Thomas", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FiaB auhors
3406d91
to
9dd5bfb
Compare
So, the cargo bug no longer seems to affect us, tests pass without a locally-hacked byteorder crate. There's some future work, including
but I'd like to do that in a separate commit. |
I wonder what should be done to get this json systemctl demo merged. |
@stappersg I need to have a little bit of time to polish off the last few things. Maybe I will this week. |
The good thing of merging demos is that it attracts more demos. |
Depends on a byteorder crate locally patched to make std not a default
feature, see #121 for why.