Skip to content

Commit

Permalink
Merge pull request #80 from stefano-garzarella/bitflags-2
Browse files Browse the repository at this point in the history
Update `bitflags` crate to 2.4.0
  • Loading branch information
joergroedel committed Aug 31, 2023
2 parents 1a9fcdd + 58b9635 commit dd2d701
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings -A clippy::bad_bit_mask
args: --all-features -- -D warnings
10 changes: 8 additions & 2 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 @@ -18,7 +18,7 @@ test = true
doctest = false

[dependencies]
bitflags = "1.3.2"
bitflags = "2.4"
gdbstub = { version = "0.6.6", default-features = false, optional = true }
gdbstub_arch = { version = "0.2.4", optional = true }
log = { version = "0.4.17", features = ["max_level_info", "release_max_level_info"] }
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for file in `git diff --name-only --staged`; do
fi
done

cargo clippy --all-features -- -D warnings -A clippy::bad_bit_mask || exit 1
cargo clippy --all-features -- -D warnings || exit 1

exit $RET

2 changes: 2 additions & 0 deletions src/elf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ pub struct Elf64Phdr {
}

bitflags! {
#[derive(Debug)]
pub struct Elf64PhdrFlags : Elf64Word {
const EXECUTE = 0x01;
const WRITE = 0x02;
Expand Down Expand Up @@ -866,6 +867,7 @@ pub struct Elf64Shdr {
}

bitflags! {
#[derive(Debug)]
pub struct Elf64ShdrFlags : Elf64Xword {
const WRITE = 0x001;
const ALLOC = 0x002;
Expand Down
1 change: 1 addition & 0 deletions src/mm/pagetable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ fn set_c_bit(paddr: PhysAddr) -> PhysAddr {
}

bitflags! {
#[derive(Copy, Clone)]
pub struct PTEntryFlags: u64 {
const PRESENT = 1 << 0;
const WRITABLE = 1 << 1;
Expand Down
1 change: 1 addition & 0 deletions src/sev/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use core::fmt::{self, Write};
use log;

bitflags! {
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct SEVStatusFlags: u64 {
const SEV = 1 << 0;
const SEV_ES = 1 << 1;
Expand Down
7 changes: 2 additions & 5 deletions src/sev/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
//
// Author: Joerg Roedel <jroedel@suse.de>

// For bitflags definitions
#![allow(clippy::bad_bit_mask)]

use crate::address::{Address, VirtAddr};
use crate::error::SvsmError;
use crate::types::{GUEST_VMPL, PAGE_SIZE, PAGE_SIZE_2M};
Expand Down Expand Up @@ -141,8 +138,8 @@ bitflags::bitflags! {
const X_SUPER = 1u64 << 11;
const BIT_VMSA = 1u64 << 16;
const NONE = 0;
const RWX = Self::READ.bits | Self::WRITE.bits | Self::X_USER.bits | Self::X_SUPER.bits;
const VMSA = Self::READ.bits | Self::BIT_VMSA.bits;
const RWX = Self::READ.bits() | Self::WRITE.bits() | Self::X_USER.bits() | Self::X_SUPER.bits();
const VMSA = Self::READ.bits() | Self::BIT_VMSA.bits();
}
}

Expand Down

0 comments on commit dd2d701

Please sign in to comment.