Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,16 @@ jobs:
- name: Check the crates from outside the tree
# Cargo.lock lists every dependency of every package, for all
# targets and features, the build and test dependencies included.
# libc, lexopt, and sha2 with the crates it needs.
# libc, lexopt, sha2 and serde_json with the crates they need.
# serde_json and serde_core name serde and serde_derive for
# cfg(any()), which no target has, so that all three keep one
# version. So these two and the crates serde_derive needs are in
# Cargo.lock, and nothing builds them.
env:
EXPECTED: block-buffer cfg-if cpufeatures crypto-common digest hybrid-array lexopt libc sha2 typenum
EXPECTED: >-
block-buffer cfg-if cpufeatures crypto-common digest equivalent foldhash hashbrown hybrid-array
indexmap itoa lexopt libc memchr proc-macro2 quote serde serde_core serde_derive serde_json sha2
syn typenum unicode-ident zmij
run: |
deps=$(cargo metadata --locked --format-version 1 |
jq -r '.workspace_members as $m | .packages[] | select(.id as $i | $m | index($i) | not) | .name' |
Expand Down
137 changes: 129 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ members = [
"src/dlopen",
"src/dlopen-note",
"src/fat",
"src/json",
"src/uapi16",
"src/varlink",
"tools",
Expand All @@ -23,7 +22,6 @@ default-members = [
"src/dlopen",
"src/dlopen-note",
"src/fat",
"src/json",
"src/uapi16",
"src/varlink",
"tests/crash",
Expand All @@ -44,11 +42,16 @@ blkid = { path = "src/blkid" }
dlopen = { path = "src/dlopen" }
dlopen-note = { path = "src/dlopen-note" }
fat = { path = "src/fat" }
json = { path = "src/json" }
lexopt = "0.3.2"
# The _IO and _IOR helpers came with 0.2.172. Stay on 0.2: 1.0 may drop
# the LFS64 functions such as openat64 and fstatfs64.
libc = "0.2.191"
# Reads and writes JSON. What a manifest asks for beyond JSON is checked
# by src/uapi16/strict.rs. Never turn on arbitrary_precision: serde_json
# then hands numbers to the visitors of uapi16 and varlink as objects, see
# the crate docs of uapi16.
serde_core = "1.0.229"
serde_json = "1.0.154"
# 0.11.1 and later need rustc 1.88.
sha2 = { version = "0.11.0", default-features = false }
uapi16 = { path = "src/uapi16" }
Expand All @@ -69,7 +72,6 @@ publish.workspace = true

[dependencies]
fat.workspace = true
json.workspace = true
lexopt.workspace = true
libc.workspace = true
varlink.workspace = true
Expand Down
11 changes: 6 additions & 5 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Hacking on ufat

ufat is built with cargo. It depends on the libc, sha2 and lexopt
crates. lexopt parses the command line of the tool.
ufat is built with cargo. It depends on the libc, sha2, lexopt and
serde_json crates. lexopt parses the command line of the tool, and
serde_json reads and writes JSON.

ufat does not link against libblkid. It loads libblkid.so.1 with
dlopen() when it needs it. The workspace has a crate for each part of
Expand Down Expand Up @@ -48,8 +49,8 @@ With rustup, `cargo +1.85.0` selects rustc 1.85:

`cargo test` runs:

- the unit tests of the library and of the json, uapi16, varlink,
dlopen, dlopen-note and blkid crates,
- the unit tests of the library and of the uapi16, varlink, dlopen,
dlopen-note and blkid crates,
- the integration tests in tests/,
- the crash consistency harness.

Expand Down Expand Up @@ -279,7 +280,7 @@ every push to main and once a week. It runs:
- Kani with `--only-codegen`, which checks that every proof builds. The
proofs themselves need more time and memory than the CI has,
- a check that the crates from outside the tree are libc, lexopt, sha2
and the crates sha2 needs,
and serde_json, and the crates they need,
- bench/compare.sh with the release binary and that of the base: the
target branch for a pull request, main before a push, and main of a
week earlier for the weekly run. It accepts the regressions that the
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ tool and the service are the same binary.
- Writes are ordered so that a crash or a power loss leaves every file
in its old state, its new state, or absent. A file is never left
damaged.
- The code uses the Rust standard library and the crates libc, sha2 and
lexopt.
- The code uses the Rust standard library and the crates libc, sha2,
lexopt and serde_json.
- libblkid names what an image holds when it holds no FAT32 file
system, and keeps `assemble` from formatting over a file system or a
partition table. ufat loads it at run time when it is installed, and
Expand Down
1 change: 0 additions & 1 deletion bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ name = "measure"
path = "measure.rs"

[dependencies]
json.workspace = true
libc.workspace = true
varlink.workspace = true

Expand Down
19 changes: 12 additions & 7 deletions bench/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! bytes the child passed to read and write system calls.
//!
//! Like the rest of ufat, it uses the standard library and the libc crate,
//! and the json and varlink crates of this tree.
//! and the varlink crate of this tree.
//!
//! Usage:
//! measure [OPTIONS] -- COMMAND [ARGS...]
Expand Down Expand Up @@ -213,11 +213,16 @@ fn spawn_ufat(o: &Options) -> io::Result<(Child, UnixStream)> {
}

fn varlink_call(o: &Options, socket: UnixStream) -> io::Result<()> {
let Ok(json::Value::Object(params)) = json::parse(&o.params) else {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"--params is not a JSON object",
));
// A key twice is refused, as the service refuses it.
let params = match varlink::UniqueKeys::parse(&o.params) {
Ok(varlink::Value::Object(params)) => params,
Ok(_) => {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"--params is not a JSON object",
))
}
Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, format!("--params: {}", e))),
};
// The descriptors, in the order given: index n of the call is fds[n].
let mut files = Vec::new();
Expand All @@ -240,7 +245,7 @@ fn varlink_call(o: &Options, socket: UnixStream) -> io::Result<()> {
"{} failed: {} {}",
method,
e.name,
json::Value::Object(e.parameters)
varlink::Value::Object(e.parameters)
))),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/ufat/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ fn cmd_capabilities(argv: &[OsString]) -> Result<()> {
if !args.positional.is_empty() {
bail!(errno::EINVAL, "capabilities takes no arguments");
}
println!("{}", json::Value::Object(service::capabilities()?));
println!("{}", varlink::Value::Object(service::capabilities()?));
Ok(())
}

Expand Down
Loading