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.
| 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 = "*" |
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.
Ooof, this is painful, does this even build in CI as a result?
There was a problem hiding this comment.
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", |
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.