From 5dd3ef6603e00390e944ea49993bfa71fb49312c Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:00:25 -0500 Subject: [PATCH 1/8] Add SPDX header to generated device-path code --- uefi-raw/src/protocol/device_path/device_path_gen.rs | 2 ++ uefi/src/proto/device_path/device_path_gen.rs | 2 ++ xtask/src/device_path/mod.rs | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/uefi-raw/src/protocol/device_path/device_path_gen.rs b/uefi-raw/src/protocol/device_path/device_path_gen.rs index 33c6dc4b0..9914779c4 100644 --- a/uefi-raw/src/protocol/device_path/device_path_gen.rs +++ b/uefi-raw/src/protocol/device_path/device_path_gen.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // DO NOT EDIT // // This file was automatically generated with: diff --git a/uefi/src/proto/device_path/device_path_gen.rs b/uefi/src/proto/device_path/device_path_gen.rs index 10d19ebba..8154da885 100644 --- a/uefi/src/proto/device_path/device_path_gen.rs +++ b/uefi/src/proto/device_path/device_path_gen.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // DO NOT EDIT // // This file was automatically generated with: diff --git a/xtask/src/device_path/mod.rs b/xtask/src/device_path/mod.rs index 02bc8e732..c22c7fb34 100644 --- a/xtask/src/device_path/mod.rs +++ b/xtask/src/device_path/mod.rs @@ -24,7 +24,8 @@ fn code_to_string(code: TokenStream) -> Result { let code = code.to_string().replace('}', "}\n\n"); let output = format!( - " + "// SPDX-License-Identifier: MIT OR Apache-2.0 + // DO NOT EDIT // // This file was automatically generated with: From 7e5b1b48124ac6c96b887598f836d4890e3e096c Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 17:38:42 -0500 Subject: [PATCH 2/8] xtask: Add file header check to xtask fmt This will be used to verify that source files (just *.rs for now) all have an SPDX license header. In non-check mode, the license header will be added. For now, in check mode an error is shown but it's not treated as fatal. Once all files have been fixed, the error will be made fatal. --- xtask/src/main.rs | 82 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 9d3763cf9..78dd9de63 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -233,6 +233,27 @@ fn run_host_tests(test_opt: &TestOpt) -> Result<()> { fn run_fmt_project(fmt_opt: &FmtOpt) -> Result<()> { let mut any_errors = false; + { + eprintln!("Formatting: file headers"); + + match format_file_headers(fmt_opt) { + Ok(_) => { + eprintln!("✅ expected file headers present") + } + Err(e) => { + if fmt_opt.check { + eprintln!("❌ {e:#?}"); + // TODO: Make this a hard error after all the headers have + // been added. + eprintln!("...ignoring for now"); + } else { + eprintln!("❌ rust formatter failed: {e:#?}"); + any_errors = true; + } + } + } + } + // fmt rust { eprintln!("Formatting: rust"); @@ -323,6 +344,67 @@ fn run_fmt_project(fmt_opt: &FmtOpt) -> Result<()> { Ok(()) } +/// Check that SPDX file headers are present. +/// +/// If not in check mode, add any missing headers. +fn format_file_headers(fmt_opt: &FmtOpt) -> Result<()> { + const EXPECTED_HEADER: &str = "// SPDX-License-Identifier: MIT OR Apache-2.0\n\n"; + + // Path prefixes that should not be checked/formatted. + const EXCLUDE_PATH_PREFIXES: &[&str] = &[ + // A user copying the template or uefi-std-example does not need to use + // our license. + "template/src/main.rs", + "uefi-std-example/src/main.rs", + // This directory contains short code snippets used in `trybuild` tests, + // no license needed. + "uefi-macros/tests/ui/", + ]; + + // Recursively get Rust files + let mut cmd = Command::new("git"); + cmd.args(["ls-files", "*.rs"]); + let output = cmd.output()?; + if !output.status.success() { + bail!("command failed: {}", output.status); + } + let mut paths: Vec<&str> = std::str::from_utf8(&output.stdout)?.lines().collect(); + + // Filter out excluded paths. + paths.retain(|path| { + !EXCLUDE_PATH_PREFIXES + .iter() + .any(|prefix| path.starts_with(prefix)) + }); + + // Paths that are missing the file header (only used in check mode). + let mut missing = Vec::new(); + + // Format or check each path. + for path in paths { + let text = fs_err::read_to_string(path)?; + if text.starts_with(EXPECTED_HEADER) { + // File header is present, nothing to do. + continue; + } + + if fmt_opt.check { + // Add to the list of paths missing file headers. + missing.push(path); + } else { + // Rewrite the file to prepend the header. + let text = EXPECTED_HEADER.to_owned() + &text; + fs_err::write(path, text)?; + } + } + + if fmt_opt.check && !missing.is_empty() { + bail!("expected header missing from {}", missing.join(", ")); + } + + Ok(()) +} + fn has_cmd(target_cmd: &str) -> bool { #[cfg(target_os = "windows")] let mut cmd = Command::new("where"); From 6ffdaf07d21562037f2cdf2cec4742bd58ba335a Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:19:12 -0500 Subject: [PATCH 3/8] Add SPDX headers to uefi-macros --- uefi-macros/src/lib.rs | 2 ++ uefi-macros/tests/compilation.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/uefi-macros/src/lib.rs b/uefi-macros/src/lib.rs index ad4649241..eaf329dad 100644 --- a/uefi-macros/src/lib.rs +++ b/uefi-macros/src/lib.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + #![recursion_limit = "128"] extern crate proc_macro; diff --git a/uefi-macros/tests/compilation.rs b/uefi-macros/tests/compilation.rs index 1d65132d8..cb3716ccc 100644 --- a/uefi-macros/tests/compilation.rs +++ b/uefi-macros/tests/compilation.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + #[test] fn ui() { let t = trybuild::TestCases::new(); From 0667e7412960b8241610a31b224d23f79c059af4 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:19:36 -0500 Subject: [PATCH 4/8] Add SPDX headers to uefi-raw --- uefi-raw/src/capsule.rs | 2 ++ uefi-raw/src/enums.rs | 2 ++ uefi-raw/src/firmware_storage.rs | 2 ++ uefi-raw/src/lib.rs | 2 ++ uefi-raw/src/protocol/block.rs | 2 ++ uefi-raw/src/protocol/console.rs | 2 ++ uefi-raw/src/protocol/console/serial.rs | 2 ++ uefi-raw/src/protocol/device_path.rs | 2 ++ uefi-raw/src/protocol/disk.rs | 2 ++ uefi-raw/src/protocol/driver.rs | 2 ++ uefi-raw/src/protocol/file_system.rs | 2 ++ uefi-raw/src/protocol/firmware_volume.rs | 2 ++ uefi-raw/src/protocol/hii/database.rs | 2 ++ uefi-raw/src/protocol/hii/mod.rs | 2 ++ uefi-raw/src/protocol/loaded_image.rs | 2 ++ uefi-raw/src/protocol/media.rs | 2 ++ uefi-raw/src/protocol/memory_protection.rs | 2 ++ uefi-raw/src/protocol/misc.rs | 2 ++ uefi-raw/src/protocol/mod.rs | 2 ++ uefi-raw/src/protocol/network/dhcp4.rs | 2 ++ uefi-raw/src/protocol/network/http.rs | 2 ++ uefi-raw/src/protocol/network/ip4.rs | 2 ++ uefi-raw/src/protocol/network/ip4_config2.rs | 2 ++ uefi-raw/src/protocol/network/mod.rs | 2 ++ uefi-raw/src/protocol/network/tls.rs | 2 ++ uefi-raw/src/protocol/rng.rs | 2 ++ uefi-raw/src/protocol/scsi.rs | 2 ++ uefi-raw/src/protocol/shell_params.rs | 2 ++ uefi-raw/src/protocol/string.rs | 2 ++ uefi-raw/src/protocol/tcg.rs | 2 ++ uefi-raw/src/protocol/tcg/enums.rs | 2 ++ uefi-raw/src/protocol/tcg/v1.rs | 2 ++ uefi-raw/src/protocol/tcg/v2.rs | 2 ++ uefi-raw/src/status.rs | 2 ++ uefi-raw/src/table/boot.rs | 2 ++ uefi-raw/src/table/configuration.rs | 2 ++ uefi-raw/src/table/header.rs | 2 ++ uefi-raw/src/table/mod.rs | 2 ++ uefi-raw/src/table/revision.rs | 2 ++ uefi-raw/src/table/runtime.rs | 2 ++ uefi-raw/src/table/system.rs | 2 ++ uefi-raw/src/time.rs | 2 ++ 42 files changed, 84 insertions(+) diff --git a/uefi-raw/src/capsule.rs b/uefi-raw/src/capsule.rs index 38183058c..8951e671c 100644 --- a/uefi-raw/src/capsule.rs +++ b/uefi-raw/src/capsule.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI update capsules. //! //! Capsules are used to pass information to the firmware, for example to diff --git a/uefi-raw/src/enums.rs b/uefi-raw/src/enums.rs index ebebc4482..049e827d0 100644 --- a/uefi-raw/src/enums.rs +++ b/uefi-raw/src/enums.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module provides tooling that facilitates dealing with C-style enums //! //! C-style enums and Rust-style enums are quite different. There are things diff --git a/uefi-raw/src/firmware_storage.rs b/uefi-raw/src/firmware_storage.rs index 85dbe98a4..03e320062 100644 --- a/uefi-raw/src/firmware_storage.rs +++ b/uefi-raw/src/firmware_storage.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Types related to firmware storage. use crate::Guid; diff --git a/uefi-raw/src/lib.rs b/uefi-raw/src/lib.rs index 78d320bfc..3476382d6 100644 --- a/uefi-raw/src/lib.rs +++ b/uefi-raw/src/lib.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Raw interface for working with UEFI. //! //! This crate is intended for implementing UEFI services. It is also used for diff --git a/uefi-raw/src/protocol/block.rs b/uefi-raw/src/protocol/block.rs index e688aebdf..e374a748a 100644 --- a/uefi-raw/src/protocol/block.rs +++ b/uefi-raw/src/protocol/block.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Guid, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/console.rs b/uefi-raw/src/protocol/console.rs index 441b3c2ca..194ea3de2 100644 --- a/uefi-raw/src/protocol/console.rs +++ b/uefi-raw/src/protocol/console.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub mod serial; use crate::{guid, Char16, Event, Guid, PhysicalAddress, Status}; diff --git a/uefi-raw/src/protocol/console/serial.rs b/uefi-raw/src/protocol/console/serial.rs index 8a8fb9adb..0050f209a 100644 --- a/uefi-raw/src/protocol/console/serial.rs +++ b/uefi-raw/src/protocol/console/serial.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Guid, Status}; use bitflags::bitflags; diff --git a/uefi-raw/src/protocol/device_path.rs b/uefi-raw/src/protocol/device_path.rs index a6c2addd0..194945f65 100644 --- a/uefi-raw/src/protocol/device_path.rs +++ b/uefi-raw/src/protocol/device_path.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + mod device_path_gen; use crate::{guid, Char16, Guid}; diff --git a/uefi-raw/src/protocol/disk.rs b/uefi-raw/src/protocol/disk.rs index 2f2c398c3..8bad9dc16 100644 --- a/uefi-raw/src/protocol/disk.rs +++ b/uefi-raw/src/protocol/disk.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Event, Guid, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/driver.rs b/uefi-raw/src/protocol/driver.rs index f474c3299..9e16d7890 100644 --- a/uefi-raw/src/protocol/driver.rs +++ b/uefi-raw/src/protocol/driver.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::protocol::device_path::DevicePathProtocol; use crate::{guid, Guid, Handle, Status}; diff --git a/uefi-raw/src/protocol/file_system.rs b/uefi-raw/src/protocol/file_system.rs index a8b1367fb..4d6b09716 100644 --- a/uefi-raw/src/protocol/file_system.rs +++ b/uefi-raw/src/protocol/file_system.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::time::Time; use crate::{guid, Char16, Event, Guid, Status}; use bitflags::bitflags; diff --git a/uefi-raw/src/protocol/firmware_volume.rs b/uefi-raw/src/protocol/firmware_volume.rs index 374e4912a..2dfd98916 100644 --- a/uefi-raw/src/protocol/firmware_volume.rs +++ b/uefi-raw/src/protocol/firmware_volume.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::firmware_storage::FirmwareVolumeAttributes; use crate::protocol::block::Lba; use crate::{guid, Guid, Handle, PhysicalAddress, Status}; diff --git a/uefi-raw/src/protocol/hii/database.rs b/uefi-raw/src/protocol/hii/database.rs index db112a255..054f81e54 100644 --- a/uefi-raw/src/protocol/hii/database.rs +++ b/uefi-raw/src/protocol/hii/database.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Bindings for HII Database Protocol use super::{HiiHandle, HiiPackageHeader, HiiPackageListHeader, KeyDescriptor}; diff --git a/uefi-raw/src/protocol/hii/mod.rs b/uefi-raw/src/protocol/hii/mod.rs index 5b93dd001..a224364f2 100644 --- a/uefi-raw/src/protocol/hii/mod.rs +++ b/uefi-raw/src/protocol/hii/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! HII Protocols pub mod database; diff --git a/uefi-raw/src/protocol/loaded_image.rs b/uefi-raw/src/protocol/loaded_image.rs index a91e37a67..7ba4ada6a 100644 --- a/uefi-raw/src/protocol/loaded_image.rs +++ b/uefi-raw/src/protocol/loaded_image.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::protocol::device_path::DevicePathProtocol; use crate::table::boot::MemoryType; use crate::table::system::SystemTable; diff --git a/uefi-raw/src/protocol/media.rs b/uefi-raw/src/protocol/media.rs index ceff445c0..25b9044bd 100644 --- a/uefi-raw/src/protocol/media.rs +++ b/uefi-raw/src/protocol/media.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::protocol::device_path::DevicePathProtocol; use crate::{guid, Guid, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/memory_protection.rs b/uefi-raw/src/protocol/memory_protection.rs index 1bc408351..8e3198990 100644 --- a/uefi-raw/src/protocol/memory_protection.rs +++ b/uefi-raw/src/protocol/memory_protection.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::table::boot::MemoryAttribute; use crate::{guid, Guid, PhysicalAddress, Status}; diff --git a/uefi-raw/src/protocol/misc.rs b/uefi-raw/src/protocol/misc.rs index 0147fce87..a6048c471 100644 --- a/uefi-raw/src/protocol/misc.rs +++ b/uefi-raw/src/protocol/misc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::table::runtime; use crate::{guid, Guid, Status}; diff --git a/uefi-raw/src/protocol/mod.rs b/uefi-raw/src/protocol/mod.rs index 5181a8f07..7f322a075 100644 --- a/uefi-raw/src/protocol/mod.rs +++ b/uefi-raw/src/protocol/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Protocol definitions. //! //! Protocols are sets of related functionality identified by a unique diff --git a/uefi-raw/src/protocol/network/dhcp4.rs b/uefi-raw/src/protocol/network/dhcp4.rs index 7ff96833c..a759f6a39 100644 --- a/uefi-raw/src/protocol/network/dhcp4.rs +++ b/uefi-raw/src/protocol/network/dhcp4.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Char8, Event, Guid, Ipv4Address, MacAddress, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/network/http.rs b/uefi-raw/src/protocol/network/http.rs index d3b1a8442..56ee9cfef 100644 --- a/uefi-raw/src/protocol/network/http.rs +++ b/uefi-raw/src/protocol/network/http.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Char16, Char8, Event, Guid, Ipv4Address, Ipv6Address, Status}; use core::ffi::c_void; use core::fmt::{self, Debug, Formatter}; diff --git a/uefi-raw/src/protocol/network/ip4.rs b/uefi-raw/src/protocol/network/ip4.rs index 30c3f8644..88fb04d65 100644 --- a/uefi-raw/src/protocol/network/ip4.rs +++ b/uefi-raw/src/protocol/network/ip4.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::Ipv4Address; #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] diff --git a/uefi-raw/src/protocol/network/ip4_config2.rs b/uefi-raw/src/protocol/network/ip4_config2.rs index 80a1c2c93..41f334b05 100644 --- a/uefi-raw/src/protocol/network/ip4_config2.rs +++ b/uefi-raw/src/protocol/network/ip4_config2.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::protocol::network::ip4::Ip4RouteTable; use crate::{guid, Char16, Event, Guid, Ipv4Address, MacAddress, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/network/mod.rs b/uefi-raw/src/protocol/network/mod.rs index 71d577d4e..beda45832 100644 --- a/uefi-raw/src/protocol/network/mod.rs +++ b/uefi-raw/src/protocol/network/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub mod dhcp4; pub mod http; pub mod ip4; diff --git a/uefi-raw/src/protocol/network/tls.rs b/uefi-raw/src/protocol/network/tls.rs index decb6b3ad..905c57b48 100644 --- a/uefi-raw/src/protocol/network/tls.rs +++ b/uefi-raw/src/protocol/network/tls.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Guid, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/rng.rs b/uefi-raw/src/protocol/rng.rs index f051d82ef..b1efc5489 100644 --- a/uefi-raw/src/protocol/rng.rs +++ b/uefi-raw/src/protocol/rng.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! `Rng` protocol. use crate::{guid, Guid, Status}; diff --git a/uefi-raw/src/protocol/scsi.rs b/uefi-raw/src/protocol/scsi.rs index d12cb3b18..923259cf7 100644 --- a/uefi-raw/src/protocol/scsi.rs +++ b/uefi-raw/src/protocol/scsi.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Event, Guid, Status}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/shell_params.rs b/uefi-raw/src/protocol/shell_params.rs index a47137a33..70671a748 100644 --- a/uefi-raw/src/protocol/shell_params.rs +++ b/uefi-raw/src/protocol/shell_params.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Char16, Guid}; use core::ffi::c_void; diff --git a/uefi-raw/src/protocol/string.rs b/uefi-raw/src/protocol/string.rs index 7189e8acf..9c792d4fd 100644 --- a/uefi-raw/src/protocol/string.rs +++ b/uefi-raw/src/protocol/string.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{guid, Char16, Char8, Guid}; #[derive(Debug)] diff --git a/uefi-raw/src/protocol/tcg.rs b/uefi-raw/src/protocol/tcg.rs index 4912ab049..fae7f246f 100644 --- a/uefi-raw/src/protocol/tcg.rs +++ b/uefi-raw/src/protocol/tcg.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocols. //! //! These protocols provide access to the [TPM][tpm] (Trusted Platform Module). diff --git a/uefi-raw/src/protocol/tcg/enums.rs b/uefi-raw/src/protocol/tcg/enums.rs index e421f6ea3..98ee8bcaa 100644 --- a/uefi-raw/src/protocol/tcg/enums.rs +++ b/uefi-raw/src/protocol/tcg/enums.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + newtype_enum! { /// Algorithm identifiers. /// diff --git a/uefi-raw/src/protocol/tcg/v1.rs b/uefi-raw/src/protocol/tcg/v1.rs index 540e5fcde..32bcb3b96 100644 --- a/uefi-raw/src/protocol/tcg/v1.rs +++ b/uefi-raw/src/protocol/tcg/v1.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocol for [TPM] (Trusted Platform //! Module) 1.1 and 1.2. //! diff --git a/uefi-raw/src/protocol/tcg/v2.rs b/uefi-raw/src/protocol/tcg/v2.rs index 67d1fb8c4..7021ffccb 100644 --- a/uefi-raw/src/protocol/tcg/v2.rs +++ b/uefi-raw/src/protocol/tcg/v2.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocol for [TPM] (Trusted Platform //! Module) 2.0. //! diff --git a/uefi-raw/src/status.rs b/uefi-raw/src/status.rs index 7fa13df8f..58c71d8f9 100644 --- a/uefi-raw/src/status.rs +++ b/uefi-raw/src/status.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::fmt::Debug; newtype_enum! { diff --git a/uefi-raw/src/table/boot.rs b/uefi-raw/src/table/boot.rs index c20705b3f..1acb62d3a 100644 --- a/uefi-raw/src/table/boot.rs +++ b/uefi-raw/src/table/boot.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI services available during boot. use crate::protocol::device_path::DevicePathProtocol; diff --git a/uefi-raw/src/table/configuration.rs b/uefi-raw/src/table/configuration.rs index 6e3f16817..5f423eade 100644 --- a/uefi-raw/src/table/configuration.rs +++ b/uefi-raw/src/table/configuration.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::Guid; use core::ffi::c_void; diff --git a/uefi-raw/src/table/header.rs b/uefi-raw/src/table/header.rs index bc0fbe21b..9c9f48191 100644 --- a/uefi-raw/src/table/header.rs +++ b/uefi-raw/src/table/header.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::Revision; /// The common header that all UEFI tables begin with. diff --git a/uefi-raw/src/table/mod.rs b/uefi-raw/src/table/mod.rs index 162fb5d59..3eaa29bc2 100644 --- a/uefi-raw/src/table/mod.rs +++ b/uefi-raw/src/table/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Standard UEFI tables. mod header; diff --git a/uefi-raw/src/table/revision.rs b/uefi-raw/src/table/revision.rs index d3dc0d7c5..9014e9469 100644 --- a/uefi-raw/src/table/revision.rs +++ b/uefi-raw/src/table/revision.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::fmt; /// A revision of the UEFI specification. diff --git a/uefi-raw/src/table/runtime.rs b/uefi-raw/src/table/runtime.rs index 69daa0f23..91f30ec5b 100644 --- a/uefi-raw/src/table/runtime.rs +++ b/uefi-raw/src/table/runtime.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI services available at runtime, even after the OS boots. use crate::capsule::CapsuleHeader; diff --git a/uefi-raw/src/table/system.rs b/uefi-raw/src/table/system.rs index 3d68451fc..d25df1f0d 100644 --- a/uefi-raw/src/table/system.rs +++ b/uefi-raw/src/table/system.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::protocol::console::{SimpleTextInputProtocol, SimpleTextOutputProtocol}; use crate::table::boot::BootServices; use crate::table::configuration::ConfigurationTable; diff --git a/uefi-raw/src/time.rs b/uefi-raw/src/time.rs index f16325283..9eacc3370 100644 --- a/uefi-raw/src/time.rs +++ b/uefi-raw/src/time.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Date and time types. use bitflags::bitflags; From c57680101751af6d6906df896e333c3c6320f68f Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:20:18 -0500 Subject: [PATCH 5/8] Add SPDX headers to uefi-test-runner --- uefi-test-runner/examples/hello_world.rs | 2 ++ uefi-test-runner/examples/loaded_image.rs | 2 ++ uefi-test-runner/examples/shell_params.rs | 2 ++ uefi-test-runner/examples/sierpinski.rs | 2 ++ uefi-test-runner/examples/timestamp.rs | 2 ++ uefi-test-runner/src/bin/shell_launcher.rs | 2 ++ uefi-test-runner/src/boot/memory.rs | 2 ++ uefi-test-runner/src/boot/misc.rs | 2 ++ uefi-test-runner/src/boot/mod.rs | 2 ++ uefi-test-runner/src/fs/mod.rs | 2 ++ uefi-test-runner/src/main.rs | 2 ++ uefi-test-runner/src/proto/console/gop.rs | 2 ++ uefi-test-runner/src/proto/console/mod.rs | 2 ++ uefi-test-runner/src/proto/console/pointer.rs | 2 ++ uefi-test-runner/src/proto/console/serial.rs | 2 ++ uefi-test-runner/src/proto/console/stdout.rs | 2 ++ uefi-test-runner/src/proto/debug.rs | 2 ++ uefi-test-runner/src/proto/device_path.rs | 2 ++ uefi-test-runner/src/proto/driver.rs | 2 ++ uefi-test-runner/src/proto/load.rs | 2 ++ uefi-test-runner/src/proto/loaded_image.rs | 2 ++ uefi-test-runner/src/proto/media.rs | 2 ++ uefi-test-runner/src/proto/misc.rs | 2 ++ uefi-test-runner/src/proto/mod.rs | 2 ++ uefi-test-runner/src/proto/network/mod.rs | 2 ++ uefi-test-runner/src/proto/network/pxe.rs | 2 ++ uefi-test-runner/src/proto/network/snp.rs | 2 ++ uefi-test-runner/src/proto/pi/mod.rs | 2 ++ uefi-test-runner/src/proto/pi/mp.rs | 2 ++ uefi-test-runner/src/proto/rng.rs | 2 ++ uefi-test-runner/src/proto/shell_params.rs | 2 ++ uefi-test-runner/src/proto/shim.rs | 2 ++ uefi-test-runner/src/proto/string/mod.rs | 2 ++ uefi-test-runner/src/proto/string/unicode_collation.rs | 2 ++ uefi-test-runner/src/proto/tcg.rs | 2 ++ uefi-test-runner/src/runtime/mod.rs | 2 ++ uefi-test-runner/src/runtime/vars.rs | 2 ++ 37 files changed, 74 insertions(+) diff --git a/uefi-test-runner/examples/hello_world.rs b/uefi-test-runner/examples/hello_world.rs index 769eb3556..ea9ede3fd 100644 --- a/uefi-test-runner/examples/hello_world.rs +++ b/uefi-test-runner/examples/hello_world.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // ANCHOR: all // ANCHOR: features #![no_main] diff --git a/uefi-test-runner/examples/loaded_image.rs b/uefi-test-runner/examples/loaded_image.rs index bb9e5f0c7..6e89c9a7b 100644 --- a/uefi-test-runner/examples/loaded_image.rs +++ b/uefi-test-runner/examples/loaded_image.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // ANCHOR: all #![no_main] #![no_std] diff --git a/uefi-test-runner/examples/shell_params.rs b/uefi-test-runner/examples/shell_params.rs index 14aad1035..e4e030d43 100644 --- a/uefi-test-runner/examples/shell_params.rs +++ b/uefi-test-runner/examples/shell_params.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // ANCHOR: all // ANCHOR: features #![no_main] diff --git a/uefi-test-runner/examples/sierpinski.rs b/uefi-test-runner/examples/sierpinski.rs index 530a19bb2..92a7b7450 100644 --- a/uefi-test-runner/examples/sierpinski.rs +++ b/uefi-test-runner/examples/sierpinski.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // ANCHOR: all #![no_main] #![no_std] diff --git a/uefi-test-runner/examples/timestamp.rs b/uefi-test-runner/examples/timestamp.rs index 88cb53add..1de78e0dc 100644 --- a/uefi-test-runner/examples/timestamp.rs +++ b/uefi-test-runner/examples/timestamp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // ANCHOR: all // ANCHOR: features #![no_main] diff --git a/uefi-test-runner/src/bin/shell_launcher.rs b/uefi-test-runner/src/bin/shell_launcher.rs index a087293ad..edd8aa89b 100644 --- a/uefi-test-runner/src/bin/shell_launcher.rs +++ b/uefi-test-runner/src/bin/shell_launcher.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This application launches the UEFI shell app and runs the main //! uefi-test-running app inside that shell. This allows testing of protocols //! that require the shell. diff --git a/uefi-test-runner/src/boot/memory.rs b/uefi-test-runner/src/boot/memory.rs index 2856bdaa1..9dfb9b23b 100644 --- a/uefi-test-runner/src/boot/memory.rs +++ b/uefi-test-runner/src/boot/memory.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::vec::Vec; use uefi::boot::{self, AllocateType}; use uefi::mem::memory_map::{MemoryMap, MemoryMapMut, MemoryType}; diff --git a/uefi-test-runner/src/boot/misc.rs b/uefi-test-runner/src/boot/misc.rs index 7514fa5ea..11f41bdae 100644 --- a/uefi-test-runner/src/boot/misc.rs +++ b/uefi-test-runner/src/boot/misc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::ffi::c_void; use core::ptr::{self, NonNull}; diff --git a/uefi-test-runner/src/boot/mod.rs b/uefi-test-runner/src/boot/mod.rs index 26a04581d..7fbbaccfd 100644 --- a/uefi-test-runner/src/boot/mod.rs +++ b/uefi-test-runner/src/boot/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::string::ToString; use uefi::boot::{LoadImageSource, SearchType}; use uefi::fs::FileSystem; diff --git a/uefi-test-runner/src/fs/mod.rs b/uefi-test-runner/src/fs/mod.rs index 04b1bfa2b..c487912ed 100644 --- a/uefi-test-runner/src/fs/mod.rs +++ b/uefi-test-runner/src/fs/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Tests functionality from the `uefi::fs` module. See function [`test`]. use alloc::string::{String, ToString}; diff --git a/uefi-test-runner/src/main.rs b/uefi-test-runner/src/main.rs index 43c7a3d21..bcbbb0f8e 100644 --- a/uefi-test-runner/src/main.rs +++ b/uefi-test-runner/src/main.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + #![no_std] #![no_main] diff --git a/uefi-test-runner/src/proto/console/gop.rs b/uefi-test-runner/src/proto/console/gop.rs index 8731f9894..6e490cec6 100644 --- a/uefi-test-runner/src/proto/console/gop.rs +++ b/uefi-test-runner/src/proto/console/gop.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{send_request_to_host, HostRequest}; use uefi::boot::{self, OpenProtocolAttributes, OpenProtocolParams}; use uefi::proto::console::gop::{BltOp, BltPixel, FrameBuffer, GraphicsOutput, PixelFormat}; diff --git a/uefi-test-runner/src/proto/console/mod.rs b/uefi-test-runner/src/proto/console/mod.rs index 2f16ac679..7587b87c8 100644 --- a/uefi-test-runner/src/proto/console/mod.rs +++ b/uefi-test-runner/src/proto/console/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::prelude::*; pub fn test() { diff --git a/uefi-test-runner/src/proto/console/pointer.rs b/uefi-test-runner/src/proto/console/pointer.rs index fce0ab578..c0463b531 100644 --- a/uefi-test-runner/src/proto/console/pointer.rs +++ b/uefi-test-runner/src/proto/console/pointer.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot; use uefi::proto::console::pointer::Pointer; diff --git a/uefi-test-runner/src/proto/console/serial.rs b/uefi-test-runner/src/proto/console/serial.rs index be20e0064..e7ecf8b0b 100644 --- a/uefi-test-runner/src/proto/console/serial.rs +++ b/uefi-test-runner/src/proto/console/serial.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::reconnect_serial_to_console; use uefi::proto::console::serial::{ControlBits, Serial}; use uefi::{boot, Result, ResultExt, Status}; diff --git a/uefi-test-runner/src/proto/console/stdout.rs b/uefi-test-runner/src/proto/console/stdout.rs index 8f5b88c64..43277f311 100644 --- a/uefi-test-runner/src/proto/console/stdout.rs +++ b/uefi-test-runner/src/proto/console/stdout.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::prelude::*; use uefi::proto::console::text::{Color, Output}; diff --git a/uefi-test-runner/src/proto/debug.rs b/uefi-test-runner/src/proto/debug.rs index 7f542f5b3..74ae9256f 100644 --- a/uefi-test-runner/src/proto/debug.rs +++ b/uefi-test-runner/src/proto/debug.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::vec::Vec; use core::ffi::c_void; use uefi::boot; diff --git a/uefi-test-runner/src/proto/device_path.rs b/uefi-test-runner/src/proto/device_path.rs index 25e6b8357..0620dfd79 100644 --- a/uefi-test-runner/src/proto/device_path.rs +++ b/uefi-test-runner/src/proto/device_path.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::boxed::Box; use alloc::vec::Vec; use uefi::proto::device_path::build::{self, DevicePathBuilder}; diff --git a/uefi-test-runner/src/proto/driver.rs b/uefi-test-runner/src/proto/driver.rs index 8ee3858fb..c5ce96ccd 100644 --- a/uefi-test-runner/src/proto/driver.rs +++ b/uefi-test-runner/src/proto/driver.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot::{self, ScopedProtocol, SearchType}; use uefi::prelude::*; use uefi::proto::driver::{ComponentName, ComponentName2, LanguageError, LanguageIter}; diff --git a/uefi-test-runner/src/proto/load.rs b/uefi-test-runner/src/proto/load.rs index 928e6abd1..98583d26e 100644 --- a/uefi-test-runner/src/proto/load.rs +++ b/uefi-test-runner/src/proto/load.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::boxed::Box; use alloc::string::{String, ToString}; use alloc::vec::Vec; diff --git a/uefi-test-runner/src/proto/loaded_image.rs b/uefi-test-runner/src/proto/loaded_image.rs index c192bb5f3..dce79763d 100644 --- a/uefi-test-runner/src/proto/loaded_image.rs +++ b/uefi-test-runner/src/proto/loaded_image.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::prelude::*; use uefi::proto::loaded_image::LoadedImage; diff --git a/uefi-test-runner/src/proto/media.rs b/uefi-test-runner/src/proto/media.rs index 85863a787..ebe9ff577 100644 --- a/uefi-test-runner/src/proto/media.rs +++ b/uefi-test-runner/src/proto/media.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::string::ToString; use core::cell::RefCell; use core::ptr::NonNull; diff --git a/uefi-test-runner/src/proto/misc.rs b/uefi-test-runner/src/proto/misc.rs index 55419be92..3f411448a 100644 --- a/uefi-test-runner/src/proto/misc.rs +++ b/uefi-test-runner/src/proto/misc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::prelude::*; use uefi::proto::misc::ResetNotification; use uefi::runtime::ResetType; diff --git a/uefi-test-runner/src/proto/mod.rs b/uefi-test-runner/src/proto/mod.rs index 747b9d33b..e39b525fd 100644 --- a/uefi-test-runner/src/proto/mod.rs +++ b/uefi-test-runner/src/proto/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot::{self, OpenProtocolParams}; use uefi::proto::loaded_image::LoadedImage; use uefi::{proto, Identify}; diff --git a/uefi-test-runner/src/proto/network/mod.rs b/uefi-test-runner/src/proto/network/mod.rs index 17731a342..1789c3783 100644 --- a/uefi-test-runner/src/proto/network/mod.rs +++ b/uefi-test-runner/src/proto/network/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub fn test() { info!("Testing Network protocols"); diff --git a/uefi-test-runner/src/proto/network/pxe.rs b/uefi-test-runner/src/proto/network/pxe.rs index 726dc77f8..5ae82f56f 100644 --- a/uefi-test-runner/src/proto/network/pxe.rs +++ b/uefi-test-runner/src/proto/network/pxe.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::proto::network::pxe::{BaseCode, DhcpV4Packet, IpFilter, IpFilters, UdpOpFlags}; use uefi::proto::network::IpAddress; use uefi::{boot, CStr8}; diff --git a/uefi-test-runner/src/proto/network/snp.rs b/uefi-test-runner/src/proto/network/snp.rs index a552a8033..5229ce833 100644 --- a/uefi-test-runner/src/proto/network/snp.rs +++ b/uefi-test-runner/src/proto/network/snp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::proto::network::snp::{InterruptStatus, ReceiveFlags, SimpleNetwork}; use uefi::proto::network::MacAddress; use uefi::{boot, Status}; diff --git a/uefi-test-runner/src/proto/pi/mod.rs b/uefi-test-runner/src/proto/pi/mod.rs index 3b0637176..fc0e97409 100644 --- a/uefi-test-runner/src/proto/pi/mod.rs +++ b/uefi-test-runner/src/proto/pi/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub fn test() { info!("Testing Platform Initialization protocols"); diff --git a/uefi-test-runner/src/proto/pi/mp.rs b/uefi-test-runner/src/proto/pi/mp.rs index f1ddb7741..3872851c5 100644 --- a/uefi-test-runner/src/proto/pi/mp.rs +++ b/uefi-test-runner/src/proto/pi/mp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::ffi::c_void; use core::ptr; use core::sync::atomic::{AtomicUsize, Ordering}; diff --git a/uefi-test-runner/src/proto/rng.rs b/uefi-test-runner/src/proto/rng.rs index 4eb7a414d..5f38ff8ef 100644 --- a/uefi-test-runner/src/proto/rng.rs +++ b/uefi-test-runner/src/proto/rng.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot; use uefi::proto::rng::{Rng, RngAlgorithmType}; diff --git a/uefi-test-runner/src/proto/shell_params.rs b/uefi-test-runner/src/proto/shell_params.rs index 6e2a2697f..8825da212 100644 --- a/uefi-test-runner/src/proto/shell_params.rs +++ b/uefi-test-runner/src/proto/shell_params.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot; use uefi::proto::shell_params::ShellParameters; diff --git a/uefi-test-runner/src/proto/shim.rs b/uefi-test-runner/src/proto/shim.rs index a4d7a3523..336889fd7 100644 --- a/uefi-test-runner/src/proto/shim.rs +++ b/uefi-test-runner/src/proto/shim.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::boot; use uefi::proto::shim::ShimLock; diff --git a/uefi-test-runner/src/proto/string/mod.rs b/uefi-test-runner/src/proto/string/mod.rs index b98b34218..edba5f540 100644 --- a/uefi-test-runner/src/proto/string/mod.rs +++ b/uefi-test-runner/src/proto/string/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub fn test() { info!("Testing String protocols"); diff --git a/uefi-test-runner/src/proto/string/unicode_collation.rs b/uefi-test-runner/src/proto/string/unicode_collation.rs index 4670c15c0..73de65808 100644 --- a/uefi-test-runner/src/proto/string/unicode_collation.rs +++ b/uefi-test-runner/src/proto/string/unicode_collation.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::cmp::Ordering; use uefi::proto::string::unicode_collation::{StrConversionError, UnicodeCollation}; use uefi::{boot, CStr16, CStr8}; diff --git a/uefi-test-runner/src/proto/tcg.rs b/uefi-test-runner/src/proto/tcg.rs index 55bf3e359..26959ae1d 100644 --- a/uefi-test-runner/src/proto/tcg.rs +++ b/uefi-test-runner/src/proto/tcg.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use alloc::vec::Vec; use uefi::boot; use uefi::proto::tcg::{v1, v2, AlgorithmId, EventType, HashAlgorithm, PcrIndex}; diff --git a/uefi-test-runner/src/runtime/mod.rs b/uefi-test-runner/src/runtime/mod.rs index 7b233ab3c..a27d40b35 100644 --- a/uefi-test-runner/src/runtime/mod.rs +++ b/uefi-test-runner/src/runtime/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + mod vars; use uefi::runtime::{self, Daylight, Time, TimeParams}; diff --git a/uefi-test-runner/src/runtime/vars.rs b/uefi-test-runner/src/runtime/vars.rs index d46a8f978..062884212 100644 --- a/uefi-test-runner/src/runtime/vars.rs +++ b/uefi-test-runner/src/runtime/vars.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use log::info; use uefi::prelude::*; use uefi::runtime::{VariableAttributes, VariableVendor}; From 370c2c7028c101c49a85ceff0f1b40d662b0c551 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:20:29 -0500 Subject: [PATCH 6/8] Add SPDX headers to uefi --- uefi/src/allocator.rs | 2 ++ uefi/src/boot.rs | 2 ++ uefi/src/data_types/chars.rs | 2 ++ uefi/src/data_types/guid.rs | 2 ++ uefi/src/data_types/mod.rs | 2 ++ uefi/src/data_types/opaque.rs | 2 ++ uefi/src/data_types/owned_strs.rs | 2 ++ uefi/src/data_types/strs.rs | 2 ++ uefi/src/data_types/unaligned_slice.rs | 2 ++ uefi/src/fs/dir_entry_iter.rs | 2 ++ uefi/src/fs/file_system/error.rs | 2 ++ uefi/src/fs/file_system/fs.rs | 2 ++ uefi/src/fs/file_system/mod.rs | 2 ++ uefi/src/fs/mod.rs | 2 ++ uefi/src/fs/path/mod.rs | 2 ++ uefi/src/fs/path/path.rs | 2 ++ uefi/src/fs/path/pathbuf.rs | 2 ++ uefi/src/fs/path/validation.rs | 2 ++ uefi/src/fs/uefi_types.rs | 2 ++ uefi/src/helpers/global_allocator.rs | 2 ++ uefi/src/helpers/logger.rs | 2 ++ uefi/src/helpers/mod.rs | 2 ++ uefi/src/helpers/panic_handler.rs | 2 ++ uefi/src/helpers/println.rs | 2 ++ uefi/src/lib.rs | 2 ++ uefi/src/macros.rs | 2 ++ uefi/src/mem/memory_map/api.rs | 2 ++ uefi/src/mem/memory_map/impl_.rs | 2 ++ uefi/src/mem/memory_map/iter.rs | 2 ++ uefi/src/mem/memory_map/mod.rs | 2 ++ uefi/src/mem/mod.rs | 2 ++ uefi/src/mem/util.rs | 2 ++ uefi/src/polyfill.rs | 2 ++ uefi/src/prelude.rs | 2 ++ uefi/src/proto/boot_policy.rs | 2 ++ uefi/src/proto/console/gop.rs | 2 ++ uefi/src/proto/console/mod.rs | 2 ++ uefi/src/proto/console/pointer/mod.rs | 2 ++ uefi/src/proto/console/serial.rs | 2 ++ uefi/src/proto/console/text/input.rs | 2 ++ uefi/src/proto/console/text/mod.rs | 2 ++ uefi/src/proto/console/text/output.rs | 2 ++ uefi/src/proto/debug/context.rs | 2 ++ uefi/src/proto/debug/exception.rs | 2 ++ uefi/src/proto/debug/mod.rs | 2 ++ uefi/src/proto/device_path/build.rs | 2 ++ uefi/src/proto/device_path/mod.rs | 2 ++ uefi/src/proto/device_path/text.rs | 2 ++ uefi/src/proto/driver/component_name.rs | 2 ++ uefi/src/proto/driver/mod.rs | 2 ++ uefi/src/proto/loaded_image.rs | 2 ++ uefi/src/proto/media/block.rs | 2 ++ uefi/src/proto/media/disk.rs | 2 ++ uefi/src/proto/media/file/dir.rs | 2 ++ uefi/src/proto/media/file/info.rs | 2 ++ uefi/src/proto/media/file/mod.rs | 2 ++ uefi/src/proto/media/file/regular.rs | 2 ++ uefi/src/proto/media/fs.rs | 2 ++ uefi/src/proto/media/load_file.rs | 2 ++ uefi/src/proto/media/mod.rs | 2 ++ uefi/src/proto/media/partition.rs | 2 ++ uefi/src/proto/misc.rs | 2 ++ uefi/src/proto/mod.rs | 2 ++ uefi/src/proto/network/mod.rs | 2 ++ uefi/src/proto/network/pxe.rs | 2 ++ uefi/src/proto/network/snp.rs | 2 ++ uefi/src/proto/pi/mod.rs | 2 ++ uefi/src/proto/pi/mp.rs | 2 ++ uefi/src/proto/rng.rs | 2 ++ uefi/src/proto/security/memory_protection.rs | 2 ++ uefi/src/proto/security/mod.rs | 2 ++ uefi/src/proto/shell_params.rs | 2 ++ uefi/src/proto/shim/mod.rs | 2 ++ uefi/src/proto/string/mod.rs | 2 ++ uefi/src/proto/string/unicode_collation.rs | 2 ++ uefi/src/proto/tcg/mod.rs | 2 ++ uefi/src/proto/tcg/v1.rs | 2 ++ uefi/src/proto/tcg/v2.rs | 2 ++ uefi/src/result/error.rs | 2 ++ uefi/src/result/mod.rs | 2 ++ uefi/src/result/status.rs | 2 ++ uefi/src/runtime.rs | 2 ++ uefi/src/system.rs | 2 ++ uefi/src/table/cfg.rs | 2 ++ uefi/src/table/header.rs | 2 ++ uefi/src/table/mod.rs | 2 ++ uefi/src/util.rs | 2 ++ uefi/tests/memory_map.rs | 2 ++ 88 files changed, 176 insertions(+) diff --git a/uefi/src/allocator.rs b/uefi/src/allocator.rs index e29d9fdae..223943609 100644 --- a/uefi/src/allocator.rs +++ b/uefi/src/allocator.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module implements Rust's global allocator interface using UEFI's memory allocation functions. //! //! If the `global_allocator` feature is enabled, the [`Allocator`] will be used diff --git a/uefi/src/boot.rs b/uefi/src/boot.rs index 4b5c880f5..2f87ae5cc 100644 --- a/uefi/src/boot.rs +++ b/uefi/src/boot.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI boot services. //! //! These functions will panic if called after exiting boot services. diff --git a/uefi/src/data_types/chars.rs b/uefi/src/data_types/chars.rs index 08ce168c0..9db9f14b2 100644 --- a/uefi/src/data_types/chars.rs +++ b/uefi/src/data_types/chars.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI character handling //! //! UEFI uses both Latin-1 and UCS-2 character encoding, this module implements diff --git a/uefi/src/data_types/guid.rs b/uefi/src/data_types/guid.rs index 6fe695737..cdf85a5b6 100644 --- a/uefi/src/data_types/guid.rs +++ b/uefi/src/data_types/guid.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + pub use uguid::Guid; /// Several entities in the UEFI specification can be referred to by their GUID, diff --git a/uefi/src/data_types/mod.rs b/uefi/src/data_types/mod.rs index b178d3d6a..2c94b2062 100644 --- a/uefi/src/data_types/mod.rs +++ b/uefi/src/data_types/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Data type definitions //! //! This module defines the basic data types that are used throughout uefi-rs diff --git a/uefi/src/data_types/opaque.rs b/uefi/src/data_types/opaque.rs index 91aad10aa..de1cde610 100644 --- a/uefi/src/data_types/opaque.rs +++ b/uefi/src/data_types/opaque.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + /// Create an opaque struct suitable for use as an FFI pointer. /// /// The internal representation uses the recommendation in the [nomicon]. diff --git a/uefi/src/data_types/owned_strs.rs b/uefi/src/data_types/owned_strs.rs index 856b0511a..8e01749b4 100644 --- a/uefi/src/data_types/owned_strs.rs +++ b/uefi/src/data_types/owned_strs.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::chars::{Char16, NUL_16}; use super::strs::{CStr16, FromSliceWithNulError}; use crate::data_types::strs::EqStrUntilNul; diff --git a/uefi/src/data_types/strs.rs b/uefi/src/data_types/strs.rs index 705639aa9..60c3578f5 100644 --- a/uefi/src/data_types/strs.rs +++ b/uefi/src/data_types/strs.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::chars::{Char16, Char8, NUL_16, NUL_8}; use super::UnalignedSlice; use crate::polyfill::maybe_uninit_slice_assume_init_ref; diff --git a/uefi/src/data_types/unaligned_slice.rs b/uefi/src/data_types/unaligned_slice.rs index a43c3e61b..56a0655a1 100644 --- a/uefi/src/data_types/unaligned_slice.rs +++ b/uefi/src/data_types/unaligned_slice.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::fmt::{self, Debug, Formatter}; use core::marker::PhantomData; use core::mem::MaybeUninit; diff --git a/uefi/src/fs/dir_entry_iter.rs b/uefi/src/fs/dir_entry_iter.rs index dc82477a9..4e4a437de 100644 --- a/uefi/src/fs/dir_entry_iter.rs +++ b/uefi/src/fs/dir_entry_iter.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for directory iteration. See [`UefiDirectoryIter`]. use super::*; diff --git a/uefi/src/fs/file_system/error.rs b/uefi/src/fs/file_system/error.rs index 08b5f6d44..5c2b92a80 100644 --- a/uefi/src/fs/file_system/error.rs +++ b/uefi/src/fs/file_system/error.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::fs::{PathBuf, PathError}; use alloc::string::FromUtf8Error; use core::fmt::{self, Debug, Display, Formatter}; diff --git a/uefi/src/fs/file_system/fs.rs b/uefi/src/fs/file_system/fs.rs index f3bdbc7ae..0a2261870 100644 --- a/uefi/src/fs/file_system/fs.rs +++ b/uefi/src/fs/file_system/fs.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for [`FileSystem`]. use crate::fs::*; diff --git a/uefi/src/fs/file_system/mod.rs b/uefi/src/fs/file_system/mod.rs index 3a2b9738e..dcdd8bc7b 100644 --- a/uefi/src/fs/file_system/mod.rs +++ b/uefi/src/fs/file_system/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + mod error; mod fs; diff --git a/uefi/src/fs/mod.rs b/uefi/src/fs/mod.rs index 22df15f04..70a2ca13c 100644 --- a/uefi/src/fs/mod.rs +++ b/uefi/src/fs/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! A high-level file system API for UEFI applications close to the `std::fs` //! module from Rust's standard library. The main export of this module is //! [`FileSystem`]. diff --git a/uefi/src/fs/path/mod.rs b/uefi/src/fs/path/mod.rs index 3e1edb9a8..ab2bf33ac 100644 --- a/uefi/src/fs/path/mod.rs +++ b/uefi/src/fs/path/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module offers the [`Path`] and [`PathBuf`] abstractions. //! //! # Interoperability with Rust strings diff --git a/uefi/src/fs/path/path.rs b/uefi/src/fs/path/path.rs index 1a6f0043b..4caa71a2f 100644 --- a/uefi/src/fs/path/path.rs +++ b/uefi/src/fs/path/path.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // allow "path.rs" in "path" #![allow(clippy::module_inception)] diff --git a/uefi/src/fs/path/pathbuf.rs b/uefi/src/fs/path/pathbuf.rs index de81441da..22df40b70 100644 --- a/uefi/src/fs/path/pathbuf.rs +++ b/uefi/src/fs/path/pathbuf.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::fs::path::Path; use crate::fs::SEPARATOR; use crate::{CStr16, CString16, Char16}; diff --git a/uefi/src/fs/path/validation.rs b/uefi/src/fs/path/validation.rs index 225b2d0f6..6230dcbe1 100644 --- a/uefi/src/fs/path/validation.rs +++ b/uefi/src/fs/path/validation.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Path validation for the purpose of the [`fs`] module. This is decoupled from //! [`Path`] and [`PathBuf`], as the Rust standard library also does it this //! way. Instead, the FS implementation is responsible for that. diff --git a/uefi/src/fs/uefi_types.rs b/uefi/src/fs/uefi_types.rs index 456ff9934..9ff50f5f0 100644 --- a/uefi/src/fs/uefi_types.rs +++ b/uefi/src/fs/uefi_types.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Re-export of low-level UEFI types but prefixed with `Uefi`. This simplifies //! to differ between high-level and low-level types and interfaces in this //! module. diff --git a/uefi/src/helpers/global_allocator.rs b/uefi/src/helpers/global_allocator.rs index 4ca5bdd06..97db8f9e9 100644 --- a/uefi/src/helpers/global_allocator.rs +++ b/uefi/src/helpers/global_allocator.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::allocator::Allocator; #[global_allocator] diff --git a/uefi/src/helpers/logger.rs b/uefi/src/helpers/logger.rs index 0f1ef4837..ea03813a5 100644 --- a/uefi/src/helpers/logger.rs +++ b/uefi/src/helpers/logger.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This optional feature adds support for the `log` crate, providing //! a custom logger implementation which writes to a UEFI text output protocol. //! diff --git a/uefi/src/helpers/mod.rs b/uefi/src/helpers/mod.rs index dbd3b513c..9028f354b 100644 --- a/uefi/src/helpers/mod.rs +++ b/uefi/src/helpers/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module provides miscellaneous opinionated but optional helpers to //! better integrate your application with the Rust runtime and the Rust //! ecosystem. diff --git a/uefi/src/helpers/panic_handler.rs b/uefi/src/helpers/panic_handler.rs index 79359b726..52bf7cde7 100644 --- a/uefi/src/helpers/panic_handler.rs +++ b/uefi/src/helpers/panic_handler.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{boot, println}; use cfg_if::cfg_if; diff --git a/uefi/src/helpers/println.rs b/uefi/src/helpers/println.rs index 35972f415..a55b09fe4 100644 --- a/uefi/src/helpers/println.rs +++ b/uefi/src/helpers/println.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::{boot, system}; use core::fmt::Write; diff --git a/uefi/src/lib.rs b/uefi/src/lib.rs index 6ce68cfcb..155988c8e 100644 --- a/uefi/src/lib.rs +++ b/uefi/src/lib.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Rusty wrapper for the [Unified Extensible Firmware Interface][UEFI]. //! //! This crate makes it easy to develop Rust software that leverages **safe**, diff --git a/uefi/src/macros.rs b/uefi/src/macros.rs index 5bb2f7b79..6b777407d 100644 --- a/uefi/src/macros.rs +++ b/uefi/src/macros.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + /// Encode a string literal as a [`&CStr8`]. /// /// The encoding is done at compile time, so the result can be used in a diff --git a/uefi/src/mem/memory_map/api.rs b/uefi/src/mem/memory_map/api.rs index 960967d48..2ae014403 100644 --- a/uefi/src/mem/memory_map/api.rs +++ b/uefi/src/mem/memory_map/api.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for the traits [`MemoryMap`] and [`MemoryMapMut`]. use super::*; diff --git a/uefi/src/mem/memory_map/impl_.rs b/uefi/src/mem/memory_map/impl_.rs index 9d60e50a4..23e0917e1 100644 --- a/uefi/src/mem/memory_map/impl_.rs +++ b/uefi/src/mem/memory_map/impl_.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for [`MemoryMapOwned`], [`MemoryMapRef`], and [`MemoryMapRefMut`], //! as well as relevant helper types, such as [`MemoryMapBackingMemory`]. diff --git a/uefi/src/mem/memory_map/iter.rs b/uefi/src/mem/memory_map/iter.rs index 049b52ddd..0530366a7 100644 --- a/uefi/src/mem/memory_map/iter.rs +++ b/uefi/src/mem/memory_map/iter.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::*; /// An iterator for [`MemoryMap`]. diff --git a/uefi/src/mem/memory_map/mod.rs b/uefi/src/mem/memory_map/mod.rs index 9fead2f6f..b9297b0ee 100644 --- a/uefi/src/mem/memory_map/mod.rs +++ b/uefi/src/mem/memory_map/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Bundles all relevant types and helpers to work with the UEFI memory map. //! //! To work with the memory map, you should use one of the structs diff --git a/uefi/src/mem/mod.rs b/uefi/src/mem/mod.rs index 220dc9b5b..9bd4f7f77 100644 --- a/uefi/src/mem/mod.rs +++ b/uefi/src/mem/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Types, functions, traits, and other helpers to work with memory in UEFI //! libraries and applications. diff --git a/uefi/src/mem/util.rs b/uefi/src/mem/util.rs index 6df38d916..2f380c251 100644 --- a/uefi/src/mem/util.rs +++ b/uefi/src/mem/util.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This is a utility module with helper methods for allocations/memory. use crate::data_types::Align; diff --git a/uefi/src/polyfill.rs b/uefi/src/polyfill.rs index 3b43a6da3..132075592 100644 --- a/uefi/src/polyfill.rs +++ b/uefi/src/polyfill.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Polyfills for functions in the standard library that are currently gated //! behind unstable features. diff --git a/uefi/src/prelude.rs b/uefi/src/prelude.rs index 655b6fa39..bf5b9127a 100644 --- a/uefi/src/prelude.rs +++ b/uefi/src/prelude.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module is used to simplify importing the most common UEFI types. //! //! This includes the system table modules, `Status` codes, etc. diff --git a/uefi/src/proto/boot_policy.rs b/uefi/src/proto/boot_policy.rs index 27627b19d..0cbd7cc45 100644 --- a/uefi/src/proto/boot_policy.rs +++ b/uefi/src/proto/boot_policy.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for the [`BootPolicy`] helper type. use core::fmt::{Display, Formatter}; diff --git a/uefi/src/proto/console/gop.rs b/uefi/src/proto/console/gop.rs index 0e20d6c07..7f3a51de3 100644 --- a/uefi/src/proto/console/gop.rs +++ b/uefi/src/proto/console/gop.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Graphics output protocol. //! //! The UEFI GOP is meant to replace existing [VGA][vga] hardware interfaces. diff --git a/uefi/src/proto/console/mod.rs b/uefi/src/proto/console/mod.rs index 636eb77b4..b44baa21b 100644 --- a/uefi/src/proto/console/mod.rs +++ b/uefi/src/proto/console/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Console support protocols. //! //! The console represents the various input and output methods diff --git a/uefi/src/proto/console/pointer/mod.rs b/uefi/src/proto/console/pointer/mod.rs index 7d5ca335c..8320fe7ea 100644 --- a/uefi/src/proto/console/pointer/mod.rs +++ b/uefi/src/proto/console/pointer/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Pointer device access. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/console/serial.rs b/uefi/src/proto/console/serial.rs index de52944de..a41f74a5d 100644 --- a/uefi/src/proto/console/serial.rs +++ b/uefi/src/proto/console/serial.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Abstraction over byte stream devices, also known as serial I/O devices. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/console/text/input.rs b/uefi/src/proto/console/text/input.rs index 622e44bb3..09543bbae 100644 --- a/uefi/src/proto/console/text/input.rs +++ b/uefi/src/proto/console/text/input.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::proto::unsafe_protocol; use crate::{Char16, Event, Result, Status, StatusExt}; use core::mem::MaybeUninit; diff --git a/uefi/src/proto/console/text/mod.rs b/uefi/src/proto/console/text/mod.rs index 089575fce..29eb321b0 100644 --- a/uefi/src/proto/console/text/mod.rs +++ b/uefi/src/proto/console/text/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Text I/O. mod input; diff --git a/uefi/src/proto/console/text/output.rs b/uefi/src/proto/console/text/output.rs index cb59aa3b6..da657a6d7 100644 --- a/uefi/src/proto/console/text/output.rs +++ b/uefi/src/proto/console/text/output.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::proto::unsafe_protocol; use crate::{CStr16, Result, ResultExt, Status, StatusExt}; use core::fmt; diff --git a/uefi/src/proto/debug/context.rs b/uefi/src/proto/debug/context.rs index d8b55f644..69d23a657 100644 --- a/uefi/src/proto/debug/context.rs +++ b/uefi/src/proto/debug/context.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // note from the spec: // When the context record field is larger than the register being stored in it, the upper bits of the // context record field are unused and ignored diff --git a/uefi/src/proto/debug/exception.rs b/uefi/src/proto/debug/exception.rs index 93e79cfbf..114cf601b 100644 --- a/uefi/src/proto/debug/exception.rs +++ b/uefi/src/proto/debug/exception.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + /// Represents supported CPU exceptions. #[repr(C)] #[derive(Debug)] diff --git a/uefi/src/proto/debug/mod.rs b/uefi/src/proto/debug/mod.rs index f2321889a..cfb0f90c9 100644 --- a/uefi/src/proto/debug/mod.rs +++ b/uefi/src/proto/debug/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Provides support for the UEFI debugging protocol. //! //! This protocol is designed to allow debuggers to query the state of the firmware, diff --git a/uefi/src/proto/device_path/build.rs b/uefi/src/proto/device_path/build.rs index 7d9bef313..f0d19e4f1 100644 --- a/uefi/src/proto/device_path/build.rs +++ b/uefi/src/proto/device_path/build.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Utilities for creating new [`DevicePaths`]. //! //! This module contains [`DevicePathBuilder`], as well as submodules diff --git a/uefi/src/proto/device_path/mod.rs b/uefi/src/proto/device_path/mod.rs index cb65e9bc1..f95d8315c 100644 --- a/uefi/src/proto/device_path/mod.rs +++ b/uefi/src/proto/device_path/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Device Path protocol //! //! A UEFI device path is a very flexible structure for encoding a diff --git a/uefi/src/proto/device_path/text.rs b/uefi/src/proto/device_path/text.rs index 9e920be93..c0aa3b6a5 100644 --- a/uefi/src/proto/device_path/text.rs +++ b/uefi/src/proto/device_path/text.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Protocols for converting between UEFI strings and [`DevicePath`]/[`DevicePathNode`]. // Note on return types: the specification of the conversion functions diff --git a/uefi/src/proto/driver/component_name.rs b/uefi/src/proto/driver/component_name.rs index f24b5fd75..1e948eeb0 100644 --- a/uefi/src/proto/driver/component_name.rs +++ b/uefi/src/proto/driver/component_name.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // This module defines the `ComponentName1` type and marks it deprecated. That // causes warnings for uses within this module (e.g. the `impl ComponentName1` // block), so turn off deprecated warnings. It's not yet possible to make this diff --git a/uefi/src/proto/driver/mod.rs b/uefi/src/proto/driver/mod.rs index ec629ca3c..b66711826 100644 --- a/uefi/src/proto/driver/mod.rs +++ b/uefi/src/proto/driver/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI driver model protocols. mod component_name; diff --git a/uefi/src/proto/loaded_image.rs b/uefi/src/proto/loaded_image.rs index ace4c7dba..02cfa1871 100644 --- a/uefi/src/proto/loaded_image.rs +++ b/uefi/src/proto/loaded_image.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! `LoadedImage` protocol. use crate::data_types::FromSliceWithNulError; diff --git a/uefi/src/proto/media/block.rs b/uefi/src/proto/media/block.rs index db216ae1f..cee47ab18 100644 --- a/uefi/src/proto/media/block.rs +++ b/uefi/src/proto/media/block.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Block I/O protocols. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/media/disk.rs b/uefi/src/proto/media/disk.rs index c25fe7662..a7043987b 100644 --- a/uefi/src/proto/media/disk.rs +++ b/uefi/src/proto/media/disk.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Disk I/O protocols. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/media/file/dir.rs b/uefi/src/proto/media/file/dir.rs index 9ab3b49c2..e7623aa7a 100644 --- a/uefi/src/proto/media/file/dir.rs +++ b/uefi/src/proto/media/file/dir.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::{File, FileHandle, FileInfo, FromUefi, RegularFile}; use crate::data_types::Align; use crate::Result; diff --git a/uefi/src/proto/media/file/info.rs b/uefi/src/proto/media/file/info.rs index 73ccc5937..d8c2c6d6a 100644 --- a/uefi/src/proto/media/file/info.rs +++ b/uefi/src/proto/media/file/info.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::FileAttribute; use crate::data_types::Align; use crate::runtime::Time; diff --git a/uefi/src/proto/media/file/mod.rs b/uefi/src/proto/media/file/mod.rs index 44f8273f2..fdf657327 100644 --- a/uefi/src/proto/media/file/mod.rs +++ b/uefi/src/proto/media/file/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! This module provides the `FileHandle` structure as well as the more specific `RegularFile` and //! `Directory` structures. This module also provides the `File` trait for opening, querying, //! creating, reading, and writing files. diff --git a/uefi/src/proto/media/file/regular.rs b/uefi/src/proto/media/file/regular.rs index 1656b9006..40226dedc 100644 --- a/uefi/src/proto/media/file/regular.rs +++ b/uefi/src/proto/media/file/regular.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::{File, FileHandle, FileInternal}; use crate::{Error, Result, Status, StatusExt}; diff --git a/uefi/src/proto/media/fs.rs b/uefi/src/proto/media/fs.rs index 7d2c0ee5d..1941d4ef1 100644 --- a/uefi/src/proto/media/fs.rs +++ b/uefi/src/proto/media/fs.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! File system support protocols. use super::file::{Directory, FileHandle}; diff --git a/uefi/src/proto/media/load_file.rs b/uefi/src/proto/media/load_file.rs index 6f5d74634..e01c699cd 100644 --- a/uefi/src/proto/media/load_file.rs +++ b/uefi/src/proto/media/load_file.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! LoadFile and LoadFile2 protocols. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/media/mod.rs b/uefi/src/proto/media/mod.rs index cd1473a73..579cec25c 100644 --- a/uefi/src/proto/media/mod.rs +++ b/uefi/src/proto/media/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Media access protocols. //! //! These protocols can be used to enumerate and access various media devices. diff --git a/uefi/src/proto/media/partition.rs b/uefi/src/proto/media/partition.rs index c2b368a9c..99f1c774e 100644 --- a/uefi/src/proto/media/partition.rs +++ b/uefi/src/proto/media/partition.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Partition information protocol. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/misc.rs b/uefi/src/proto/misc.rs index e329aff8e..0ccff0729 100644 --- a/uefi/src/proto/misc.rs +++ b/uefi/src/proto/misc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Miscellaneous protocols. use uefi_raw::protocol::misc::{ diff --git a/uefi/src/proto/mod.rs b/uefi/src/proto/mod.rs index c317d282c..5738908c2 100644 --- a/uefi/src/proto/mod.rs +++ b/uefi/src/proto/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Protocol definitions. //! //! Protocols are sets of related functionality identified by a unique diff --git a/uefi/src/proto/network/mod.rs b/uefi/src/proto/network/mod.rs index 0ef7f04bd..31e596ce8 100644 --- a/uefi/src/proto/network/mod.rs +++ b/uefi/src/proto/network/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Network access protocols. //! //! These protocols can be used to interact with network resources. diff --git a/uefi/src/proto/network/pxe.rs b/uefi/src/proto/network/pxe.rs index af1ac42dd..07c6db47c 100644 --- a/uefi/src/proto/network/pxe.rs +++ b/uefi/src/proto/network/pxe.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! PXE Base Code protocol. use core::ffi::c_void; diff --git a/uefi/src/proto/network/snp.rs b/uefi/src/proto/network/snp.rs index a12f2e498..f1dbe3aab 100644 --- a/uefi/src/proto/network/snp.rs +++ b/uefi/src/proto/network/snp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Simple Network Protocol //! //! Provides a packet level interface to a network adapter. diff --git a/uefi/src/proto/pi/mod.rs b/uefi/src/proto/pi/mod.rs index a45e55ba6..7ae58ac3d 100644 --- a/uefi/src/proto/pi/mod.rs +++ b/uefi/src/proto/pi/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Platform Initialization protocols. //! //! Contains protocols defined in UEFI's diff --git a/uefi/src/proto/pi/mp.rs b/uefi/src/proto/pi/mp.rs index 8fcfde94c..80de66c80 100644 --- a/uefi/src/proto/pi/mp.rs +++ b/uefi/src/proto/pi/mp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Multi-processor management protocols. //! //! On any system with more than one logical processor we can categorize them as: diff --git a/uefi/src/proto/rng.rs b/uefi/src/proto/rng.rs index 3a50854e7..18254bc2f 100644 --- a/uefi/src/proto/rng.rs +++ b/uefi/src/proto/rng.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! `Rng` protocol. use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/security/memory_protection.rs b/uefi/src/proto/security/memory_protection.rs index df7fb000b..3481195b8 100644 --- a/uefi/src/proto/security/memory_protection.rs +++ b/uefi/src/proto/security/memory_protection.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::data_types::PhysicalAddress; use crate::mem::memory_map::MemoryAttribute; use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/security/mod.rs b/uefi/src/proto/security/mod.rs index f4ac1de18..cbe208c6a 100644 --- a/uefi/src/proto/security/mod.rs +++ b/uefi/src/proto/security/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Protocols related to secure technologies. mod memory_protection; diff --git a/uefi/src/proto/shell_params.rs b/uefi/src/proto/shell_params.rs index b0aaec81c..2d4d60209 100644 --- a/uefi/src/proto/shell_params.rs +++ b/uefi/src/proto/shell_params.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! `ShellParams` protocol use crate::proto::unsafe_protocol; diff --git a/uefi/src/proto/shim/mod.rs b/uefi/src/proto/shim/mod.rs index e3d771ad1..fcde92af8 100644 --- a/uefi/src/proto/shim/mod.rs +++ b/uefi/src/proto/shim/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Shim lock protocol. #![cfg(any( diff --git a/uefi/src/proto/string/mod.rs b/uefi/src/proto/string/mod.rs index 82506324e..8d24b26bc 100644 --- a/uefi/src/proto/string/mod.rs +++ b/uefi/src/proto/string/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! String protocols. //! //! The protocols provide some string operations like diff --git a/uefi/src/proto/string/unicode_collation.rs b/uefi/src/proto/string/unicode_collation.rs index dae70448f..0836298f6 100644 --- a/uefi/src/proto/string/unicode_collation.rs +++ b/uefi/src/proto/string/unicode_collation.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! The Unicode Collation Protocol. //! //! This protocol is used in the boot services environment to perform diff --git a/uefi/src/proto/tcg/mod.rs b/uefi/src/proto/tcg/mod.rs index 82a3f8639..8d1f6595e 100644 --- a/uefi/src/proto/tcg/mod.rs +++ b/uefi/src/proto/tcg/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocols. //! //! These protocols provide access to the [TPM][tpm] (Trusted Platform Module). diff --git a/uefi/src/proto/tcg/v1.rs b/uefi/src/proto/tcg/v1.rs index 341106560..db8f13f85 100644 --- a/uefi/src/proto/tcg/v1.rs +++ b/uefi/src/proto/tcg/v1.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocol for [TPM] (Trusted Platform //! Module) 1.1 and 1.2. //! diff --git a/uefi/src/proto/tcg/v2.rs b/uefi/src/proto/tcg/v2.rs index e427ed7ec..306993891 100644 --- a/uefi/src/proto/tcg/v2.rs +++ b/uefi/src/proto/tcg/v2.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! [TCG] (Trusted Computing Group) protocol for [TPM] (Trusted Platform //! Module) 2.0. //! diff --git a/uefi/src/result/error.rs b/uefi/src/result/error.rs index a19fb5352..e321df2c0 100644 --- a/uefi/src/result/error.rs +++ b/uefi/src/result/error.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Module for UEFI-specific error encodings. See [`Error`]. use super::Status; diff --git a/uefi/src/result/mod.rs b/uefi/src/result/mod.rs index a66fca1a8..bffa86abe 100644 --- a/uefi/src/result/mod.rs +++ b/uefi/src/result/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Facilities for dealing with UEFI operation results. use core::fmt::Debug; diff --git a/uefi/src/result/status.rs b/uefi/src/result/status.rs index 808208bb0..a1ea354b6 100644 --- a/uefi/src/result/status.rs +++ b/uefi/src/result/status.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::{Error, Result}; use core::fmt::Debug; diff --git a/uefi/src/runtime.rs b/uefi/src/runtime.rs index 429aafd25..a61dee296 100644 --- a/uefi/src/runtime.rs +++ b/uefi/src/runtime.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! UEFI runtime services. //! //! These services are available both before and after exiting boot diff --git a/uefi/src/system.rs b/uefi/src/system.rs index 1d19f4f72..cdfcc81bd 100644 --- a/uefi/src/system.rs +++ b/uefi/src/system.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Functions for accessing fields of the system table. //! //! Some of these functions use a callback argument rather than returning a diff --git a/uefi/src/table/cfg.rs b/uefi/src/table/cfg.rs index c6f19df94..bbeebe456 100644 --- a/uefi/src/table/cfg.rs +++ b/uefi/src/table/cfg.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Configuration table utilities. //! //! The configuration table is an array of GUIDs and pointers to extra system tables. diff --git a/uefi/src/table/header.rs b/uefi/src/table/header.rs index af449fe4d..8c759d023 100644 --- a/uefi/src/table/header.rs +++ b/uefi/src/table/header.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::Revision; /// All standard UEFI tables begin with a common header. diff --git a/uefi/src/table/mod.rs b/uefi/src/table/mod.rs index 57f4d7c6a..462f4ab1e 100644 --- a/uefi/src/table/mod.rs +++ b/uefi/src/table/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Standard UEFI tables. pub mod cfg; diff --git a/uefi/src/util.rs b/uefi/src/util.rs index 1c3202d17..8119383e3 100644 --- a/uefi/src/util.rs +++ b/uefi/src/util.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use core::ptr::{self, NonNull}; /// Copy the bytes of `val` to `ptr`, then advance pointer to just after the diff --git a/uefi/tests/memory_map.rs b/uefi/tests/memory_map.rs index 0d7be6191..ea510f603 100644 --- a/uefi/tests/memory_map.rs +++ b/uefi/tests/memory_map.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use uefi::mem::memory_map::*; /// This test imitates a kernel that receives the UEFI memory map as boot From df0f31a1ff9abefd97c360d85ff4d49f300a06c1 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:20:34 -0500 Subject: [PATCH 7/8] Add SPDX headers to xtask --- xtask/src/arch.rs | 2 ++ xtask/src/cargo.rs | 2 ++ xtask/src/check_raw.rs | 2 ++ xtask/src/device_path/field.rs | 2 ++ xtask/src/device_path/group.rs | 2 ++ xtask/src/device_path/mod.rs | 2 ++ xtask/src/device_path/node.rs | 2 ++ xtask/src/device_path/spec.rs | 2 ++ xtask/src/device_path/util.rs | 2 ++ xtask/src/disk.rs | 2 ++ xtask/src/main.rs | 2 ++ xtask/src/net.rs | 2 ++ xtask/src/opt.rs | 2 ++ xtask/src/pipe.rs | 2 ++ xtask/src/platform.rs | 2 ++ xtask/src/qemu.rs | 2 ++ xtask/src/tpm.rs | 2 ++ xtask/src/util.rs | 2 ++ 18 files changed, 36 insertions(+) diff --git a/xtask/src/arch.rs b/xtask/src/arch.rs index 1cada508e..9bb0bb16e 100644 --- a/xtask/src/arch.rs +++ b/xtask/src/arch.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use std::fmt; #[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)] diff --git a/xtask/src/cargo.rs b/xtask/src/cargo.rs index bca199a8c..3b815508f 100644 --- a/xtask/src/cargo.rs +++ b/xtask/src/cargo.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::arch::UefiArch; use anyhow::{bail, Result}; use std::env; diff --git a/xtask/src/check_raw.rs b/xtask/src/check_raw.rs index b6887afc6..42180470e 100644 --- a/xtask/src/check_raw.rs +++ b/xtask/src/check_raw.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Validate various properties of the code in the `uefi-raw` package. //! //! For example, this checks that no Rust enums are used, that structs have an diff --git a/xtask/src/device_path/field.rs b/xtask/src/device_path/field.rs index 68ca79616..2406e4b0a 100644 --- a/xtask/src/device_path/field.rs +++ b/xtask/src/device_path/field.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::device_path::util::is_doc_attr; use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens, TokenStreamExt}; diff --git a/xtask/src/device_path/group.rs b/xtask/src/device_path/group.rs index 576a7540a..b4767edd1 100644 --- a/xtask/src/device_path/group.rs +++ b/xtask/src/device_path/group.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::node::{is_node_attr, Node}; use heck::ToUpperCamelCase; use proc_macro2::{Span, TokenStream}; diff --git a/xtask/src/device_path/mod.rs b/xtask/src/device_path/mod.rs index c22c7fb34..b03fa5e03 100644 --- a/xtask/src/device_path/mod.rs +++ b/xtask/src/device_path/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + mod field; mod group; mod node; diff --git a/xtask/src/device_path/node.rs b/xtask/src/device_path/node.rs index 1b11e7036..263b08689 100644 --- a/xtask/src/device_path/node.rs +++ b/xtask/src/device_path/node.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use super::field::NodeField; use super::group::DeviceType; use crate::device_path::util::is_doc_attr; diff --git a/xtask/src/device_path/spec.rs b/xtask/src/device_path/spec.rs index 4b59ac99c..f5ed7ac53 100644 --- a/xtask/src/device_path/spec.rs +++ b/xtask/src/device_path/spec.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + // See the README in this directory for details of what this file is. // // The nodes here are in the same order as in the UEFI Specification. diff --git a/xtask/src/device_path/util.rs b/xtask/src/device_path/util.rs index 7acf5d49d..297c48dac 100644 --- a/xtask/src/device_path/util.rs +++ b/xtask/src/device_path/util.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use anyhow::{bail, Context, Result}; use std::io::Write; use std::process::{Command, Stdio}; diff --git a/xtask/src/disk.rs b/xtask/src/disk.rs index bf4fb47d8..753f091be 100644 --- a/xtask/src/disk.rs +++ b/xtask/src/disk.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use anyhow::Result; use fatfs::{Date, DateTime, FileSystem, FormatVolumeOptions, FsOptions, Time}; use mbrman::{MBRPartitionEntry, BOOT_INACTIVE, CHS, MBR}; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 78dd9de63..9b046f3f6 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + mod arch; mod cargo; mod check_raw; diff --git a/xtask/src/net.rs b/xtask/src/net.rs index 089bf5c6e..50772f2db 100644 --- a/xtask/src/net.rs +++ b/xtask/src/net.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use std::net::UdpSocket; use std::sync::{Arc, Mutex}; use std::thread::{self, JoinHandle}; diff --git a/xtask/src/opt.rs b/xtask/src/opt.rs index aa41bd5d4..191cb3d73 100644 --- a/xtask/src/opt.rs +++ b/xtask/src/opt.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::arch::UefiArch; use clap::{Parser, Subcommand, ValueEnum}; use std::ops::Deref; diff --git a/xtask/src/pipe.rs b/xtask/src/pipe.rs index 4d1524793..94faed1f6 100644 --- a/xtask/src/pipe.rs +++ b/xtask/src/pipe.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::platform; use crate::qemu::Io; use anyhow::Result; diff --git a/xtask/src/platform.rs b/xtask/src/platform.rs index c00a72d6a..1af1d0439 100644 --- a/xtask/src/platform.rs +++ b/xtask/src/platform.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + //! Functions to determine the host platform. //! //! Use the functions where possible instead of `#[cfg(...)]` so that diff --git a/xtask/src/qemu.rs b/xtask/src/qemu.rs index beb4f5374..ee6d18161 100644 --- a/xtask/src/qemu.rs +++ b/xtask/src/qemu.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::arch::UefiArch; use crate::disk::{check_mbr_test_disk, create_mbr_test_disk}; use crate::opt::QemuOpt; diff --git a/xtask/src/tpm.rs b/xtask/src/tpm.rs index fdfda9f74..02ae842df 100644 --- a/xtask/src/tpm.rs +++ b/xtask/src/tpm.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use crate::opt::TpmVersion; use crate::util::command_to_string; use anyhow::Result; diff --git a/xtask/src/util.rs b/xtask/src/util.rs index 86a2da63b..4b6a970b8 100644 --- a/xtask/src/util.rs +++ b/xtask/src/util.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + use anyhow::{bail, Result}; use std::process::Command; From 93062c1d5a6651bfa1d1fa3ff840a5ad0043ebd9 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 5 Feb 2025 18:22:20 -0500 Subject: [PATCH 8/8] xtask fmt: Make missing SPDX headers a fatal error --- xtask/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 9b046f3f6..91e288eb9 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -245,13 +245,10 @@ fn run_fmt_project(fmt_opt: &FmtOpt) -> Result<()> { Err(e) => { if fmt_opt.check { eprintln!("❌ {e:#?}"); - // TODO: Make this a hard error after all the headers have - // been added. - eprintln!("...ignoring for now"); } else { eprintln!("❌ rust formatter failed: {e:#?}"); - any_errors = true; } + any_errors = true; } } }