From: Alice Ryhl Date: Tue, 24 Mar 2026 20:02:36 +0000 (+0000) Subject: rust: task: implement == operator for Task X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12c688086f091c24e62504f5a26c009a6a8dd8bc;p=thirdparty%2Flinux.git rust: task: implement == operator for Task It's useful to compare if two tasks are the same task or not. Rust Binder wants this to check if a certain task is equal to the group leader of current. Reviewed-by: Gary Guo Signed-off-by: Alice Ryhl Link: https://patch.msgid.link/20260324-close-fd-check-current-v3-2-b94274bedac7@google.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index cc907fb531bc..deb948d99921 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -362,6 +362,15 @@ unsafe impl crate::sync::aref::AlwaysRefCounted for Task { } } +impl PartialEq for Task { + #[inline] + fn eq(&self, other: &Self) -> bool { + ptr::eq(self.as_ptr(), other.as_ptr()) + } +} + +impl Eq for Task {} + impl Kuid { /// Get the current euid. #[inline]