Skip to content

Commit 170b6c5

Browse files
committed
compat: add #[non_exhaustive] attribute comments on enums
These are tied to kernel capabilities and new items might be added in the future.
1 parent 971f213 commit 170b6c5

File tree

7 files changed

+10
-0
lines changed

7 files changed

+10
-0
lines changed

keyutils-raw/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub type TimeoutSeconds = libc::c_uint;
4343
/// Keys which are implicitly required via syscalls and other operations are
4444
/// placed in the default keyring.
4545
#[derive(Debug, PartialEq, Eq)]
46+
// #[non_exhaustive]
4647
pub enum DefaultKeyring {
4748
/// Do not change the default keyring.
4849
///

src/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use keyutils_raw::*;
2929

3030
/// Special keyrings predefined for a process.
3131
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
32+
// #[non_exhaustive]
3233
pub enum SpecialKeyring {
3334
/// A thread-specific keyring.
3435
Thread,

src/keytypes/asymmetric.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl KeyType for Asymmetric {
6060

6161
/// A restriction that may be placed onto a keyring using an asymmetric key.
6262
#[derive(Debug, Clone, PartialEq, Eq)]
63+
// #[non_exhaustive]
6364
pub enum AsymmetricRestriction {
6465
/// Only allow keys which have been signed by a key on the builtin trusted keyring.
6566
BuiltinTrusted,

src/keytypes/blacklist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ impl KeyType for Blacklist {
4848

4949
/// The hash type to blacklist.
5050
#[derive(Debug, Clone, Eq)]
51+
// #[non_exhaustive]
5152
pub enum HashType {
5253
/// x509 data
5354
Tbs,

src/keytypes/dns_resolver.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl KeyType for DnsResolver {
4545

4646
/// The DNS record to lookup.
4747
#[derive(Debug, Clone, Eq)]
48+
// #[non_exhaustive]
4849
pub enum QueryType {
4950
/// An IPv4 address.
5051
A,

src/keytypes/encrypted.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ impl KeyType for Encrypted {
5252

5353
/// The format of the encrypted payload.
5454
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
55+
// #[non_exhaustive]
5556
pub enum Format {
5657
/// A free-form encrypted key.
5758
Default,
@@ -88,6 +89,7 @@ impl Default for Format {
8889
///
8990
/// This indicates the key type to use for encryting the generatetd key.
9091
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
92+
// #[non_exhaustive]
9193
pub enum MasterKeyType {
9294
/// A trusted key.
9395
///
@@ -111,6 +113,7 @@ impl MasterKeyType {
111113

112114
/// The payload for an encrypted key.
113115
#[derive(Debug, Clone, PartialEq, Eq)]
116+
// #[non_exhaustive]
114117
pub enum Payload {
115118
/// Create a new key.
116119
///

src/keytypes/trusted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ impl KeyType for Trusted {
4848

4949
/// Hashes supported by TPM devices.
5050
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
51+
// #[non_exhaustive]
5152
pub enum TpmHash {
5253
/// SHA-1
5354
Sha1,
@@ -164,6 +165,7 @@ impl fmt::Display for TrustedOptions {
164165

165166
/// The payload for trusted keys.
166167
#[derive(Debug, Clone, PartialEq, Eq)]
168+
// #[non_exhaustive]
167169
pub enum Payload {
168170
/// Create a new key.
169171
///

0 commit comments

Comments
 (0)