Skip to content

Commit

Permalink
Update bitflags crate to 2.4.0
Browse files Browse the repository at this point in the history
Commit a94d48d ("SVSM/sev/utils: Suppress clippy::bad_bit_mask errors")
was necessary because we use an older version of bitflags.
As suggested in this [1] bitflags issue, let's switch to the latest
version available. In this way we can avoid to suppress
clippy::bad_bit_mask.

Just minor adjustments are needed to support bitflags 2.4.0.

[1] bitflags/bitflags#373

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
  • Loading branch information
stefano-garzarella committed Aug 25, 2023
1 parent 1a9fcdd commit 20c5cb7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
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: 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 20c5cb7

Please sign in to comment.