A FenceContext has a fence context number, which can serve as an ID field. This number can be useful for owners of multiple contexts to identify them, store them in an XArray etc.
Add an accessor for fctx.nr. Signed-off-by: Philipp Stanner <[email protected]> --- rust/kernel/dma_buf/dma_fence.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/kernel/dma_buf/dma_fence.rs b/rust/kernel/dma_buf/dma_fence.rs index 5300448882e7..897308f60dd3 100644 --- a/rust/kernel/dma_buf/dma_fence.rs +++ b/rust/kernel/dma_buf/dma_fence.rs @@ -135,6 +135,12 @@ pub fn new<E>( }) } + /// Obtain the FenceContext's ID number. + #[inline] + pub fn id(&self) -> u64 { + self.nr + } + fn next_seqno(&self) -> u64 { self.seqno.fetch_add(1, Relaxed) } -- 2.56.0
