Skip to content

Commit d951666

Browse files
authored
Merge pull request #23 from systemd/layout
Move every crate below src/
2 parents 81a0dca + 03af6bb commit d951666

73 files changed

Lines changed: 257 additions & 209 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
curl -sSfL --retry 3 -o "$ucd/$f" "https://www.unicode.org/Public/16.0.0/ucd/$f"
142142
done
143143
(cd "$ucd" && sha256sum -c "$GITHUB_WORKSPACE/tools/fold-table.sha256")
144-
cargo run --locked -q -p fold-table "$ucd" | diff -u src/name/fold_table.rs -
144+
cargo run --locked -q -p fold-table "$ucd" | diff -u src/fat/name/fold_table.rs -
145145
146146
clippy:
147147
name: clippy (rustc ${{ matrix.rust }})

‎Cargo.lock‎

Lines changed: 22 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22

33
[workspace]
4-
members = [".", "blkid", "dlopen", "dlopen-note", "json", "varlink", "tools", "tests/crash", "tests/fuzz", "bench"]
4+
members = [
5+
".",
6+
"src/blkid",
7+
"src/dlopen",
8+
"src/dlopen-note",
9+
"src/fat",
10+
"src/json",
11+
"src/varlink",
12+
"tools",
13+
"tests/crash",
14+
"tests/fuzz",
15+
"bench",
16+
]
517
# A plain `cargo build` or `cargo test` leaves out the case folding table
618
# generator, the fuzzing seeds and the benchmarks.
7-
default-members = [".", "blkid", "dlopen", "dlopen-note", "json", "varlink", "tests/crash"]
19+
default-members = [
20+
".",
21+
"src/blkid",
22+
"src/dlopen",
23+
"src/dlopen-note",
24+
"src/fat",
25+
"src/json",
26+
"src/varlink",
27+
"tests/crash",
28+
]
829
# cargo update picks dependency versions that support rust-version.
930
resolver = "3"
1031

@@ -17,18 +38,18 @@ license = "LGPL-2.1-or-later"
1738
publish = false
1839

1940
[workspace.dependencies]
20-
blkid = { path = "blkid" }
21-
dlopen = { path = "dlopen" }
22-
dlopen-note = { path = "dlopen-note" }
23-
json = { path = "json" }
41+
blkid = { path = "src/blkid" }
42+
dlopen = { path = "src/dlopen" }
43+
dlopen-note = { path = "src/dlopen-note" }
44+
fat = { path = "src/fat" }
45+
json = { path = "src/json" }
2446
lexopt = "0.3.2"
2547
# The _IO and _IOR helpers came with 0.2.172. Stay on 0.2: 1.0 may drop
2648
# the LFS64 functions such as openat64 and fstatfs64.
2749
libc = "0.2.191"
2850
# 0.11.1 and later need rustc 1.88.
2951
sha2 = { version = "0.11.0", default-features = false }
30-
ufat = { path = "." }
31-
varlink = { path = "varlink" }
52+
varlink = { path = "src/varlink" }
3253

3354
[workspace.lints.rust]
3455
unreachable_pub = "warn"
@@ -44,11 +65,10 @@ license.workspace = true
4465
publish.workspace = true
4566

4667
[dependencies]
47-
blkid.workspace = true
68+
fat.workspace = true
4869
json.workspace = true
4970
lexopt.workspace = true
5071
libc.workspace = true
51-
sha2.workspace = true
5272
varlink.workspace = true
5373

5474
[lints]

‎HACKING.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ That needs no cross linker.
9999

100100
## The case folding table
101101

102-
src/name/fold_table.rs is generated by tools/fold-table.rs from
102+
src/fat/name/fold_table.rs is generated by tools/fold-table.rs from
103103
UnicodeData.txt and SpecialCasing.txt of Unicode 16.0.0.
104104
tools/fold-table.sha256 holds their hashes. To check the table, download
105105
the two files, check their hashes, and compare the generated table with
@@ -109,7 +109,7 @@ the one in the tree:
109109
curl -sSfL -o ucd/UnicodeData.txt https://www.unicode.org/Public/16.0.0/ucd/UnicodeData.txt
110110
curl -sSfL -o ucd/SpecialCasing.txt https://www.unicode.org/Public/16.0.0/ucd/SpecialCasing.txt
111111
(cd ucd && sha256sum -c ../tools/fold-table.sha256)
112-
cargo run --locked -q -p fold-table ucd | diff -u src/name/fold_table.rs -
112+
cargo run --locked -q -p fold-table ucd | diff -u src/fat/name/fold_table.rs -
113113

114114
The table never changes. A newer Unicode version would make some names
115115
that differ today one name.
@@ -158,7 +158,7 @@ local build.
158158
## Crash consistency
159159

160160
tests/crash/crash.rs records the writes of a test scenario. It uses a
161-
copy of the library built with `--cfg ufat_trace`, the ufat-trace
161+
copy of the library built with `--cfg ufat_trace`, the fat-trace
162162
package. It then builds every state a crash could leave on the device
163163
and checks each one with fsck and against the expected files. Three
164164
models of the device are checked:
@@ -170,8 +170,8 @@ models of the device are checked:
170170
The harness runs as part of `cargo test`. For its full output, run it
171171
on its own:
172172

