Skip to main content

fuser/
request_param.rs

1use ref_cast::RefCastCustom;
2use ref_cast::ref_cast_custom;
3
4use crate::ll;
5use crate::ll::fuse_abi::fuse_in_header;
6
7/// FUSE request parameters.
8#[derive(Debug, RefCastCustom)]
9#[repr(transparent)]
10pub struct Request {
11    header: fuse_in_header,
12}
13
14impl Request {
15    #[ref_cast_custom]
16    pub(crate) fn ref_cast(header: &fuse_in_header) -> &Request;
17
18    /// Returns the unique identifier of this request
19    #[inline]
20    pub fn unique(&self) -> ll::RequestId {
21        ll::RequestId(self.header.unique)
22    }
23
24    /// Returns the uid of this request
25    #[inline]
26    pub fn uid(&self) -> u32 {
27        self.header.uid
28    }
29
30    /// Returns the gid of this request
31    #[inline]
32    pub fn gid(&self) -> u32 {
33        self.header.gid
34    }
35
36    /// Returns the pid of this request
37    #[inline]
38    pub fn pid(&self) -> u32 {
39        self.header.pid
40    }
41}