Skip to main content

endpoint_sec/event/
event_searchfs.rs

1//! [`EventSearchFs`]
2
3use endpoint_sec_sys::{attrlist, es_event_searchfs_t};
4
5use crate::File;
6
7/// Access control check for searching a volume or a mounted file system event.
8#[doc(alias = "es_event_searchfs_t")]
9pub struct EventSearchFs<'a> {
10    /// Raw event
11    pub(crate) raw: &'a es_event_searchfs_t,
12}
13
14impl<'a> EventSearchFs<'a> {
15    /// The attributes that will be used to do the search.
16    #[inline(always)]
17    pub fn attrlist(&self) -> attrlist {
18        self.raw.attrlist
19    }
20
21    /// The volume whose contents will be searched.
22    #[inline(always)]
23    pub fn target(&self) -> File<'a> {
24        // Safety: 'a tied to self, object obtained through ES
25        File::new(unsafe { self.raw.target() })
26    }
27}
28
29// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
30unsafe impl Send for EventSearchFs<'_> {}
31// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
32unsafe impl Sync for EventSearchFs<'_> {}
33
34impl_debug_eq_hash_with_functions!(EventSearchFs<'a>; attrlist, target);