Skip to content

Commit 4280c4e

Browse files
committed
deps: update bitflags to 2.0.0
1 parent eafec33 commit 4280c4e

File tree

16 files changed

+45
-24
lines changed

16 files changed

+45
-24
lines changed

Cargo.lock

Lines changed: 11 additions & 5 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.0.1"
2828
log = { version = "0.4.5", default-features = false }
2929
ptr_meta = { version = "0.2.0", default-features = false }
3030
ucs2 = "0.3.2"

uefi/src/proto/console/serial.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ bitflags! {
156156
/// The control bits of a device. These are defined in the [RS-232] standard.
157157
///
158158
/// [RS-232]: https://en.wikipedia.org/wiki/RS-232
159+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
159160
pub struct ControlBits: u32 {
160161
/// Clear to send
161162
const CLEAR_TO_SEND = 0x10;
@@ -185,11 +186,11 @@ bitflags! {
185186
///
186187
/// Up to date as of UEFI 2.7 / Serial protocol v1
187188
const SETTABLE =
188-
ControlBits::DATA_TERMINAL_READY.bits
189-
| ControlBits::REQUEST_TO_SEND.bits
190-
| ControlBits::HARDWARE_LOOPBACK_ENABLE.bits
191-
| ControlBits::SOFTWARE_LOOPBACK_ENABLE.bits
192-
| ControlBits::HARDWARE_FLOW_CONTROL_ENABLE.bits;
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();
193194
}
194195
}
195196

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
@@ -846,6 +846,7 @@ pub struct MtftpInfo {
846846
// No corresponding type in the UEFI spec, it just uses UINT16.
847847
bitflags! {
848848
/// Flags for UDP read and write operations.
849+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
849850
#[repr(transparent)]
850851
pub struct UdpOpFlags: u16 {
851852
/// Receive a packet sent from any IP address in UDP read operations.
@@ -910,6 +911,7 @@ impl IpFilter {
910911

911912
bitflags! {
912913
/// IP receive filters.
914+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
913915
#[repr(transparent)]
914916
pub struct IpFilters: u8 {
915917
/// Enable the Station IP address.
@@ -1025,6 +1027,7 @@ impl DhcpV4Packet {
10251027

10261028
bitflags! {
10271029
/// Represents the 'flags' field for a [`DhcpV4Packet`].
1030+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
10281031
pub struct DhcpV4Flags: u16 {
10291032
/// Should be set when the client cannot receive unicast IP datagrams
10301033
/// 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
}
@@ -271,6 +271,7 @@ impl SimpleNetwork {
271271

272272
bitflags! {
273273
/// Flags to pass to receive_filters to enable/disable reception of some kinds of packets.
274+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
274275
pub struct ReceiveFlags : u32 {
275276
/// Receive unicast packets.
276277
const UNICAST = 0x01;
@@ -288,6 +289,7 @@ bitflags! {
288289
bitflags! {
289290
/// Flags returned by get_interrupt_status to indicate which interrupts have fired on the
290291
/// interface since the last call.
292+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
291293
pub struct InterruptStatus : u32 {
292294
/// Packet received.
293295
const RECEIVE = 0x01;

uefi/src/proto/pi/mp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ 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)]
28+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
2929
struct StatusFlag: u32 {
3030
/// Processor is playing the role of BSP.
3131
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, PhantomPinned};
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
@@ -1933,6 +1933,7 @@ impl Align for MemoryDescriptor {
19331933

19341934
bitflags! {
19351935
/// Flags describing the capabilities of a memory range.
1936+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
19361937
pub struct MemoryAttribute: u64 {
19371938
/// Supports marking as uncacheable.
19381939
const UNCACHEABLE = 0x1;
@@ -2169,6 +2170,7 @@ impl<'guid> SearchType<'guid> {
21692170

21702171
bitflags! {
21712172
/// Flags describing the type of an UEFI event and its attributes.
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
@@ -60,6 +60,7 @@ pub struct PropertiesTable {
6060

6161
bitflags! {
6262
/// Flags describing memory protection.
63+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
6364
pub struct MemoryProtectionAttribute: usize {
6465
/// If this bit is set, then the UEFI implementation will mark pages
6566
/// containing data as non-executable.

uefi/src/table/runtime.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ pub struct TimeParams {
365365

366366
bitflags! {
367367
/// A bitmask containing daylight savings time information.
368+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
368369
pub struct Daylight: u8 {
369370
/// Time is affected by daylight savings time.
370371
const ADJUST_DAYLIGHT = 0x01;
@@ -581,6 +582,7 @@ pub struct TimeCapabilities {
581582

582583
bitflags! {
583584
/// Flags describing the attributes of a variable.
585+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
584586
pub struct VariableAttributes: u32 {
585587
/// Variable is maintained across a power cycle.
586588
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)