endpoint_sec/event/event_unmount.rs
1//! [`EventUnmount`]
2
3use endpoint_sec_sys::{es_event_unmount_t, statfs};
4
5/// Unmount a file system event.
6#[doc(alias = "es_event_unmount_t")]
7pub struct EventUnmount<'a> {
8 /// Raw event
9 pub(crate) raw: &'a es_event_unmount_t,
10}
11
12impl<'a> EventUnmount<'a> {
13 /// The file system stats for the file system being unmounted.
14 #[inline(always)]
15 pub fn statfs(&self) -> &'a statfs {
16 // Safety: 'a tied to self, object obtained through ES
17 unsafe { self.raw.statfs() }
18 }
19}
20
21// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
22unsafe impl Send for EventUnmount<'_> {}
23// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
24unsafe impl Sync for EventUnmount<'_> {}
25
26impl_debug_eq_hash_with_functions!(EventUnmount<'a>; statfs);