lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250402214109.653341-6-lyude@redhat.com>
Date: Wed,  2 Apr 2025 17:40:33 -0400
From: Lyude Paul <lyude@...hat.com>
To: rust-for-linux@...r.kernel.org,
	Andreas Hindborg <a.hindborg@...nel.org>,
	linux-kernel@...r.kernel.org
Cc: Boqun Feng <boqun.feng@...il.com>,
	Frederic Weisbecker <frederic@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Anna-Maria Behnsen <anna-maria@...utronix.de>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>
Subject: [PATCH 5/6] rust: hrtimer: Add HrTimerCallbackContext::forward_now()

Using the HrTimerClockBase::time() function we just added, add a binding
for hrtimer_forward_now().

Signed-off-by: Lyude Paul <lyude@...hat.com>
---
 rust/kernel/time/hrtimer.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs
index 521ff1a8a5aa8..d52cbb6cfc57f 100644
--- a/rust/kernel/time/hrtimer.rs
+++ b/rust/kernel/time/hrtimer.rs
@@ -556,6 +556,14 @@ pub fn forward(&self, now: Ktime, interval: Ktime) -> u64 {
         // SAFETY: The C API requirements for this function are fulfilled by our type invariants.
         unsafe { bindings::hrtimer_forward(self.raw_get_timer(), now.to_ns(), interval.to_ns()) }
     }
+
+    /// Forward the time expiry so it expires after now.
+    ///
+    /// This is a variant of [`HrTimerCallbackContext::forward()`] that uses an interval after the
+    /// current time of the [`HrTimerClockBase`] for this [`HrTimerCallbackContext`].
+    pub fn forward_now(&self, interval: Ktime) -> u64 {
+        self.forward(self.clock_base().time(), interval)
+    }
 }
 
 /// Use to implement the [`HasHrTimer<T>`] trait.
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