173-
cargo test --locked -p ufat-trace -- --nocapture
174-
UFAT_CRASH_FULL=1 cargo test --locked -p ufat-trace -- --nocapture
173+
cargo test --locked -p fat-trace -- --nocapture
174+
UFAT_CRASH_FULL=1 cargo test --locked -p fat-trace -- --nocapture
175175

176176
`UFAT_CRASH_FULL=1` checks every subset of the writes between two
177177
flushes instead of a sample.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ This recording uses varlinkctl to make an ESP image from a manifest:
309309

310310
## The library
311311

312-
The crate `ufat` provides the same operations as the tool:
312+
The crate `fat` provides the same operations as the tool:
313313

314314
- `format` creates a file system on a `device::Device`.
315315
- `volume::Volume` opens one and reads, writes, creates and removes

‎src/bin/ufat/cli.rs‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ use std::path::{Path, PathBuf};
88
use std::process::ExitCode;
99
use std::time::SystemTime;
1010

11-
use ufat::device::{Access, Device};
12-
use ufat::errno;
13-
use ufat::format::{self, FormatOptions, VolumeId};
14-
use ufat::fsck;
15-
use ufat::host;
16-
use ufat::layout::MIN_SECTOR_SIZE;
17-
use ufat::manifest::{self, AssembleOptions, DirectorySource, StreamSource};
18-
use ufat::plan::{Plan, PlanOptions};
19-
use ufat::populate::{CopyOptions, TimePolicy};
20-
use ufat::probe::Prober;
21-
use ufat::time::civil_from_days;
22-
use ufat::volume::Volume;
23-
use ufat::{bail, err, Context, Detail, Error, Result};
11+
use fat::device::{Access, Device};
12+
use fat::errno;
13+
use fat::format::{self, FormatOptions, VolumeId};
14+
use fat::fsck;
15+
use fat::host;
16+
use fat::layout::MIN_SECTOR_SIZE;
17+
use fat::manifest::{self, AssembleOptions, DirectorySource, StreamSource};
18+
use fat::plan::{Plan, PlanOptions};
19+
use fat::populate::{CopyOptions, TimePolicy};
20+
use fat::probe::Prober;
21+
use fat::time::civil_from_days;
22+
use fat::volume::Volume;
23+
use fat::{bail, err, Context, Detail, Error, Result};
2424

2525
use crate::service;
2626
use crate::util::{self, ImageFlags};
@@ -564,7 +564,7 @@ fn assemble_options(args: &Args) -> Result<AssembleOptions> {
564564
now_usec: if args.flag("no-check-validity") {
565565
None
566566
} else {
567-
Some(ufat::time::to_usec(util::now()))
567+
Some(fat::time::to_usec(util::now()))
568568
},
569569
})
570570
}
@@ -657,7 +657,7 @@ fn write_manifest(v: &Volume, path: &Path) -> Result<()> {
657657
}
658658

659659
/// Reports the geometry of a freshly made file system.
660-
fn report_layout(image: &Path, layout: &ufat::layout::Layout, verbose: bool) {
660+
fn report_layout(image: &Path, layout: &fat::layout::Layout, verbose: bool) {
661661
if verbose {
662662
eprintln!(
663663
"{}: {} sectors of {} bytes, {} clusters of {} bytes, {} reserved sectors, {} of {} sectors",
@@ -795,7 +795,7 @@ fn unfinished(v: Volume, e: Error) -> Error {
795795
e
796796
}
797797

798-
fn report_estimate(args: &Args, path: &Path, estimate: &ufat::plan::Estimate) {
798+
fn report_estimate(args: &Args, path: &Path, estimate: &fat::plan::Estimate) {
799799
if args.flag("verbose") {
800800
eprintln!(
801801
"{}: {} and {} in {} need a {} byte file system with {} byte clusters",
@@ -1087,7 +1087,7 @@ fn print_description(v: &Volume, out: &mut dyn Write) -> Result<()> {
10871087
writeln!(
10881088
out,
10891089
"note: below the FAT32 minimum of {} clusters",
1090-
ufat::layout::MIN_CLUSTERS
1090+
fat::layout::MIN_CLUSTERS
10911091
)?;
10921092
}
10931093
Ok(())

‎src/bin/ufat/main.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: LGPL-2.1-or-later
22
//! The ufat tool: a command line interface and a Varlink service over the
3-
//! ufat library.
3+
//! FAT library.
44
//!
55
//! Started with a socket passed through `LISTEN_FDS` (as `varlinkctl call
66
//! exec:/path/to/ufat ...` and systemd socket units do) it serves the
@@ -17,7 +17,7 @@ mod util;
1717
fn main() -> ExitCode {
1818
// A tree walk holds one descriptor per level; the soft limit of 1024
1919
// is select()'s, and nothing here uses select().
20-
let _ = ufat::host::raise_descriptor_limit();
20+
let _ = fat::host::raise_descriptor_limit();
2121
match varlink::activation() {
2222
Ok(Some(activation)) => match service::run(activation) {
2323
Ok(()) => ExitCode::SUCCESS,

0 commit comments

Comments
 (0)