Skip to content

Commit e2571c3

Browse files
committed
deps: update bitflags to 2.1.0
We skiped 2.0.0 as due to a bug "cargo doc" didn't include generated documentation.
1 parent 9777fd4 commit e2571c3

File tree

16 files changed

+47
-25
lines changed

16 files changed

+47
-25
lines changed

Cargo.lock

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uefi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ panic-on-logger-errors = []
2424
unstable = []
2525

2626
[dependencies]
27-
bitflags = "1.3.1"
27+
bitflags = "2.1.0"
2828
derive_more = { version = "0.99.17", features = ["display"] }
2929
log = { version = "0.4.5", default-features = false }
3030
ptr_meta = { version = "0.2.0", default-features = false }

uefi/src/proto/console/serial.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ bitflags! {
157157
///
158158
/// [RS-232]: https://en.wikipedia.org/wiki/RS-232
159159
#[repr(transparent)]
160+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
161+
160162
pub struct ControlBits: u32 {
161163
/// Clear to send
162164
const CLEAR_TO_SEND = 0x10;
@@ -186,11 +188,11 @@ bitflags! {
186188
///
187189
/// Up to date as of UEFI 2.7 / Serial protocol v1
188190
const SETTABLE =
189-
ControlBits::DATA_TERMINAL_READY.bits
190-
| ControlBits::REQUEST_TO_SEND.bits
191-
| ControlBits::HARDWARE_LOOPBACK_ENABLE.bits
192-
| ControlBits::SOFTWARE_LOOPBACK_ENABLE.bits
193-
| ControlBits::HARDWARE_FLOW_CONTROL_ENABLE.bits;
191+
ControlBits::DATA_TERMINAL_READY.bits()
192+
| ControlBits::REQUEST_TO_SEND.bits()
193+
| ControlBits::HARDWARE_LOOPBACK_ENABLE.bits()
194+
| ControlBits::SOFTWARE_LOOPBACK_ENABLE.bits()
195+
| ControlBits::HARDWARE_FLOW_CONTROL_ENABLE.bits();
194196
}
195197
}
196198

uefi/src/proto/device_path/device_path_gen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ pub mod messaging {
24012401

24022402
}
24032403

2404-
bitflags! { # [doc = " Flags to identify/manage InfiniBand elements."] # [repr (transparent)] pub struct InfinibandResourceFlags : u32 { # [doc = " Set = service, unset = IOC."] const SERVICE = 0x0000_0001 ; # [doc = " Extended boot environment."] const EXTENDED_BOOT_ENVIRONMENT = 0x0000_0002 ; # [doc = " Console protocol."] const CONSOLE_PROTOCOL = 0x0000_0004 ; # [doc = " Storage protocol."] const STORAGE_PROTOCOL = 0x0000_0008 ; # [doc = " Network protocol."] const NETWORK_PROTOCOL = 0x0000_0010 ; }
2404+
bitflags! { # [doc = " Flags to identify/manage InfiniBand elements."] # [derive (Clone , Copy , Debug , Default , PartialEq , Eq , PartialOrd , Ord)] # [repr (transparent)] pub struct InfinibandResourceFlags : u32 { # [doc = " Set = service, unset = IOC."] const SERVICE = 0x0000_0001 ; # [doc = " Extended boot environment."] const EXTENDED_BOOT_ENVIRONMENT = 0x0000_0002 ; # [doc = " Console protocol."] const CONSOLE_PROTOCOL = 0x0000_0004 ; # [doc = " Storage protocol."] const STORAGE_PROTOCOL = 0x0000_0008 ; # [doc = " Network protocol."] const NETWORK_PROTOCOL = 0x0000_0010 ; }
24052405

24062406
}
24072407

@@ -2417,7 +2417,7 @@ pub mod messaging {
24172417

24182418
}
24192419

2420-
bitflags! { # [doc = " iSCSI login options."] # [repr (transparent)] pub struct IscsiLoginOptions : u16 { # [doc = " Header digest using CRC32. If not set, no header digest."] const HEADER_DIGEST_USING_CRC32 = 0x0002 ; # [doc = " Data digest using CRC32. If not set, no data digest."] const DATA_DIGEST_USING_CRC32 = 0x0008 ; # [doc = " Auth method none. If not set, auth method CHAP."] const AUTH_METHOD_NONE = 0x0800 ; # [doc = " CHAP UNI. If not set, CHAP BI."] const CHAP_UNI = 0x1000 ; }
2420+
bitflags! { # [doc = " iSCSI login options."] # [derive (Clone , Copy , Debug , Default , PartialEq , Eq , PartialOrd , Ord)] # [repr (transparent)] pub struct IscsiLoginOptions : u16 { # [doc = " Header digest using CRC32. If not set, no header digest."] const HEADER_DIGEST_USING_CRC32 = 0x0002 ; # [doc = " Data digest using CRC32. If not set, no data digest."] const DATA_DIGEST_USING_CRC32 = 0x0008 ; # [doc = " Auth method none. If not set, auth method CHAP."] const AUTH_METHOD_NONE = 0x0800 ; # [doc = " CHAP UNI. If not set, CHAP BI."] const CHAP_UNI = 0x1000 ; }
24212421

24222422
}
24232423

uefi/src/proto/media/file/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ pub enum FileMode {
394394

395395
bitflags! {
396396
/// Attributes describing the properties of a file on the file system.
397+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
397398
#[repr(transparent)]
398399
pub struct FileAttribute: u64 {
399400
/// File can only be opened in [`FileMode::READ`] mode.

uefi/src/proto/media/partition.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ bitflags! {
7676
/// * Bits `48..=63`: See
7777
/// [`type_specific_bits`][Self::type_specific_bits] and
7878
/// [`RESERVED_FOR_PARTITION_TYPE`][Self::RESERVED_FOR_PARTITION_TYPE].
79-
#[derive(Default)]
79+
80+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
8081
#[repr(transparent)]
8182
pub struct GptPartitionAttributes: u64 {
8283
/// Partition is required for the platform to function.
@@ -103,7 +104,7 @@ impl GptPartitionAttributes {
103104
/// on the partition's type (see [`GptPartitionEntry::partition_type_guid`]).
104105
#[must_use]
105106
pub const fn type_specific_bits(&self) -> u16 {
106-
(self.bits >> 48) as u16
107+
(self.bits() >> 48) as u16
107108
}
108109
}
109110

uefi/src/proto/network/pxe.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ pub struct MtftpInfo {
839839
// No corresponding type in the UEFI spec, it just uses UINT16.
840840
bitflags! {
841841
/// Flags for UDP read and write operations.
842+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
842843
#[repr(transparent)]
843844
pub struct UdpOpFlags: u16 {
844845
/// Receive a packet sent from any IP address in UDP read operations.
@@ -903,6 +904,7 @@ impl IpFilter {
903904

904905
bitflags! {
905906
/// IP receive filters.
907+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
906908
#[repr(transparent)]
907909
pub struct IpFilters: u8 {
908910
/// Enable the Station IP address.
@@ -1019,6 +1021,7 @@ impl DhcpV4Packet {
10191021
bitflags! {
10201022
/// Represents the 'flags' field for a [`DhcpV4Packet`].
10211023
#[repr(transparent)]
1024+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
10221025
pub struct DhcpV4Flags: u16 {
10231026
/// Should be set when the client cannot receive unicast IP datagrams
10241027
/// until its protocol software has been configured with an IP address.

uefi/src/proto/network/snp.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ impl SimpleNetwork {
124124
if let Some(mcast_filter) = mcast_filter {
125125
(self.receive_filters)(
126126
self,
127-
enable.bits,
128-
disable.bits,
127+
enable.bits(),
128+
disable.bits(),
129129
reset_mcast_filter,
130130
mcast_filter.len(),
131131
NonNull::new(mcast_filter.as_ptr() as *mut _),
132132
)
133133
.into()
134134
} else {
135-
(self.receive_filters)(self, enable.bits, disable.bits, reset_mcast_filter, 0, None)
135+
(self.receive_filters)(self, enable.bits(), disable.bits(), reset_mcast_filter, 0, None)
136136
.into()
137137
}
138138
}
@@ -272,6 +272,7 @@ impl SimpleNetwork {
272272
bitflags! {
273273
/// Flags to pass to receive_filters to enable/disable reception of some kinds of packets.
274274
#[repr(transparent)]
275+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
275276
pub struct ReceiveFlags : u32 {
276277
/// Receive unicast packets.
277278
const UNICAST = 0x01;
@@ -290,6 +291,7 @@ bitflags! {
290291
/// Flags returned by get_interrupt_status to indicate which interrupts have fired on the
291292
/// interface since the last call.
292293
#[repr(transparent)]
294+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
293295
pub struct InterruptStatus : u32 {
294296
/// Packet received.
295297
const RECEIVE = 0x01;

uefi/src/proto/pi/mp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ bitflags! {
2525
/// Flags indicating if the processor is BSP or AP,
2626
/// if the processor is enabled or disabled, and if
2727
/// the processor is healthy.
28-
#[derive(Default)]
2928
#[repr(transparent)]
29+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
3030
struct StatusFlag: u32 {
3131
/// Processor is playing the role of BSP.
3232
const PROCESSOR_AS_BSP_BIT = 1;

uefi/src/proto/tcg/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bitflags! {
2828
/// Hash algorithms the protocol can provide.
2929
///
3030
/// The [`v1`] protocol only supports SHA1.
31-
#[derive(Default)]
31+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
3232
#[repr(transparent)]
3333
pub struct HashAlgorithm: u32 {
3434
/// SHA-1 hash.

uefi/src/proto/tcg/v1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::util::{ptr_write_unaligned_and_add, usize_from_u32};
1616
use crate::{Error, Result, Status};
1717
use core::fmt::{self, Debug, Formatter};
1818
use core::marker::PhantomData;
19-
use core::mem::{self, MaybeUninit};
19+
use core::mem::{self, MaybeUninit, transmute};
2020
use core::ptr;
2121
use ptr_meta::Pointee;
2222

@@ -60,7 +60,7 @@ impl BootServiceCapability {
6060
pub fn hash_algorithm(&self) -> HashAlgorithm {
6161
// Safety: the value should always be 0x1 (indicating SHA-1), but
6262
// we don't care if it's some unexpected value.
63-
unsafe { HashAlgorithm::from_bits_unchecked(u32::from(self.hash_algorithm_bitmap)) }
63+
unsafe { transmute(self.hash_algorithm_bitmap as u32) }
6464
}
6565

6666
/// Whether the TPM device is present.

uefi/src/proto/tcg/v2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bitflags! {
3838
/// Event log formats supported by the firmware.
3939
///
4040
/// Corresponds to the C typedef `EFI_TCG2_EVENT_ALGORITHM_BITMAP`.
41-
#[derive(Default)]
41+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
4242
#[repr(transparent)]
4343
pub struct EventLogFormat: u32 {
4444
/// Firmware supports the SHA-1 log format.
@@ -125,7 +125,7 @@ impl BootServiceCapability {
125125

126126
bitflags! {
127127
/// Flags for the [`Tcg::hash_log_extend_event`] function.
128-
#[derive(Default)]
128+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
129129
#[repr(transparent)]
130130
pub struct HashLogExtendEventFlags: u64 {
131131
/// Extend an event but don't log it.

uefi/src/table/boot.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,7 @@ impl Align for MemoryDescriptor {
19321932
bitflags! {
19331933
/// Flags describing the capabilities of a memory range.
19341934
#[repr(transparent)]
1935+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
19351936
pub struct MemoryAttribute: u64 {
19361937
/// Supports marking as uncacheable.
19371938
const UNCACHEABLE = 0x1;
@@ -2169,6 +2170,7 @@ impl<'guid> SearchType<'guid> {
21692170
bitflags! {
21702171
/// Flags describing the type of an UEFI event and its attributes.
21712172
#[repr(transparent)]
2173+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
21722174
pub struct EventType: u32 {
21732175
/// The event is a timer event and may be passed to `BootServices::set_timer()`
21742176
/// Note that timers only function during boot services time.

uefi/src/table/cfg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub struct PropertiesTable {
6464
bitflags! {
6565
/// Flags describing memory protection.
6666
#[repr(transparent)]
67+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
6768
pub struct MemoryProtectionAttribute: usize {
6869
/// If this bit is set, then the UEFI implementation will mark pages
6970
/// containing data as non-executable.

uefi/src/table/runtime.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ pub struct TimeParams {
369369
bitflags! {
370370
/// A bitmask containing daylight savings time information.
371371
#[repr(transparent)]
372+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
372373
pub struct Daylight: u8 {
373374
/// Time is affected by daylight savings time.
374375
const ADJUST_DAYLIGHT = 0x01;
@@ -586,6 +587,7 @@ pub struct TimeCapabilities {
586587
bitflags! {
587588
/// Flags describing the attributes of a variable.
588589
#[repr(transparent)]
590+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
589591
pub struct VariableAttributes: u32 {
590592
/// Variable is maintained across a power cycle.
591593
const NON_VOLATILE = 0x01;

xtask/src/device_path/spec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ mod messaging {
598598

599599
bitflags! {
600600
/// Flags to identify/manage InfiniBand elements.
601+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
601602
#[repr(transparent)]
602603
pub struct InfinibandResourceFlags: u32 {
603604
/// Set = service, unset = IOC.
@@ -742,6 +743,7 @@ mod messaging {
742743

743744
bitflags! {
744745
/// iSCSI login options.
746+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
745747
#[repr(transparent)]
746748
pub struct IscsiLoginOptions: u16 {
747749
/// Header digest using CRC32. If not set, no header digest.

0 commit comments

Comments
 (0)