[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241007.151707.748215468112346610.fujita.tomonori@gmail.com>
Date: Mon, 07 Oct 2024 15:17:07 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: anna-maria@...utronix.de, frederic@...nel.org, tglx@...utronix.de,
miguel.ojeda.sandonis@...il.com
Cc: fujita.tomonori@...il.com, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, andrew@...n.ch, hkallweit1@...il.com,
tmgross@...ch.edu, ojeda@...nel.org, alex.gaynor@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
a.hindborg@...sung.com, aliceryhl@...gle.com, arnd@...db.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 3/6] rust: time: Implement addition of
Ktime and Delta
On Sat, 5 Oct 2024 20:36:44 +0200
Miguel Ojeda <miguel.ojeda.sandonis@...il.com> wrote:
> On Sat, Oct 5, 2024 at 2:26 PM FUJITA Tomonori
> <fujita.tomonori@...il.com> wrote:
>>
>> + fn add(self, delta: Delta) -> Ktime {
>> + // SAFETY: FFI call.
>> + let t = unsafe { bindings::ktime_add_ns(self.inner, delta.as_nanos() as u64) };
>> + Ktime::from_raw(t)
>> + }
>
> I wonder if we want to use the `ktime` macros/operations for this type
> or not (even if we still promise it is the same type underneath). It
> means having to define helpers, adding `unsafe` code and `SAFETY`
> comments, a call penalty in non-LTO, losing overflow checking (if we
> want it for these types), and so on.
Yeah, if we are allowed to touch ktime_t directly instead of using the
accessors, it's great for the rust side.
The timers maintainers, what do you think?
Powered by blists - more mailing lists