From 8d981346bf25fb096e63724b423483164a93b56e Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Thu, 29 Aug 2024 17:15:57 +0800 Subject: [PATCH] Rename Flags: relates to #317 --- changelog/2476.changed.md | 1 + src/sys/event.rs | 13 ++++++++----- src/sys/memfd.rs | 7 +++++-- 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 changelog/2476.changed.md diff --git a/changelog/2476.changed.md b/changelog/2476.changed.md new file mode 100644 index 0000000000..f1151f0680 --- /dev/null +++ b/changelog/2476.changed.md @@ -0,0 +1 @@ +Rename Flags `EventFlag` to `EvFlags`, and `MemFdCreateFlag` to `MFdFlags` diff --git a/src/sys/event.rs b/src/sys/event.rs index b294d27c70..f533fd4279 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -173,7 +173,7 @@ libc_bitflags! { /// Event flags. See the man page for details. // There's no useful documentation we can write for the individual flags // that wouldn't simply be repeating the man page. - pub struct EventFlag: type_of_event_flag { + pub struct EvFlags: type_of_event_flag { #[allow(missing_docs)] EV_ADD; #[allow(missing_docs)] @@ -216,6 +216,9 @@ libc_bitflags! { } } +#[deprecated(since = "0.30.0", note = "Use `EvFlags instead`")] +pub type EventFlag = EvFlags; + libc_bitflags!( /// Filter-specific flags. See the man page for details. // There's no useful documentation we can write for the individual flags @@ -347,7 +350,7 @@ impl KEvent { pub fn new( ident: uintptr_t, filter: EventFilter, - flags: EventFlag, + flags: EvFlags, fflags: FilterFlag, data: intptr_t, udata: intptr_t, @@ -382,8 +385,8 @@ impl KEvent { /// Flags control what the kernel will do when this event is added with /// [`Kqueue::kevent`]. - pub fn flags(&self) -> EventFlag { - EventFlag::from_bits(self.kevent.flags).unwrap() + pub fn flags(&self) -> EvFlags { + EvFlags::from_bits(self.kevent.flags).unwrap() } /// Filter-specific flags. @@ -443,7 +446,7 @@ pub fn ev_set( ev: &mut KEvent, ident: usize, filter: EventFilter, - flags: EventFlag, + flags: EvFlags, fflags: FilterFlag, udata: intptr_t, ) { diff --git a/src/sys/memfd.rs b/src/sys/memfd.rs index 02afdfb7c8..9c3ee7ee6c 100644 --- a/src/sys/memfd.rs +++ b/src/sys/memfd.rs @@ -8,7 +8,7 @@ use crate::{NixPath, Result}; libc_bitflags!( /// Options that change the behavior of [`memfd_create`]. - pub struct MemFdCreateFlag: libc::c_uint { + pub struct MFdFlags: libc::c_uint { /// Set the close-on-exec ([`FD_CLOEXEC`]) flag on the new file descriptor. /// /// By default, the new file descriptor is set to remain open across an [`execve`] @@ -74,6 +74,9 @@ libc_bitflags!( } ); +#[deprecated(since = "0.30.0", note = "Use `MFdFlags instead`")] +pub type MemFdCreateFlag = MFdFlags; + /// Creates an anonymous file that lives in memory, and return a file-descriptor to it. /// /// The file behaves like a regular file, and so can be modified, truncated, memory-mapped, and so on. @@ -85,7 +88,7 @@ libc_bitflags!( #[inline] // Delays codegen, preventing linker errors with dylibs and --no-allow-shlib-undefined pub fn memfd_create( name: &P, - flags: MemFdCreateFlag, + flags: MFdFlags, ) -> Result { let res = name.with_nix_path(|cstr| { unsafe {