endpoint_sec/event/event_mount.rs
1//! [`EventMount`]
2
3use endpoint_sec_sys::{es_event_mount_t, statfs};
4
5/// Mount a file system event.
6#[doc(alias = "es_event_mount_t")]
7pub struct EventMount<'a> {
8 /// Raw event
9 pub(crate) raw: &'a es_event_mount_t,
10}
11
12impl<'a> EventMount<'a> {
13 /// The file system stats for the file system being mounted.
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 EventMount<'_> {}
23// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
24unsafe impl Sync for EventMount<'_> {}
25
26impl_debug_eq_hash_with_functions!(EventMount<'a>; statfs);