Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
42 changes: 42 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable) with components
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: rustfmt check
run: cargo fmt --all -- --check
- name: clippy (deny warnings)
run: |
cargo clippy --all-targets --all-features -- -D warnings

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable) with components
uses: dtolnay/rust-toolchain@stable
- name: Cargo Build
run: cargo build --verbose
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable) with components
uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: cargo test --all-features --verbose
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
Cargo.lock
4 changes: 2 additions & 2 deletions src/message/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, TransferRespFlag, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, TransferRespFlag,
};
use crate::protocol::version::{PldmVersion, ProtocolVersionStr, Ver32};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/activate_fw.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed under the Apache-2.0 license

use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/apply_complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{ComponentActivationMethods, FwUpdateCmd};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
6 changes: 3 additions & 3 deletions src/message/firmware_update/get_fw_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{
ComponentParameterEntry, FirmwareDeviceCapability, FwUpdateCmd, PldmFirmwareString,
MAX_COMPONENT_COUNT, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
ComponentParameterEntry, FirmwareDeviceCapability, FwUpdateCmd, MAX_COMPONENT_COUNT,
PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/get_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{FirmwareDeviceState, FwUpdateCmd, UpdateOptionFlags};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
6 changes: 3 additions & 3 deletions src/message/firmware_update/pass_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, TransferRespFlag,
PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferRespFlag,
};
use crate::protocol::firmware_update::{
ComponentClassification, ComponentResponse, ComponentResponseCode, FwUpdateCmd,
PldmFirmwareString, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/query_devid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::codec::{PldmCodec, PldmCodecError};
use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{Descriptor, FwUpdateCmd};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/request_cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
6 changes: 3 additions & 3 deletions src/message/firmware_update/request_fw_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down Expand Up @@ -56,8 +56,8 @@ impl RequestFirmwareDataResponse<'_> {
pub fn new(
instance_id: InstanceId,
completion_code: u8,
data: &[u8],
) -> RequestFirmwareDataResponse {
data: &'_ [u8],
) -> RequestFirmwareDataResponse<'_> {
let fixed = RequestFirmwareDataResponseFixed {
hdr: PldmMsgHeader::new(
instance_id,
Expand Down
4 changes: 2 additions & 2 deletions src/message/firmware_update/request_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{
FwUpdateCmd, PldmFirmwareString, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
FwUpdateCmd, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/transfer_complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
4 changes: 2 additions & 2 deletions src/message/firmware_update/update_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::{
ComponentClassification, ComponentCompatibilityResponse, ComponentCompatibilityResponseCode,
FwUpdateCmd, PldmFirmwareString, UpdateOptionFlags, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
FwUpdateCmd, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString, UpdateOptionFlags,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
2 changes: 1 addition & 1 deletion src/message/firmware_update/verify_complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down