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
78 changes: 42 additions & 36 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spin = { version = "0.10.0", default-features = false, features = [
static_assertions = "1.1"
x86 = "0.52"
xmodem = { git = "https://github.com/oxidecomputer/xmodem.rs", default-features = false }
zmodem2 = { git = "https://github.com/oxidecomputer/zmodem2", branch = "nostd", default-features = false }
zmodem2 = { git = "https://github.com/oxidecomputer/zmodem2", default-features = false }

[profile.dev]
panic = "abort"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-04-22"
channel = "nightly-2025-05-23"
components = [ "rustfmt", "rust-src", "llvm-tools", "clippy", "miri", "rust-analyzer" ]
5 changes: 5 additions & 0 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ impl BumpAlloc {

/// Attempts to allocate a region of memory of the given
/// alignment and size.
///
/// Note that allocators are an explicit example of a use
/// case where the clippy `mut_from_ref` lint gives false
/// positives.
#[allow(clippy::mut_from_ref)]
pub(crate) fn alloc_bytes(
&self,
align: usize,
Expand Down
14 changes: 7 additions & 7 deletions src/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ pub const NANOS_PER_SEC: u128 = 1_000_000_000;
/// Returns the clock frequency of the current CPU in Hertz.
pub fn frequency() -> u128 {
const DEFAULT_HZ: u128 = 2_000_000_000;
if let Some(tsc_info) = cpuid::tscinfo() {
if tsc_info.nominal_frequency() != 0 {
return tsc_info
.tsc_frequency()
.map(|freq| freq.into())
.unwrap_or(DEFAULT_HZ);
}
if let Some(tsc_info) = cpuid::tscinfo()
&& tsc_info.nominal_frequency() != 0
{
return tsc_info
.tsc_frequency()
.map(|freq| freq.into())
.unwrap_or(DEFAULT_HZ);
}
DEFAULT_HZ
}
Expand Down
19 changes: 8 additions & 11 deletions src/cpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,12 @@ fn print_mode(mode: cpio_reader::Mode) {
let alt = |bit, t, f| {
if mode.contains(bit) { t } else { f }
};
// For some reason, the cpio reader library appears to have
// the meaning of these bits mirrored with respect to the owner
// bits.
print!("{}", alt(Mode::WORLD_READABLE, 'r', '-'));
print!("{}", alt(Mode::WORLD_WRITABLE, 'w', '-'));
print!("{}", alt(Mode::USER_READABLE, 'r', '-'));
print!("{}", alt(Mode::USER_WRITABLE, 'w', '-'));
if !mode.contains(Mode::SUID) {
print!("{}", alt(Mode::WORLD_EXECUTABLE, 'x', '-'));
print!("{}", alt(Mode::USER_EXECUTABLE, 'x', '-'));
} else {
print!("{}", alt(Mode::WORLD_EXECUTABLE, 's', 'S'));
print!("{}", alt(Mode::USER_EXECUTABLE, 's', 'S'));
}

print!("{}", alt(Mode::GROUP_READABLE, 'r', '-'));
Expand All @@ -133,11 +130,11 @@ fn print_mode(mode: cpio_reader::Mode) {
print!("{}", alt(Mode::GROUP_EXECUTABLE, 's', 'S'));
}

print!("{}", alt(Mode::USER_READABLE, 'r', '-'));
print!("{}", alt(Mode::USER_WRITABLE, 'w', '-'));
print!("{}", alt(Mode::WORLD_READABLE, 'r', '-'));
print!("{}", alt(Mode::WORLD_WRITABLE, 'w', '-'));
if !mode.contains(Mode::STICKY) {
print!("{}", alt(Mode::USER_EXECUTABLE, 'x', '-'));
print!("{}", alt(Mode::WORLD_EXECUTABLE, 'x', '-'));
} else {
print!("{}", alt(Mode::USER_EXECUTABLE, 't', 'T'));
print!("{}", alt(Mode::WORLD_EXECUTABLE, 't', 'T'));
}
}
8 changes: 4 additions & 4 deletions src/repl/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ pub fn read(
break;
}
}
if !tokens.is_empty() {
if let Token::Value(Value::Str(cmd)) = tokens[0].clone() {
tokens[0] = Token::Value(Value::Cmd(cmd));
}
if !tokens.is_empty()
&& let Token::Value(Value::Str(cmd)) = tokens[0].clone()
{
tokens[0] = Token::Value(Value::Cmd(cmd));
}
cmds.push(Command::Cmd(cmdline, tokens));
}
Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2021"

[dependencies]
clap = { version = "4.4", features = ["derive"] }
duct = "0.13"
duct = "1.0"